1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 21:07:33 +08:00

Merge pull request #13425 from Joehuu/score-panel-kb-navigation

This commit is contained in:
Dean Herbert 2021-06-10 11:38:17 +09:00 committed by GitHub
commit 2b4649a3ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,9 +8,11 @@ using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers;
using osu.Game.Scoring;
using osuTK;
using osuTK.Input;
namespace osu.Game.Screens.Ranking
{
@ -263,6 +265,26 @@ namespace osu.Game.Screens.Ranking
container.Attach();
}
protected override bool OnKeyDown(KeyDownEvent e)
{
var expandedPanelIndex = flow.GetPanelIndex(expandedPanel.Score);
switch (e.Key)
{
case Key.Left:
if (expandedPanelIndex > 0)
SelectedScore.Value = flow.Children[expandedPanelIndex - 1].Panel.Score;
return true;
case Key.Right:
if (expandedPanelIndex < flow.Count - 1)
SelectedScore.Value = flow.Children[expandedPanelIndex + 1].Panel.Score;
return true;
}
return base.OnKeyDown(e);
}
private class Flow : FillFlowContainer<ScorePanelTrackingContainer>
{
public override IEnumerable<Drawable> FlowingChildren => applySorting(AliveInternalChildren);