1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-19 12:03:21 +08:00

Move health display out of the visibility container

This commit is contained in:
Salman Ahmed 2019-07-02 02:19:59 +03:00 committed by KingLuigi4932
parent a8e8650ddd
commit 6a79349f4a

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -40,6 +41,7 @@ namespace osu.Game.Screens.Play
private readonly IReadOnlyList<Mod> mods; private readonly IReadOnlyList<Mod> mods;
private Bindable<bool> showHud; private Bindable<bool> showHud;
private Bindable<bool> hideHealthbar;
private readonly Container visibilityContainer; private readonly Container visibilityContainer;
private readonly BindableBool replayLoaded = new BindableBool(); private readonly BindableBool replayLoaded = new BindableBool();
@ -77,11 +79,11 @@ namespace osu.Game.Screens.Play
ComboCounter = CreateComboCounter(), ComboCounter = CreateComboCounter(),
}, },
}, },
HealthDisplay = CreateHealthDisplay(),
Progress = CreateProgress(), Progress = CreateProgress(),
ModDisplay = CreateModsContainer(), ModDisplay = CreateModsContainer(),
} }
}, },
HealthDisplay = CreateHealthDisplay(),
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
new FillFlowContainer new FillFlowContainer
{ {
@ -112,8 +114,14 @@ namespace osu.Game.Screens.Play
ModDisplay.Current.Value = mods; ModDisplay.Current.Value = mods;
hideHealthbar = config.GetBindable<bool>(OsuSetting.HideHealthBar);
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface); showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
showHud.ValueChanged += visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration); showHud.ValueChanged += visible =>
{
visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration);
if (!(hideHealthbar.Value && mods.OfType<ModBlockFail>().Any()))
HealthDisplay.FadeTo(visible.NewValue ? 1 : 0, duration);
};
showHud.TriggerChange(); showHud.TriggerChange();
if (!showHud.Value && !hasShownNotificationOnce) if (!showHud.Value && !hasShownNotificationOnce)