From 64a4512980d63a87595d458b9693a6e64a0d7885 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 25 Nov 2023 02:18:39 -0500 Subject: [PATCH 1/3] charting song polish + recents menu fix --- .../ui/debug/charting/ChartEditorState.hx | 19 +++++++++++++------ .../dialogs/ChartEditorWelcomeDialog.hx | 13 ++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 72cd2d0d6..fb2dd2cfe 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -874,7 +874,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // ============================== /** - * The chill audio track that plays when you open the Chart Editor. + * The chill audio track that plays in the chart editor. + * Plays when the main music is NOT being played. */ var welcomeMusic:FlxSound = new FlxSound(); @@ -1709,8 +1710,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var menuItemRecentChart:MenuItem = new MenuItem(); menuItemRecentChart.text = chartPath; menuItemRecentChart.onClick = function(_event) { - stopWelcomeMusic(); - // Load chart from file var result:Null> = this.loadFromFNFCPath(chartPath); if (result != null) @@ -1747,14 +1746,20 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState #end } - function fadeInWelcomeMusic():Void + var bgMusicTimer:FlxTimer; + + function fadeInWelcomeMusic(?extraWait:Float = 0, ?fadeInTime:Float = 5):Void { - this.welcomeMusic.play(); - this.welcomeMusic.fadeIn(4, 0, 1.0); + bgMusicTimer = new FlxTimer().start(extraWait, (_) -> { + this.welcomeMusic.volume = 0; + this.welcomeMusic.play(); + this.welcomeMusic.fadeIn(fadeInTime, 0, 1.0); + }); } function stopWelcomeMusic():Void { + if (bgMusicTimer != null) bgMusicTimer.cancel(); // this.welcomeMusic.fadeOut(4, 0); this.welcomeMusic.pause(); } @@ -4979,10 +4984,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (audioInstTrack.playing) { + fadeInWelcomeMusic(7, 10); stopAudioPlayback(); } else { + welcomeMusic.pause(); startAudioPlayback(); } } diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx index 0a0bb5064..3c8fbb15b 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx @@ -74,7 +74,6 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog public override function onClose(event:DialogEvent):Void { super.onClose(event); - state.stopWelcomeMusic(); } /** @@ -84,10 +83,12 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog public function addRecentFilePath(state:ChartEditorState, chartPath:String):Void { var linkRecentChart:Link = new Link(); - linkRecentChart.text = chartPath; + var fileNamePattern:EReg = new EReg("([^/\\\\]+)$", ""); + var fileName:String = fileNamePattern.match(chartPath) ? fileNamePattern.matched(1) : chartPath; + linkRecentChart.text = fileName; + linkRecentChart.tooltip = chartPath; linkRecentChart.onClick = function(_event) { this.hideDialog(DialogButton.CANCEL); - state.stopWelcomeMusic(); // Load chart from file var result:Null> = ChartEditorImportExportHandler.loadFromFNFCPath(state, chartPath); @@ -161,7 +162,6 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog this.addTemplateSong(songName, targetSongId, (_) -> { this.hideDialog(DialogButton.CANCEL); - state.stopWelcomeMusic(); // Load song from template state.loadSongAsTemplate(targetSongId); @@ -189,7 +189,6 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog { // Hide the welcome dialog this.hideDialog(DialogButton.CANCEL); - state.stopWelcomeMusic(); // Open the "Open Chart" dialog state.openBrowseFNFC(false); @@ -203,7 +202,6 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog { // Hide the welcome dialog this.hideDialog(DialogButton.CANCEL); - state.stopWelcomeMusic(); // // Create Song Wizard @@ -219,7 +217,6 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog { // Hide the welcome dialog this.hideDialog(DialogButton.CANCEL); - state.stopWelcomeMusic(); // // Create Song Wizard @@ -235,7 +232,6 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog { // Hide the welcome dialog this.hideDialog(DialogButton.CANCEL); - state.stopWelcomeMusic(); // // Create Song Wizard @@ -251,7 +247,6 @@ class ChartEditorWelcomeDialog extends ChartEditorBaseDialog { // Hide the welcome dialog this.hideDialog(DialogButton.CANCEL); - state.stopWelcomeMusic(); // Open the "Import Chart" dialog state.openImportChartWizard('legacy', false); From f3a38e02327ed177bd98a8e0fd1cb2c2770356fe Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 25 Nov 2023 02:48:43 -0500 Subject: [PATCH 2/3] fixing the stop --- source/funkin/ui/debug/charting/ChartEditorState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index fb2dd2cfe..101690270 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -4989,7 +4989,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } else { - welcomeMusic.pause(); + stopWelcomeMusic(); startAudioPlayback(); } } From 41384ddf0dfb0e1d6b43647612de0201ab7e96cc Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 25 Nov 2023 03:50:22 -0500 Subject: [PATCH 3/3] playtesting fix --- source/funkin/ui/debug/charting/ChartEditorState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 101690270..1794a3b7e 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -4352,7 +4352,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Override music. if (audioInstTrack != null) FlxG.sound.music = audioInstTrack; if (audioVocalTrackGroup != null) targetState.vocals = audioVocalTrackGroup; - + stopWelcomeMusic(); openSubState(targetState); }