diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs index 00b5c38e20..c5ab3974a4 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs @@ -20,14 +20,15 @@ namespace osu.Game.Tests.Visual.Gameplay /// public abstract class TestSceneAllRulesetPlayers : RateAdjustedBeatmapTestScene { - protected Player Player; + protected Player Player { get; private set; } + + protected OsuConfigManager Config { get; private set; } [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { - OsuConfigManager manager; - Dependencies.Cache(manager = new OsuConfigManager(LocalStorage)); - manager.GetBindable(OsuSetting.DimLevel).Value = 1.0; + Dependencies.Cache(Config = new OsuConfigManager(LocalStorage)); + Config.GetBindable(OsuSetting.DimLevel).Value = 1.0; } [Test] diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs index 85aaf20a19..36fc6812bd 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs @@ -2,7 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System; +using NUnit.Framework; using osu.Framework.Graphics.Containers; +using osu.Game.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play; @@ -17,6 +19,14 @@ namespace osu.Game.Tests.Visual.Gameplay return new FailPlayer(); } + [Test] + public void TestOsuWithoutRedTint() + { + AddStep("Disable red tint", () => Config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, false)); + TestOsu(); + AddStep("Enable red tint", () => Config.SetValue(OsuSetting.FadePlayfieldWhenHealthLow, true)); + } + protected override void AddCheckSteps() { AddUntilStep("wait for fail", () => Player.HasFailed); diff --git a/osu.Game/Screens/Play/FailAnimation.cs b/osu.Game/Screens/Play/FailAnimation.cs index 2a1c4599d5..242d997dd7 100644 --- a/osu.Game/Screens/Play/FailAnimation.cs +++ b/osu.Game/Screens/Play/FailAnimation.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Utils; using osu.Game.Audio.Effects; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Rulesets.Objects.Drawables; using osuTK; using osuTK.Graphics; @@ -35,7 +36,7 @@ namespace osu.Game.Screens.Play private Container filters; - private Box failFlash; + private Box redFlashLayer; private Track track; @@ -46,6 +47,9 @@ namespace osu.Game.Screens.Play private Sample failSample; + [Resolved] + private OsuConfigManager config { get; set; } + protected override Container Content { get; } = new Container { Anchor = Anchor.Centre, @@ -77,7 +81,7 @@ namespace osu.Game.Screens.Play }, }, Content, - failFlash = new Box + redFlashLayer = new Box { Colour = Color4.Red, RelativeSizeAxes = Axes.Both, @@ -114,7 +118,8 @@ namespace osu.Game.Screens.Play applyToPlayfield(drawableRuleset.Playfield); drawableRuleset.Playfield.HitObjectContainer.FadeOut(duration / 2); - failFlash.FadeOutFromOne(1000); + if (config.Get(OsuSetting.FadePlayfieldWhenHealthLow)) + redFlashLayer.FadeOutFromOne(1000); Content.Masking = true;