Add a game setting to disable the layer

This commit is contained in:
Lucas A 2020-03-30 12:59:39 +02:00
parent 00c1ff993a
commit 3cae0cedee
3 changed files with 15 additions and 1 deletions

View File

@ -87,6 +87,7 @@ namespace osu.Game.Configuration
Set(OsuSetting.ShowInterface, true); Set(OsuSetting.ShowInterface, true);
Set(OsuSetting.ShowProgressGraph, true); Set(OsuSetting.ShowProgressGraph, true);
Set(OsuSetting.ShowHealthDisplayWhenCantFail, true); Set(OsuSetting.ShowHealthDisplayWhenCantFail, true);
Set(OsuSetting.FadePlayfieldWhenHealthLow, true);
Set(OsuSetting.KeyOverlay, false); Set(OsuSetting.KeyOverlay, false);
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth); Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
@ -181,6 +182,7 @@ namespace osu.Game.Configuration
ShowInterface, ShowInterface,
ShowProgressGraph, ShowProgressGraph,
ShowHealthDisplayWhenCantFail, ShowHealthDisplayWhenCantFail,
FadePlayfieldWhenHealthLow,
MouseDisableButtons, MouseDisableButtons,
MouseDisableWheel, MouseDisableWheel,
AudioOffset, AudioOffset,

View File

@ -53,6 +53,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
Keywords = new[] { "hp", "bar" } Keywords = new[] { "hp", "bar" }
}, },
new SettingsCheckbox new SettingsCheckbox
{
LabelText = "Fade playfield to red when health is low",
Bindable = config.GetBindable<bool>(OsuSetting.FadePlayfieldWhenHealthLow),
Keywords = new[] { "hp", "low", "playfield", "red" }
},
new SettingsCheckbox
{ {
LabelText = "Always show key overlay", LabelText = "Always show key overlay",
Bindable = config.GetBindable<bool>(OsuSetting.KeyOverlay) Bindable = config.GetBindable<bool>(OsuSetting.KeyOverlay)

View File

@ -3,9 +3,11 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
@ -21,6 +23,8 @@ namespace osu.Game.Screens.Play.HUD
private readonly Box box; private readonly Box box;
private Bindable<bool> enabled;
/// <summary> /// <summary>
/// The threshold under which the current player life should be considered low and the layer should start fading in. /// The threshold under which the current player life should be considered low and the layer should start fading in.
/// </summary> /// </summary>
@ -37,9 +41,11 @@ namespace osu.Game.Screens.Play.HUD
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour color) private void load(OsuColour color, OsuConfigManager config)
{ {
box.Colour = color.Red; box.Colour = color.Red;
enabled = config.GetBindable<bool>(OsuSetting.FadePlayfieldWhenHealthLow);
enabled.BindValueChanged(e => this.FadeTo(e.NewValue ? 1 : 0, fade_time, Easing.OutQuint), true);
} }
protected override void Update() protected override void Update()