Disable forward button when already at end

This commit is contained in:
Dean Herbert 2022-04-20 17:50:31 +09:00
parent 7e7fa633f0
commit 8c2d70e93f

View File

@ -346,7 +346,7 @@ namespace osu.Game.Overlays
stack.CurrentScreen.Exit(); stack.CurrentScreen.Exit();
currentStepIndex--; currentStepIndex--;
updateButtonText(); updateButtons();
} }
private void showNextStep() private void showNextStep()
@ -359,7 +359,6 @@ namespace osu.Game.Overlays
if (currentStepIndex < steps.Length) if (currentStepIndex < steps.Length)
{ {
stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType)); stack.Push((Screen)Activator.CreateInstance(steps[currentStepIndex.Value].ScreenType));
updateButtonText();
} }
else else
{ {
@ -367,17 +366,21 @@ namespace osu.Game.Overlays
currentStepIndex = null; currentStepIndex = null;
Hide(); Hide();
} }
updateButtons();
} }
private void updateButtonText() private void updateButtons()
{ {
Debug.Assert(currentStepIndex != null); BackButton.Enabled.Value = currentStepIndex > 0;
NextButton.Enabled.Value = currentStepIndex != null;
BackButton.Enabled.Value = currentStepIndex != 0; if (currentStepIndex != null)
{
NextButton.Text = currentStepIndex + 1 < steps.Length NextButton.Text = currentStepIndex + 1 < steps.Length
? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description) ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description)
: CommonStrings.Finish; : CommonStrings.Finish;
}
} }
private class FirstRunStep private class FirstRunStep