mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:47:29 +08:00
Merge pull request #7648 from peppy/keyboard-composition-tools
Allow selecting composition tools using 1-4 keys
This commit is contained in:
commit
77b1bf3ee2
@ -9,6 +9,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Timing;
|
||||
@ -25,6 +26,7 @@ using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||
using osu.Game.Screens.Edit.Compose;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osuTK;
|
||||
using Key = osuTK.Input.Key;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
@ -148,6 +150,22 @@ namespace osu.Game.Rulesets.Edit
|
||||
blueprintContainer.SelectionChanged += selectionChanged;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.Key >= Key.Number1 && e.Key <= Key.Number9)
|
||||
{
|
||||
var item = toolboxCollection.Items.Skip(e.Key - Key.Number1).FirstOrDefault();
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
item.Select();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
Loading…
Reference in New Issue
Block a user