mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 09:03:01 +08:00
Merge pull request #9556 from gagahpangeran/toggle-hit-lighting-catch
This commit is contained in:
commit
02678c04d5
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Catch.Beatmaps;
|
using osu.Game.Rulesets.Catch.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Judgements;
|
using osu.Game.Rulesets.Catch.Judgements;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
@ -25,6 +26,11 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
{
|
{
|
||||||
private RulesetInfo catchRuleset;
|
private RulesetInfo catchRuleset;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuConfigManager config { get; set; }
|
||||||
|
|
||||||
|
private Catcher catcher => this.ChildrenOfType<CatcherArea>().First().MovableCatcher;
|
||||||
|
|
||||||
public TestSceneCatcherArea()
|
public TestSceneCatcherArea()
|
||||||
{
|
{
|
||||||
AddSliderStep<float>("CircleSize", 0, 8, 5, createCatcher);
|
AddSliderStep<float>("CircleSize", 0, 8, 5, createCatcher);
|
||||||
@ -34,24 +40,43 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
|
|
||||||
AddRepeatStep("catch fruit", () => catchFruit(new TestFruit(false)
|
AddRepeatStep("catch fruit", () => catchFruit(new TestFruit(false)
|
||||||
{
|
{
|
||||||
X = this.ChildrenOfType<CatcherArea>().First().MovableCatcher.X
|
X = catcher.X
|
||||||
}), 20);
|
}), 20);
|
||||||
AddRepeatStep("catch fruit last in combo", () => catchFruit(new TestFruit(false)
|
AddRepeatStep("catch fruit last in combo", () => catchFruit(new TestFruit(false)
|
||||||
{
|
{
|
||||||
X = this.ChildrenOfType<CatcherArea>().First().MovableCatcher.X,
|
X = catcher.X,
|
||||||
LastInCombo = true,
|
LastInCombo = true,
|
||||||
}), 20);
|
}), 20);
|
||||||
AddRepeatStep("catch kiai fruit", () => catchFruit(new TestFruit(true)
|
AddRepeatStep("catch kiai fruit", () => catchFruit(new TestFruit(true)
|
||||||
{
|
{
|
||||||
X = this.ChildrenOfType<CatcherArea>().First().MovableCatcher.X,
|
X = catcher.X
|
||||||
}), 20);
|
}), 20);
|
||||||
AddRepeatStep("miss fruit", () => catchFruit(new Fruit
|
AddRepeatStep("miss fruit", () => catchFruit(new Fruit
|
||||||
{
|
{
|
||||||
X = this.ChildrenOfType<CatcherArea>().First().MovableCatcher.X + 100,
|
X = catcher.X + 100,
|
||||||
LastInCombo = true,
|
LastInCombo = true,
|
||||||
}, true), 20);
|
}, 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<HitExplosion>().Any() == enable);
|
||||||
|
}
|
||||||
|
|
||||||
private void catchFruit(Fruit fruit, bool miss = false)
|
private void catchFruit(Fruit fruit, bool miss = false)
|
||||||
{
|
{
|
||||||
this.ChildrenOfType<CatcherArea>().ForEach(area =>
|
this.ChildrenOfType<CatcherArea>().ForEach(area =>
|
||||||
|
@ -5,12 +5,14 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Catch.Skinning;
|
using osu.Game.Rulesets.Catch.Skinning;
|
||||||
@ -103,6 +105,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
private double hyperDashModifier = 1;
|
private double hyperDashModifier = 1;
|
||||||
private int hyperDashDirection;
|
private int hyperDashDirection;
|
||||||
private float hyperDashTargetPosition;
|
private float hyperDashTargetPosition;
|
||||||
|
private Bindable<bool> hitLighting;
|
||||||
|
|
||||||
public Catcher([NotNull] Container trailsTarget, BeatmapDifficulty difficulty = null)
|
public Catcher([NotNull] Container trailsTarget, BeatmapDifficulty difficulty = null)
|
||||||
{
|
{
|
||||||
@ -118,8 +121,10 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
|
hitLighting = config.GetBindable<bool>(OsuSetting.HitLighting);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
caughtFruitContainer,
|
caughtFruitContainer,
|
||||||
@ -194,11 +199,14 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
caughtFruitContainer.Add(fruit);
|
caughtFruitContainer.Add(fruit);
|
||||||
|
|
||||||
AddInternal(new HitExplosion(fruit)
|
if (hitLighting.Value)
|
||||||
{
|
{
|
||||||
X = fruit.X,
|
AddInternal(new HitExplosion(fruit)
|
||||||
Scale = new Vector2(fruit.HitObject.Scale)
|
{
|
||||||
});
|
X = fruit.X,
|
||||||
|
Scale = new Vector2(fruit.HitObject.Scale)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user