UNSAVED IN PLAYTESTING :D

This commit is contained in:
lunarcleint
2024-02-05 19:30:42 -07:00
parent 08075f3f5a
commit bb0de4edda
7 changed files with 229 additions and 21 deletions
+4
View File
@@ -16,7 +16,10 @@ class SaveWarning {
}
}
public static var warningFunc:Bool->Void = null;
public static function triggerWarning(?closingWindow:Bool = false) {
if (warningFunc != null) warningFunc(closingWindow);
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?",
[
@@ -60,5 +63,6 @@ class SaveWarning {
SaveWarning.showWarning = false;
SaveWarning.selectionClass = null;
SaveWarning.saveFunc = null;
SaveWarning.warningFunc = null;
}
}
+5 -2
View File
@@ -1094,7 +1094,7 @@ class Charter extends UIState {
#if REGION
function _file_exit(_) {
if (undos.unsaved) SaveWarning.triggerWarning();
else {undos = null; FlxG.switchState(new CharterSelection());}
else {undos = null; FlxG.switchState(new CharterSelection()); PlayState.resetSongInfos(); Charter.instance.__clearStatics();}
}
function _file_save(_) {
@@ -1197,7 +1197,6 @@ class Charter extends UIState {
selection = [];
var undo = undos.undo();
trace(undo);
switch(undo) {
case null: // do nothing
case CDeleteStrumLine(strumLineID, strumLine):
@@ -1644,6 +1643,10 @@ class Charter extends UIState {
clipboard = []; playtestInfo = null;
}
@:noCompletion public function __clearStatics() {
selection = null; undos = null; clipboard = null; playtestInfo = null;
}
@:noCompletion public function __updatePlaytestInfo() {
playtestInfo = {
songPosition: Conductor.songPosition,