diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/MatchmakingPoolSelector.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/MatchmakingPoolSelector.cs index 43e6acfaf7..8e4d1e8d2b 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/MatchmakingPoolSelector.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/MatchmakingPoolSelector.cs @@ -1,11 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -13,6 +15,7 @@ using osu.Game.Online.Matchmaking; using osu.Game.Rulesets; using osuTK; using osuTK.Graphics; +using osuTK.Input; namespace osu.Game.Screens.OnlinePlay.Matchmaking { @@ -53,6 +56,35 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking }, true); } + protected override bool OnKeyDown(KeyDownEvent e) + { + if (e.Key != Key.Left && e.Key != Key.Right) + return false; + + if (SelectedPool.Value == null) + { + SelectedPool.Value = AvailablePools.Value[0]; + return true; + } + + int currentPoolIndex = Array.IndexOf(AvailablePools.Value, SelectedPool.Value); + + switch (e.Key) + { + case Key.Left: + SelectedPool.Value = currentPoolIndex == 0 + ? AvailablePools.Value[^1] + : AvailablePools.Value[(currentPoolIndex - 1) % AvailablePools.Value.Length]; + break; + + case Key.Right: + SelectedPool.Value = AvailablePools.Value[(currentPoolIndex + 1) % AvailablePools.Value.Length]; + break; + } + + return true; + } + private partial class SelectorButton : CompositeDrawable { public readonly Bindable SelectedPool = new Bindable();