fix options menu being able to be pressed during fade

This commit is contained in:
Cameron Taylor
2025-08-19 19:28:23 +07:00
committed by MoonDroid
parent a21eace70c
commit 7f6c0d56cd
+11 -12
View File
@@ -366,24 +366,23 @@ class MainMenuState extends MusicBeatState
override function closeSubState():Void override function closeSubState():Void
{ {
magenta.visible = false; magenta.visible = false;
#if FEATURE_TOUCH_CONTROLS
// we want to reset our backButton + optionsButton if we are returning to the main menu from a substate like freeplay
// however, we dont want to trigger these resets if we are entering the state
if (!uiStateMachine.is(Entering))
{
backButton?.animation.play('idle');
backButton?.resetCallbacks();
optionsButton?.animation.play('idle');
optionsButton?.resetCallbacks();
}
#end
// when we are in Transition (fade in on new FlxState) we don't really care about substate closing // when we are in Transition (fade in on new FlxState) we don't really care about substate closing
// this fixes issue when Entering w/ fade -> interacting -> fade ends, so it transitions to Idle on our substate end here // this fixes issue when Entering w/ fade -> interacting -> fade ends, so it transitions to Idle on our substate end here
if (!(subState is flixel.addons.transition.Transition)) if (!(subState is flixel.addons.transition.Transition))
{ {
uiStateMachine.transition(Idle); uiStateMachine.transition(Idle);
#if FEATURE_TOUCH_CONTROLS
// we want to reset our backButton + optionsButton if we are returning to the main menu from a substate like freeplay
// however, we dont want to trigger these resets if we are entering the state
backButton?.animation.play('idle');
backButton?.resetCallbacks();
optionsButton?.animation.play('idle');
optionsButton?.resetCallbacks();
#end
} }
super.closeSubState(); super.closeSubState();