warning changes
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 867 B |
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextureAtlas imagePath="button.png">
|
||||
<!-- Created without animate lol i wrote this-->
|
||||
<SubTexture name="normal-topleft" x="0" y="0" width="4" height="4"/>
|
||||
<SubTexture name="normal-top" x="4" y="0" width="12" height="4"/>
|
||||
<SubTexture name="normal-topright" x="16" y="0" width="4" height="4"/>
|
||||
<SubTexture name="normal-middleleft" x="0" y="4" width="4" height="15"/>
|
||||
<SubTexture name="normal-middle" x="4" y="4" width="12" height="15"/>
|
||||
<SubTexture name="normal-middleright" x="16" y="4" width="4" height="15"/>
|
||||
<SubTexture name="normal-bottomleft" x="0" y="19" width="4" height="4"/>
|
||||
<SubTexture name="normal-bottom" x="4" y="19" width="12" height="4"/>
|
||||
<SubTexture name="normal-bottomright" x="16" y="19" width="4" height="4"/>
|
||||
|
||||
<SubTexture name="hover-topleft" x="20" y="0" width="4" height="4"/>
|
||||
<SubTexture name="hover-top" x="24" y="0" width="12" height="4"/>
|
||||
<SubTexture name="hover-topright" x="36" y="0" width="4" height="4"/>
|
||||
<SubTexture name="hover-middleleft" x="20" y="4" width="4" height="15"/>
|
||||
<SubTexture name="hover-middle" x="24" y="4" width="12" height="15"/>
|
||||
<SubTexture name="hover-middleright" x="36" y="4" width="4" height="15"/>
|
||||
<SubTexture name="hover-bottomleft" x="20" y="19" width="4" height="4"/>
|
||||
<SubTexture name="hover-bottom" x="24" y="19" width="12" height="4"/>
|
||||
<SubTexture name="hover-bottomright" x="36" y="19" width="4" height="4"/>
|
||||
|
||||
<SubTexture name="pressed-topleft" x="40" y="0" width="4" height="4"/>
|
||||
<SubTexture name="pressed-top" x="44" y="0" width="12" height="4"/>
|
||||
<SubTexture name="pressed-topright" x="56" y="0" width="4" height="4"/>
|
||||
<SubTexture name="pressed-middleleft" x="40" y="4" width="4" height="15"/>
|
||||
<SubTexture name="pressed-middle" x="44" y="4" width="12" height="15"/>
|
||||
<SubTexture name="pressed-middleright" x="56" y="4" width="4" height="15"/>
|
||||
<SubTexture name="pressed-bottomleft" x="40" y="19" width="4" height="4"/>
|
||||
<SubTexture name="pressed-bottom" x="44" y="19" width="12" height="4"/>
|
||||
<SubTexture name="pressed-bottomright" x="56" y="19" width="4" height="4"/>
|
||||
</TextureAtlas>
|
||||
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -129,7 +129,7 @@ class UIState extends MusicBeatState {
|
||||
super.destroy();
|
||||
__mousePos.put();
|
||||
|
||||
WindowUtils.reset();
|
||||
WindowUtils.resetTitle();
|
||||
SaveWarning.reset();
|
||||
|
||||
FlxG.stage.window.onKeyDown.remove(onKeyDown);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user