diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index 2c59639ce7..144e4cabba 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -1,19 +1,21 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using osu.Framework.Caching; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transformations; -using osu.Game.Database; -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Lists; -using osu.Game.Beatmaps.Drawables; +using OpenTK; +using osu.Framework.Caching; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transformations; +using osu.Game.Database; +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Lists; +using osu.Game.Beatmaps.Drawables; using osu.Framework.Timing; +using osu.Framework.Input; +using OpenTK.Input; namespace osu.Game.Screens.Select { @@ -244,5 +246,47 @@ protected override void Update() updatePanel(p, halfHeight); } } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + int direction = 0; + bool skipDifficulties = false; + + switch (args.Key) + { + case Key.Up: + direction = -1; + break; + case Key.Down: + direction = 1; + break; + case Key.Left: + direction = -1; + skipDifficulties = true; + break; + case Key.Right: + direction = 1; + skipDifficulties = true; + break; + } + + if (direction != 0) + { + int index = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction; + + if (!skipDifficulties && index >= 0 && index < SelectedGroup.BeatmapPanels.Count) + //changing difficulty panel, not set. + SelectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[index]); + else + { + index = (groups.IndexOf(SelectedGroup) + direction + groups.Count) % groups.Count; + SelectBeatmap(groups[index].BeatmapPanels.First().Beatmap); + } + + return true; + } + + return base.OnKeyDown(state, args); + } } }