1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 14:53:01 +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; SelectedColour = colours.Green;
DeselectedColour = SelectedColour.Opacity(0.5f); DeselectedColour = SelectedColour.Opacity(0.5f);
Text = @"random"; Text = @"random";
Action = () =>
{
if (rewindSearch)
{
PreviousRandom.Invoke();
}
else
{
NextRandom.Invoke();
}
};
} }
private void updateText() private void updateText()
@ -58,23 +69,14 @@ namespace osu.Game.Screens.Select
public override bool OnPressed(GlobalAction action) public override bool OnPressed(GlobalAction action)
{ {
switch (action) rewindSearch = action == GlobalAction.SelectPreviousRandom;
if (action != GlobalAction.SelectNextRandom && !rewindSearch)
{ {
case GlobalAction.SelectPreviousRandom: return false;
rewindSearch = true;
Action = PreviousRandom;
updateText();
Click();
return true;
case GlobalAction.SelectNextRandom:
Action = NextRandom;
updateText();
Click();
return true;
} }
updateText();
return false; Click();
return true;
} }
public override void OnReleased(GlobalAction action) public override void OnReleased(GlobalAction action)