1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 12:07:23 +08:00
osu-lazer/osu.Game/Rulesets/Mods/ModBlockFail.cs

31 lines
961 B
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
2019-07-03 10:11:11 +08:00
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Screens.Play;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig
{
2019-07-03 10:11:11 +08:00
private Bindable<bool> hideHealthBar;
/// <summary>
/// We never fail, 'yo.
/// </summary>
public bool AllowFail => false;
public void ReadFromConfig(OsuConfigManager config)
{
2019-07-06 11:32:25 +08:00
hideHealthBar = config.GetBindable<bool>(OsuSetting.HideHealthBarWhenCantFail);
}
public void ApplyToHUD(HUDOverlay overlay)
{
2019-07-06 23:44:55 +08:00
hideHealthBar.BindValueChanged(v => overlay.HealthDisplay.FadeTo(v.NewValue ? 0 : 1, 250, Easing.OutQuint), true);
}
}
}