mirror of
https://github.com/ppy/osu
synced 2024-12-15 03:16:17 +00:00
Simplify Hud visibility change
This commit is contained in:
parent
9cb614fee7
commit
eafe215169
@ -30,7 +30,6 @@ namespace osu.Game.Screens.Play
|
|||||||
public readonly SongProgress Progress;
|
public readonly SongProgress Progress;
|
||||||
public readonly ModDisplay ModDisplay;
|
public readonly ModDisplay ModDisplay;
|
||||||
|
|
||||||
private Bindable<bool> showKeyCounter;
|
|
||||||
private Bindable<bool> showHud;
|
private Bindable<bool> showHud;
|
||||||
|
|
||||||
private static bool hasShownNotificationOnce;
|
private static bool hasShownNotificationOnce;
|
||||||
@ -46,6 +45,7 @@ namespace osu.Game.Screens.Play
|
|||||||
protected HUDOverlay()
|
protected HUDOverlay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
AlwaysPresent = true;
|
||||||
|
|
||||||
Add(content = new Container
|
Add(content = new Container
|
||||||
{
|
{
|
||||||
@ -67,24 +67,8 @@ namespace osu.Game.Screens.Play
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuConfigManager config, NotificationManager notificationManager)
|
private void load(OsuConfigManager config, NotificationManager notificationManager)
|
||||||
{
|
{
|
||||||
showKeyCounter = config.GetBindable<bool>(OsuSetting.KeyOverlay);
|
|
||||||
showKeyCounter.ValueChanged += keyCounterVisibility =>
|
|
||||||
{
|
|
||||||
if (keyCounterVisibility)
|
|
||||||
KeyCounter.FadeIn(duration);
|
|
||||||
else
|
|
||||||
KeyCounter.FadeOut(duration);
|
|
||||||
};
|
|
||||||
showKeyCounter.TriggerChange();
|
|
||||||
|
|
||||||
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
|
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
|
||||||
showHud.ValueChanged += hudVisibility =>
|
showHud.ValueChanged += hudVisibility => FadeTo(hudVisibility ? 1 : 0, duration);
|
||||||
{
|
|
||||||
if (hudVisibility)
|
|
||||||
content.FadeIn(duration);
|
|
||||||
else
|
|
||||||
content.FadeOut(duration);
|
|
||||||
};
|
|
||||||
showHud.TriggerChange();
|
showHud.TriggerChange();
|
||||||
|
|
||||||
if (!showHud && !hasShownNotificationOnce)
|
if (!showHud && !hasShownNotificationOnce)
|
||||||
|
Loading…
Reference in New Issue
Block a user