diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs
index f55c099d83..82d0c63917 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapOptionsOverlay.cs
@@ -5,7 +5,6 @@ using System.ComponentModel;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Select.Options;
using osuTK.Graphics;
-using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelect
{
@@ -16,10 +15,10 @@ namespace osu.Game.Tests.Visual.SongSelect
{
var overlay = new BeatmapOptionsOverlay();
- overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, Color4.Purple, null, Key.Number1);
- overlay.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, Color4.Purple, null, Key.Number2);
- overlay.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, Color4.Pink, null, Key.Number3);
- overlay.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, Color4.Yellow, null, Key.Number4);
+ overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, Color4.Purple, null);
+ overlay.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, Color4.Purple, null);
+ overlay.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, Color4.Pink, null);
+ overlay.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, Color4.Yellow, null);
Add(overlay);
diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs
index 4e4653cb57..bd610608b9 100644
--- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs
+++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs
@@ -52,8 +52,6 @@ namespace osu.Game.Screens.Select.Options
set => secondLine.Text = value;
}
- public Key? HotKey;
-
protected override bool OnMouseDown(MouseDownEvent e)
{
flash.FadeTo(0.1f, 1000, Easing.OutQuint);
@@ -75,17 +73,6 @@ namespace osu.Game.Screens.Select.Options
return base.OnClick(e);
}
- protected override bool OnKeyDown(KeyDownEvent e)
- {
- if (!e.Repeat && e.Key == HotKey)
- {
- Click();
- return true;
- }
-
- return false;
- }
-
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos);
public BeatmapOptionsButton()
diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
index 87e4505cd2..70cbc7d588 100644
--- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
+++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs
@@ -11,6 +11,8 @@ using osuTK;
using osuTK.Graphics;
using osuTK.Input;
using osu.Game.Graphics.Containers;
+using osu.Framework.Input.Events;
+using System.Linq;
namespace osu.Game.Screens.Select.Options
{
@@ -60,9 +62,8 @@ namespace osu.Game.Screens.Select.Options
/// Text in the second line.
/// Colour of the button.
/// Icon of the button.
- /// Hotkey of the button.
/// Binding the button does.
- public void AddButton(string firstLine, string secondLine, IconUsage icon, Color4 colour, Action action, Key? hotkey = null)
+ public void AddButton(string firstLine, string secondLine, IconUsage icon, Color4 colour, Action action)
{
var button = new BeatmapOptionsButton
{
@@ -75,7 +76,6 @@ namespace osu.Game.Screens.Select.Options
Hide();
action?.Invoke();
},
- HotKey = hotkey
};
buttonsContainer.Add(button);
@@ -107,5 +107,24 @@ namespace osu.Game.Screens.Select.Options
this.FadeOut(transition_duration, Easing.InQuint);
}
+
+ protected override bool OnKeyDown(KeyDownEvent e)
+ {
+ if (!e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9)
+ {
+ int requested = e.Key - Key.Number1;
+
+ // go reverse as buttonsContainer is a ReverseChildIDFillFlowContainer
+ BeatmapOptionsButton found = buttonsContainer.Children.ElementAtOrDefault((buttonsContainer.Children.Count - 1) - requested);
+
+ if (found != null)
+ {
+ found.Click();
+ return true;
+ }
+ }
+
+ return base.OnKeyDown(e);
+ }
}
}
diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs
index 2236aa4d72..19769f487d 100644
--- a/osu.Game/Screens/Select/PlaySongSelect.cs
+++ b/osu.Game/Screens/Select/PlaySongSelect.cs
@@ -36,7 +36,7 @@ namespace osu.Game.Screens.Select
{
ValidForResume = false;
Edit();
- }, Key.Number4);
+ });
((PlayBeatmapDetailArea)BeatmapDetails).Leaderboard.ScoreSelected += PresentScore;
}
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index d313f67446..f5a7c54519 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -275,9 +275,9 @@ namespace osu.Game.Screens.Select
Footer.AddButton(new FooterButtonRandom { Action = triggerRandom });
Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);
- BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null, Key.Number1);
- BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2);
- BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number3);
+ BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null);
+ BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo));
+ BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo));
}
dialogOverlay = dialog;