Simplify Hud visibility change

This commit is contained in:
EVAST9919 2017-05-23 11:53:12 +03:00
parent 9cb614fee7
commit eafe215169

View File

@ -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)