Change random button text when holding shift key

This commit is contained in:
Salman Ahmed
2022-04-29 10:10:19 +03:00
parent 294340279e
commit a9d67d3e92

View File

@ -25,7 +25,7 @@ namespace osu.Game.Screens.Select
{
SelectedColour = colours.Green;
DeselectedColour = SelectedColour.Opacity(0.5f);
Text = @"random";
updateText();
Action = () =>
{
@ -59,6 +59,18 @@ namespace osu.Game.Screens.Select
};
}
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;
@ -91,5 +103,7 @@ namespace osu.Game.Screens.Select
rewindSearch = false;
}
}
private void updateText(bool rewind = false) => Text = rewind ? "rewind" : "random";
}
}