mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 00:02:56 +08:00
Handle global action in toolbar instead of osugame
This commit is contained in:
parent
d0644221ff
commit
6c0734a09f
@ -885,10 +885,6 @@ namespace osu.Game
|
|||||||
frameworkConfig.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).SetDefault();
|
frameworkConfig.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).SetDefault();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GlobalAction.ToggleToolbar:
|
|
||||||
Toolbar.ToggleVisibility();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case GlobalAction.ToggleGameplayMouseButtons:
|
case GlobalAction.ToggleGameplayMouseButtons:
|
||||||
LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get<bool>(OsuSetting.MouseDisableButtons));
|
LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get<bool>(OsuSetting.MouseDisableButtons));
|
||||||
return true;
|
return true;
|
||||||
|
@ -13,10 +13,12 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
public class Toolbar : VisibilityContainer
|
public class Toolbar : VisibilityContainer, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
public const float HEIGHT = 40;
|
public const float HEIGHT = 40;
|
||||||
public const float TOOLTIP_HEIGHT = 30;
|
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);
|
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 override bool PropagateNonPositionalInputSubTree => true;
|
||||||
|
|
||||||
public Toolbar()
|
public Toolbar()
|
||||||
@ -164,5 +166,21 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
|
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
|
||||||
this.FadeOut(transition_time, Easing.InQuint);
|
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)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user