From bbb9f8f397d1ca40cc2362231ac505da0bc1f7a0 Mon Sep 17 00:00:00 2001 From: anysad Date: Wed, 14 May 2025 22:40:39 +0300 Subject: [PATCH] feature: are you sure? --- .../funkin/ui/debug/charting/ChartEditorState.hx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 10ec9a84a45..6881562aec8 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -94,6 +94,9 @@ import haxe.ui.components.Button; import haxe.ui.components.DropDown; import haxe.ui.components.Label; import haxe.ui.components.Slider; +import haxe.ui.containers.dialogs.Dialogs; +import haxe.ui.containers.dialogs.Dialog.DialogButton; +import haxe.ui.containers.dialogs.MessageBox.MessageBoxType; import haxe.ui.containers.dialogs.CollapsibleDialog; import haxe.ui.containers.menus.Menu; import haxe.ui.containers.menus.MenuBar; @@ -5599,7 +5602,18 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState @:nullSafety(Off) function quitChartEditor():Void { - autoSave(); + if (saveDataDirty) { + Dialogs.messageBox("You are about to leave the editor without saving.\n\nAre you sure?", "Leave Editor", MessageBoxType.TYPE_YESNO, true, function(button:DialogButton) { + if (button == DialogButton.YES) + { + autoSave(); + quitChartEditor(); + } + }); + + return; + } + stopWelcomeMusic(); // TODO: PR Flixel to make onComplete nullable. if (audioInstTrack != null) audioInstTrack.onComplete = null;