mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Handle global action in toolbar instead of osugame
This commit is contained in:
@ -13,10 +13,12 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class Toolbar : VisibilityContainer
|
||||
public class Toolbar : VisibilityContainer, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public const float HEIGHT = 40;
|
||||
public const float TOOLTIP_HEIGHT = 30;
|
||||
@ -30,7 +32,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
protected readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||
|
||||
// Toolbar components like RulesetSelector should receive keyboard input events even when the toolbar is hidden.
|
||||
// Toolbar and its components need keyboard input even when hidden.
|
||||
public override bool PropagateNonPositionalInputSubTree => true;
|
||||
|
||||
public Toolbar()
|
||||
@ -164,5 +166,21 @@ namespace osu.Game.Overlays.Toolbar
|
||||
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
|
||||
this.FadeOut(transition_time, Easing.InQuint);
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.ToggleToolbar:
|
||||
ToggleVisibility();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnReleased(GlobalAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user