mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Add key binding to show HUD while held
This commit is contained in:
parent
05fecc340b
commit
8928aa6d92
@ -67,6 +67,7 @@ namespace osu.Game.Input.Bindings
|
|||||||
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
||||||
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
||||||
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
|
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
|
||||||
|
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
|
||||||
};
|
};
|
||||||
|
|
||||||
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
|
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
|
||||||
@ -187,5 +188,8 @@ namespace osu.Game.Input.Bindings
|
|||||||
|
|
||||||
[Description("Timing Mode")]
|
[Description("Timing Mode")]
|
||||||
EditorTimingMode,
|
EditorTimingMode,
|
||||||
|
|
||||||
|
[Description("Hold for HUD")]
|
||||||
|
HoldForHUD,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,10 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -22,7 +24,7 @@ using osuTK.Input;
|
|||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
public class HUDOverlay : Container
|
public class HUDOverlay : Container, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
public const float FADE_DURATION = 400;
|
public const float FADE_DURATION = 400;
|
||||||
|
|
||||||
@ -67,6 +69,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
internal readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
|
internal readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
|
||||||
|
|
||||||
|
private bool holdingForHUD;
|
||||||
|
|
||||||
private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter };
|
private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter };
|
||||||
|
|
||||||
public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||||
@ -217,6 +221,12 @@ namespace osu.Game.Screens.Play
|
|||||||
if (ShowHud.Disabled)
|
if (ShowHud.Disabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (holdingForHUD)
|
||||||
|
{
|
||||||
|
ShowHud.Value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (configVisibilityMode.Value)
|
switch (configVisibilityMode.Value)
|
||||||
{
|
{
|
||||||
case HUDVisibilityMode.Never:
|
case HUDVisibilityMode.Never:
|
||||||
@ -351,5 +361,29 @@ namespace osu.Game.Screens.Play
|
|||||||
HealthDisplay?.BindHealthProcessor(processor);
|
HealthDisplay?.BindHealthProcessor(processor);
|
||||||
FailingLayer?.BindHealthProcessor(processor);
|
FailingLayer?.BindHealthProcessor(processor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(GlobalAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case GlobalAction.HoldForHUD:
|
||||||
|
holdingForHUD = true;
|
||||||
|
updateVisibility();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case GlobalAction.HoldForHUD:
|
||||||
|
holdingForHUD = false;
|
||||||
|
updateVisibility();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user