mirror of
https://github.com/ppy/osu
synced 2025-03-19 17:44:30 +00:00
Add keyboard shortcuts to actuate mod select buttons (#4841)
Add keyboard shortcuts to actuate mod select buttons Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
046df743be
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -23,6 +24,7 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays.Mods.Sections;
|
using osu.Game.Overlays.Mods.Sections;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
@ -33,6 +35,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
protected Color4 LowMultiplierColour, HighMultiplierColour;
|
protected Color4 LowMultiplierColour, HighMultiplierColour;
|
||||||
|
|
||||||
protected readonly TriangleButton DeselectAllButton;
|
protected readonly TriangleButton DeselectAllButton;
|
||||||
|
protected readonly TriangleButton CloseButton;
|
||||||
protected readonly OsuSpriteText MultiplierLabel, UnrankedLabel;
|
protected readonly OsuSpriteText MultiplierLabel, UnrankedLabel;
|
||||||
private readonly FillFlowContainer footerContainer;
|
private readonly FillFlowContainer footerContainer;
|
||||||
|
|
||||||
@ -192,6 +195,22 @@ namespace osu.Game.Overlays.Mods
|
|||||||
refreshSelectedMods();
|
refreshSelectedMods();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
switch (e.Key)
|
||||||
|
{
|
||||||
|
case Key.Number1:
|
||||||
|
DeselectAllButton.Click();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case Key.Number2:
|
||||||
|
CloseButton.Click();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
||||||
|
|
||||||
public ModSelectOverlay()
|
public ModSelectOverlay()
|
||||||
@ -364,6 +383,16 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Right = 20
|
Right = 20
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
CloseButton = new TriangleButton
|
||||||
|
{
|
||||||
|
Width = 180,
|
||||||
|
Text = "Close",
|
||||||
|
Action = Hide,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Right = 20
|
||||||
|
}
|
||||||
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"Score Multiplier:",
|
Text = @"Score Multiplier:",
|
||||||
|
Loading…
Reference in New Issue
Block a user