From eb6d3353475de51e56479de848bc80b469b7a348 Mon Sep 17 00:00:00 2001 From: Joalor64 Date: Thu, 19 Sep 2024 20:02:59 -0400 Subject: [PATCH] jijijija --- source/states/ChartingState.hx | 7 ------- source/states/OptionsState.hx | 5 ----- source/substates/PromptSubState.hx | 26 ++++++++++++++++++++------ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/source/states/ChartingState.hx b/source/states/ChartingState.hx index cb98d6e..133f7f1 100644 --- a/source/states/ChartingState.hx +++ b/source/states/ChartingState.hx @@ -122,9 +122,6 @@ class ChartingState extends ExtendableState { for (daSection in 0...song.notes.length) song.notes[daSection].sectionNotes = []; updateGrid(); - closeSubState(); - }, () -> { - closeSubState(); })); }); add(clearSongButton); @@ -242,10 +239,6 @@ class ChartingState extends ExtendableState { + "\n"); } - override function closeSubState() { - super.closeSubState(); - } - function loadSong(daSong:String):Void { if (FlxG.sound.music != null) FlxG.sound.music.stop(); diff --git a/source/states/OptionsState.hx b/source/states/OptionsState.hx index 1c1e821..f75cb91 100644 --- a/source/states/OptionsState.hx +++ b/source/states/OptionsState.hx @@ -140,7 +140,6 @@ class OptionsState extends ExtendableState { ExtendableState.resetState(); }, () -> { FlxG.sound.play(Paths.sound('cancel')); - closeSubState(); })); } @@ -164,10 +163,6 @@ class OptionsState extends ExtendableState { } } - override function closeSubState() { - super.closeSubState(); - } - private function changeSelection(change:Int = 0) { FlxG.sound.play(Paths.sound('scroll')); curSelected = FlxMath.wrap(curSelected + change, 0, options.length - 1); diff --git a/source/substates/PromptSubState.hx b/source/substates/PromptSubState.hx index 6b5ee0e..68b3f45 100644 --- a/source/substates/PromptSubState.hx +++ b/source/substates/PromptSubState.hx @@ -1,17 +1,23 @@ package substates; class PromptSubState extends FlxSubState { - public var question:String; - public var callbackYes:Void->Void; - public var callbackNo:Void->Void; + var question:String; + var callbackYes:Void->Void; + var callbackNo:Void->Void; - public function new(question:String, callbackYes:Void->Void, callbackNo:Void->Void) { + var yesText:String = Localization.get("yes", SaveData.settings.lang); + var noText:String = Localization.get("no", SaveData.settings.lang); + + public function new(question:String, callbackYes:Void->Void, ?callbackNo:Void->Void, ?yesText:String, ?noText:String) { super(); this.question = question; this.callbackYes = callbackYes; this.callbackNo = callbackNo; + if (yesText != null) this.yesText = yesText; + if (noText != null) this.noText = noText; + var width:Float = FlxG.width * 0.75; var height:Float = FlxG.height * 0.5; @@ -25,14 +31,22 @@ class PromptSubState extends FlxSubState { questionTxt.scrollFactor.set(); add(questionTxt); - var btnYes:FlxButton = new FlxButton(0, box.height / 2 + 130, Localization.get("yes", SaveData.settings.lang), callbackYes); + var btnYes:FlxButton = new FlxButton(0, box.height / 2 + 130, yesText, () -> { + if (callbackYes != null) + callbackYes(); + close(); + }); btnYes.screenCenter(X); btnYes.scale.set(2, 2); btnYes.label.scale.set(2, 2); btnYes.label.screenCenter(XY); add(btnYes); - var btnNo:FlxButton = new FlxButton(0, btnYes.y + 50, Localization.get("no", SaveData.settings.lang), callbackNo); + var btnNo:FlxButton = new FlxButton(0, btnYes.y + 50, noText, () -> { + if (callbackNo != null) + callbackNo(); + close(); + }); btnNo.screenCenter(X); btnNo.scale.set(2, 2); btnNo.label.scale.set(2, 2);