diff --git a/assets/data/states/StageEditor.hx b/assets/data/states/StageEditor.hx index a3fbc93d..9f731f91 100644 --- a/assets/data/states/StageEditor.hx +++ b/assets/data/states/StageEditor.hx @@ -8,6 +8,7 @@ */ import funkin.editors.stage.StageEditor; +import funkin.editors.ui.UIWarningSubstate; import funkin.backend.utils.WindowUtils; import openfl.Lib; @@ -27,18 +28,47 @@ function tryUpdateHitbox(sprite) { return false; } +var allowClose = false; function create() { WindowUtils.preventClosing = true; WindowUtils.resetClosing(); WindowUtils.onClosing = function() { - if(!FlxG.keys.pressed.ALT) { + if(!allowClose) Lib.application.window.onClose.cancel(); - FlxG.switchState(new StageEditor(StageEditor.__stage)); - trace("you dont need to close doofus goofus"); - } + + var substate; + substate = new UIWarningSubstate("nuh uh", "you dont need to close goofus doofus", [ + { + label: "Actually Exit", + onClick: function(t) { + allowClose = true; + Lib.application.window.close(); + } + }, + { + label: "Reload State", + onClick: function(t) { + FlxG.switchState(new StageEditor(StageEditor.__stage)); + } + }, + { + label: "oh whoops", + onClick: function(t) { + substate.close(); + } + } + ]); + + openSubState(substate); } } +function destroy() { + WindowUtils.preventClosing = false; + WindowUtils.resetClosing(); + WindowUtils.onClosing = null; +} + function update() { if(FlxG.keys.justPressed.R) { trace("reloading");