diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs index fbb22a8498..b4f123598b 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs @@ -9,6 +9,7 @@ using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Configuration; using osu.Game.Rulesets.Catch.Beatmaps; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects; @@ -25,6 +26,11 @@ public class TestSceneCatcherArea : CatchSkinnableTestScene { private RulesetInfo catchRuleset; + [Resolved] + private OsuConfigManager config { get; set; } + + private Catcher catcher => this.ChildrenOfType().First().MovableCatcher; + public TestSceneCatcherArea() { AddSliderStep("CircleSize", 0, 8, 5, createCatcher); @@ -34,24 +40,43 @@ public TestSceneCatcherArea() AddRepeatStep("catch fruit", () => catchFruit(new TestFruit(false) { - X = this.ChildrenOfType().First().MovableCatcher.X + X = catcher.X }), 20); AddRepeatStep("catch fruit last in combo", () => catchFruit(new TestFruit(false) { - X = this.ChildrenOfType().First().MovableCatcher.X, + X = catcher.X, LastInCombo = true, }), 20); AddRepeatStep("catch kiai fruit", () => catchFruit(new TestFruit(true) { - X = this.ChildrenOfType().First().MovableCatcher.X, + X = catcher.X }), 20); AddRepeatStep("miss fruit", () => catchFruit(new Fruit { - X = this.ChildrenOfType().First().MovableCatcher.X + 100, + X = catcher.X + 100, LastInCombo = true, }, true), 20); } + [TestCase(true)] + [TestCase(false)] + public void TestHitLighting(bool enable) + { + AddStep("create catcher", () => createCatcher(5)); + + AddStep("toggle hit lighting", () => config.Set(OsuSetting.HitLighting, enable)); + AddStep("catch fruit", () => catchFruit(new TestFruit(false) + { + X = catcher.X + })); + AddStep("catch fruit last in combo", () => catchFruit(new TestFruit(false) + { + X = catcher.X, + LastInCombo = true + })); + AddAssert("check hit explosion", () => catcher.ChildrenOfType().Any() == enable); + } + private void catchFruit(Fruit fruit, bool miss = false) { this.ChildrenOfType().ForEach(area => diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index b41fd24a9c..8820dff730 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -5,12 +5,14 @@ using System.Linq; using JetBrains.Annotations; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; using osu.Framework.Utils; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Catch.Skinning; @@ -103,6 +105,7 @@ protected set private double hyperDashModifier = 1; private int hyperDashDirection; private float hyperDashTargetPosition; + private Bindable hitLighting; public Catcher([NotNull] Container trailsTarget, BeatmapDifficulty difficulty = null) { @@ -118,8 +121,10 @@ public Catcher([NotNull] Container trailsTarget, BeatmapDifficulty difficulty = } [BackgroundDependencyLoader] - private void load() + private void load(OsuConfigManager config) { + hitLighting = config.GetBindable(OsuSetting.HitLighting); + InternalChildren = new Drawable[] { caughtFruitContainer, @@ -194,11 +199,14 @@ public void PlaceOnPlate(DrawableCatchHitObject fruit) caughtFruitContainer.Add(fruit); - AddInternal(new HitExplosion(fruit) + if (hitLighting.Value) { - X = fruit.X, - Scale = new Vector2(fruit.HitObject.Scale) - }); + AddInternal(new HitExplosion(fruit) + { + X = fruit.X, + Scale = new Vector2(fruit.HitObject.Scale) + }); + } } ///