diff --git a/assets/images/editors/ui/grayscale-button.png b/assets/images/editors/ui/grayscale-button.png new file mode 100644 index 00000000..1467fece Binary files /dev/null and b/assets/images/editors/ui/grayscale-button.png differ diff --git a/assets/images/editors/ui/grayscale-button.xml b/assets/images/editors/ui/grayscale-button.xml new file mode 100644 index 00000000..0c0811f4 --- /dev/null +++ b/assets/images/editors/ui/grayscale-button.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/funkin/backend/utils/WindowUtils.hx b/source/funkin/backend/utils/WindowUtils.hx index d1ddec7c..609e3977 100644 --- a/source/funkin/backend/utils/WindowUtils.hx +++ b/source/funkin/backend/utils/WindowUtils.hx @@ -29,7 +29,8 @@ class WindowUtils { public static inline function resetClosing() __triedClosing = false; public static inline function init() { - reset(); + resetTitle(); + resetClosing(); Lib.application.window.onClose.add(function () { if (preventClosing && !__triedClosing) { @@ -39,9 +40,8 @@ class WindowUtils { if (onClosing != null) onClosing(); }); } - - public static inline function reset() { + public static inline function resetTitle() { winTitle = Lib.application.meta["name"]; prefix = endfix = ""; updateTitle(); diff --git a/source/funkin/editors/SaveWarning.hx b/source/funkin/editors/SaveWarning.hx index fc30ea32..73b465ac 100644 --- a/source/funkin/editors/SaveWarning.hx +++ b/source/funkin/editors/SaveWarning.hx @@ -15,19 +15,26 @@ class SaveWarning { } } - public static function triggerWarning(?resetClosing:Bool = false) { + public static function triggerWarning(?closingWindow:Bool = false) { if (FlxG.state != null && FlxG.state is UIState) { FlxG.state.openSubState(new UIWarningSubstate("Unsaved Changes!", "Your changes will be lost if you don't save them. (Can't be recovered)\n\n\nWould you like to Cancel?", [{ - label: "Exit To Menu", + label: closingWindow ? "Exit Window" : "Exit To Menu", + color: 0x74732D, onClick: function(_) { - if (selectionClass != null) FlxG.switchState(Type.createInstance(SaveWarning.selectionClass, [])); - if (resetClosing) WindowUtils.resetClosing(); + if (!closingWindow) { + if (selectionClass != null) FlxG.switchState(Type.createInstance(SaveWarning.selectionClass, [])); + if (closingWindow) WindowUtils.resetClosing(); + } else { + WindowUtils.preventClosing = false; WindowUtils.resetClosing(); + Sys.exit(0); + } } }, { label: "Cancel", - onClick: function (_) {if (resetClosing) WindowUtils.resetClosing();} + color: 0x969533, + onClick: function (_) {if (closingWindow) WindowUtils.resetClosing();} }], false)); } } diff --git a/source/funkin/editors/character/CharacterAnimButtons.hx b/source/funkin/editors/character/CharacterAnimButtons.hx index e0ebd3b9..bccc51a4 100644 --- a/source/funkin/editors/character/CharacterAnimButtons.hx +++ b/source/funkin/editors/character/CharacterAnimButtons.hx @@ -39,6 +39,7 @@ class CharacterAnimButtons extends UIButton { editButton = new UIButton(ghostButton.x+32+17, y, "", function () { CharacterEditor.instance.editAnimWithUI(this.anim); }, 32); + editButton.frames = Paths.getFrames("editors/ui/grayscale-button"); editButton.color = FlxColor.YELLOW; editButton.autoAlpha = false; members.push(editButton); diff --git a/source/funkin/editors/ui/UIState.hx b/source/funkin/editors/ui/UIState.hx index 1120c614..ba7a3943 100644 --- a/source/funkin/editors/ui/UIState.hx +++ b/source/funkin/editors/ui/UIState.hx @@ -129,7 +129,7 @@ class UIState extends MusicBeatState { super.destroy(); __mousePos.put(); - WindowUtils.reset(); + WindowUtils.resetTitle(); SaveWarning.reset(); FlxG.stage.window.onKeyDown.remove(onKeyDown); diff --git a/source/funkin/editors/ui/UIWarningSubstate.hx b/source/funkin/editors/ui/UIWarningSubstate.hx index 43633410..a67db6f9 100644 --- a/source/funkin/editors/ui/UIWarningSubstate.hx +++ b/source/funkin/editors/ui/UIWarningSubstate.hx @@ -72,10 +72,14 @@ class UIWarningSubstate extends MusicBeatSubstate { var xPos = (FlxG.width - (30 + (170 * buttons.length))) / 2; for(k=>b in buttons) { - var button = new UIButton(xPos + 20 + (170 * k), spr.y + spr.bHeight - (32 + 16), b.label, function() { + var button = new UIButton(xPos + 20 + (170 * k), spr.y + spr.bHeight - (42 + 16), b.label, function() { b.onClick(this); close(); }, 160, 30); + if (b.color != null) { + button.frames = Paths.getFrames("editors/ui/grayscale-button"); + button.color = b.color; + } add(button); } @@ -105,5 +109,6 @@ class UIWarningSubstate extends MusicBeatSubstate { typedef WarningButton = { var label:String; + var ?color:Int; var onClick:UIWarningSubstate->Void; } \ No newline at end of file