From 0e155c8eb9729106891708bee5eadc63acdf0ef6 Mon Sep 17 00:00:00 2001 From: "Jack Boswell (boswelja)" Date: Sun, 7 Jun 2020 15:34:19 +1200 Subject: [PATCH] Don't switch FooterButtonRandon Action on pressed. Instead, create a new Action that invokes either NextRandom or PreviousRandom, depending on rewindSearch --- osu.Game/Screens/Select/FooterButtonRandom.cs | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Select/FooterButtonRandom.cs b/osu.Game/Screens/Select/FooterButtonRandom.cs index 9316d4e064..07de29a0ea 100644 --- a/osu.Game/Screens/Select/FooterButtonRandom.cs +++ b/osu.Game/Screens/Select/FooterButtonRandom.cs @@ -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)