1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Don't switch FooterButtonRandon Action on pressed.

Instead, create a new Action that invokes either NextRandom or PreviousRandom, depending on rewindSearch
This commit is contained in:
Jack Boswell (boswelja) 2020-06-07 15:34:19 +12:00
parent 978380a7fb
commit 0e155c8eb9

View File

@ -40,6 +40,17 @@ namespace osu.Game.Screens.Select
SelectedColour = colours.Green;
DeselectedColour = SelectedColour.Opacity(0.5f);
Text = @"random";
Action = () =>
{
if (rewindSearch)
{
PreviousRandom.Invoke();
}
else
{
NextRandom.Invoke();
}
};
}
private void updateText()
@ -58,23 +69,14 @@ namespace osu.Game.Screens.Select
public override bool OnPressed(GlobalAction action)
{
switch (action)
rewindSearch = action == GlobalAction.SelectPreviousRandom;
if (action != GlobalAction.SelectNextRandom && !rewindSearch)
{
case GlobalAction.SelectPreviousRandom:
rewindSearch = true;
Action = PreviousRandom;
updateText();
Click();
return true;
case GlobalAction.SelectNextRandom:
Action = NextRandom;
updateText();
Click();
return true;
return false;
}
return false;
updateText();
Click();
return true;
}
public override void OnReleased(GlobalAction action)