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 ModDisplay ModDisplay;
private Bindable<bool> showKeyCounter;
private Bindable<bool> showHud;
private static bool hasShownNotificationOnce;
@ -46,6 +45,7 @@ namespace osu.Game.Screens.Play
protected HUDOverlay()
{
RelativeSizeAxes = Axes.Both;
AlwaysPresent = true;
Add(content = new Container
{
@ -67,24 +67,8 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader(true)]
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.ValueChanged += hudVisibility =>
{
if (hudVisibility)
content.FadeIn(duration);
else
content.FadeOut(duration);
};
showHud.ValueChanged += hudVisibility => FadeTo(hudVisibility ? 1 : 0, duration);
showHud.TriggerChange();
if (!showHud && !hasShownNotificationOnce)