Skip to content

Commit

Permalink
Change random button text when holding shift key
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed Apr 29, 2022
1 parent 2943402 commit a9d67d3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion osu.Game/Screens/Select/FooterButtonRandom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private void load(OsuColour colours)
{
SelectedColour = colours.Green;
DeselectedColour = SelectedColour.Opacity(0.5f);
Text = @"random";
updateText();

Action = () =>
{
Expand Down Expand Up @@ -59,6 +59,18 @@ private void load(OsuColour colours)
};
}

protected override bool OnKeyDown(KeyDownEvent e)
{
updateText(e.ShiftPressed);
return base.OnKeyDown(e);
}

protected override void OnKeyUp(KeyUpEvent e)
{
updateText(e.ShiftPressed);
base.OnKeyUp(e);
}

protected override bool OnClick(ClickEvent e)
{
rewindSearch = e.ShiftPressed;
Expand Down Expand Up @@ -91,5 +103,7 @@ public override void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
rewindSearch = false;
}
}

private void updateText(bool rewind = false) => Text = rewind ? "rewind" : "random";
}
}

0 comments on commit a9d67d3

Please sign in to comment.