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:
commit
2b4649a3ea
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user