WindowUtil.resetAffixes + typo fix

This commit is contained in:
NeeEoo
2024-03-26 18:09:41 +01:00
parent a054381c6a
commit 1d94945fae
5 changed files with 30 additions and 17 deletions
+25 -12
View File
@@ -4,22 +4,22 @@ import openfl.Lib;
class WindowUtils { class WindowUtils {
public static var winTitle(default, set):String; public static var winTitle(default, set):String;
public static function set_winTitle(newWinTitle:String):String { private static function set_winTitle(value:String):String {
winTitle = newWinTitle; winTitle = value;
updateTitle(); updateTitle();
return newWinTitle; return value;
} }
public static var prefix(default, set):String = ""; public static var prefix(default, set):String = "";
public static function set_prefix(newPrefix:String):String { private static function set_prefix(value:String):String {
prefix = newPrefix; prefix = value;
updateTitle(); updateTitle();
return newPrefix; return value;
} }
public static var endfix(default, set):String = ""; public static var suffix(default, set):String = "";
public static function set_endfix(endPrefix:String):String { private static function set_suffix(value:String):String {
endfix = endPrefix; suffix = value;
updateTitle(); updateTitle();
return endPrefix; return value;
} }
public static var preventClosing:Bool = true; public static var preventClosing:Bool = true;
@@ -43,10 +43,23 @@ class WindowUtils {
public static inline function resetTitle() { public static inline function resetTitle() {
winTitle = Lib.application.meta["name"]; winTitle = Lib.application.meta["name"];
prefix = endfix = ""; resetAffixes();
}
public static inline function resetAffixes() {
prefix = suffix = "";
updateTitle(); updateTitle();
} }
public static inline function updateTitle() public static inline function updateTitle()
Lib.application.window.title = '$prefix$winTitle$endfix'; Lib.application.window.title = '$prefix$winTitle$suffix';
// backwards compat
@:noCompletion public static var endfix(get, set):String;
@:noCompletion private static function set_endfix(value:String):String {
return suffix = value;
}
@:noCompletion private static function get_endfix():String {
return suffix;
}
} }
@@ -49,7 +49,7 @@ class CharacterEditor extends UIState {
public override function create() { public override function create() {
super.create(); super.create();
WindowUtils.endfix = " (Character Editor)"; WindowUtils.suffix = " (Character Editor)";
SaveWarning.selectionClass = CharacterSelection; SaveWarning.selectionClass = CharacterSelection;
SaveWarning.saveFunc = () -> {_file_save(null);}; SaveWarning.saveFunc = () -> {_file_save(null);};
+1 -1
View File
@@ -109,7 +109,7 @@ class Charter extends UIState {
public override function create() { public override function create() {
super.create(); super.create();
WindowUtils.endfix = " (Chart Editor)"; WindowUtils.suffix = " (Chart Editor)";
SaveWarning.selectionClass = CharterSelection; SaveWarning.selectionClass = CharterSelection;
SaveWarning.saveFunc = () -> {_file_save(null);}; SaveWarning.saveFunc = () -> {_file_save(null);};
+1 -1
View File
@@ -129,7 +129,7 @@ class UIState extends MusicBeatState {
super.destroy(); super.destroy();
__mousePos.put(); __mousePos.put();
WindowUtils.resetTitle(); WindowUtils.resetAffixes();
SaveWarning.reset(); SaveWarning.reset();
FlxG.stage.window.onKeyDown.remove(onKeyDown); FlxG.stage.window.onKeyDown.remove(onKeyDown);
+2 -2
View File
@@ -751,8 +751,8 @@ class PlayState extends MusicBeatState
FlxG.sound.load(Paths.sound(s)); FlxG.sound.load(Paths.sound(s));
if (chartingMode) { if (chartingMode) {
WindowUtils.endfix = " (Chart Playtesting)";
WindowUtils.prefix = Charter.undos.unsaved ? "* " : ""; WindowUtils.prefix = Charter.undos.unsaved ? "* " : "";
WindowUtils.suffix = " (Chart Playtesting)";
SaveWarning.showWarning = Charter.undos.unsaved; SaveWarning.showWarning = Charter.undos.unsaved;
SaveWarning.selectionClass = CharterSelection; SaveWarning.selectionClass = CharterSelection;
@@ -950,7 +950,7 @@ class PlayState extends MusicBeatState
FlxG.sound.destroySound(vocals); FlxG.sound.destroySound(vocals);
} }
WindowUtils.resetTitle(); WindowUtils.resetAffixes();
SaveWarning.reset(); SaveWarning.reset();
instance = null; instance = null;