diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs
index 57bb4253cb..d1b21ca1b0 100644
--- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs
+++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylist.cs
@@ -6,7 +6,10 @@ using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Input.Bindings;
+using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers;
+using osu.Game.Input.Bindings;
using osu.Game.Online.Rooms;
using osuTK;
@@ -15,7 +18,7 @@ namespace osu.Game.Screens.OnlinePlay
///
/// A scrollable list which displays the s in a .
///
- public class DrawableRoomPlaylist : OsuRearrangeableListContainer
+ public class DrawableRoomPlaylist : OsuRearrangeableListContainer, IKeyBindingHandler
{
///
/// The currently-selected item. Selection is visually represented with a border.
@@ -169,5 +172,53 @@ namespace osu.Game.Screens.OnlinePlay
});
protected virtual DrawableRoomPlaylistItem CreateDrawablePlaylistItem(PlaylistItem item) => new DrawableRoomPlaylistItem(item);
+
+ #region Key selection logic (shared with BeatmapCarousel and RoomsContainer)
+
+ public bool OnPressed(KeyBindingPressEvent e)
+ {
+ switch (e.Action)
+ {
+ case GlobalAction.SelectNext:
+ selectNext(1);
+ return true;
+
+ case GlobalAction.SelectPrevious:
+ selectNext(-1);
+ return true;
+ }
+
+ return false;
+ }
+
+ public void OnReleased(KeyBindingReleaseEvent e)
+ {
+ }
+
+ private void selectNext(int direction)
+ {
+ if (SelectedItem.Disabled)
+ return;
+
+ var visibleRooms = ListContainer.AsEnumerable().Where(r => r.IsPresent);
+
+ PlaylistItem item;
+
+ if (SelectedItem.Value == null)
+ item = visibleRooms.FirstOrDefault()?.Model;
+ else
+ {
+ if (direction < 0)
+ visibleRooms = visibleRooms.Reverse();
+
+ item = visibleRooms.SkipWhile(r => r.Model != SelectedItem.Value).Skip(1).FirstOrDefault()?.Model;
+ }
+
+ // we already have a valid selection only change selection if we still have a room to switch to.
+ if (item != null)
+ SelectedItem.Value = item;
+ }
+
+ #endregion
}
}
diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs
index 175cd2c44e..9bcda90e6d 100644
--- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs
+++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomsContainer.cs
@@ -139,7 +139,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
return base.OnClick(e);
}
- #region Key selection logic (shared with BeatmapCarousel)
+ #region Key selection logic (shared with BeatmapCarousel and RoomsContainer)
public bool OnPressed(KeyBindingPressEvent e)
{