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);