mirror of
https://github.com/ppy/osu
synced 2025-01-23 06:13:12 +00:00
Make GlobalAction.Back
close all opened dropdown menus
This commit is contained in:
parent
14f14b4311
commit
3847a586f1
@ -12,9 +12,12 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -31,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
#region OsuDropdownMenu
|
#region OsuDropdownMenu
|
||||||
|
|
||||||
protected class OsuDropdownMenu : DropdownMenu
|
protected class OsuDropdownMenu : DropdownMenu, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
public override bool HandleNonPositionalInput => State == MenuState.Open;
|
public override bool HandleNonPositionalInput => State == MenuState.Open;
|
||||||
|
|
||||||
@ -275,6 +278,23 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
|
{
|
||||||
|
if (e.Repeat) return false;
|
||||||
|
|
||||||
|
if (e.Action == GlobalAction.Back)
|
||||||
|
{
|
||||||
|
State = MenuState.Closed;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user