Remove now-redundant code

This commit is contained in:
ekrctb 2023-01-19 19:52:37 +09:00
parent 812a4b412a
commit 32acaa44be

View File

@ -60,17 +60,15 @@ namespace osu.Game.Rulesets.Catch.Tests
[Test] [Test]
public void TestCatcherHyperStateReverted() public void TestCatcherHyperStateReverted()
{ {
DrawableCatchHitObject drawableObject1 = null;
DrawableCatchHitObject drawableObject2 = null;
JudgementResult result1 = null; JudgementResult result1 = null;
JudgementResult result2 = null; JudgementResult result2 = null;
AddStep("catch hyper fruit", () => AddStep("catch hyper fruit", () =>
{ {
attemptCatch(new Fruit { HyperDashTarget = new Fruit { X = 100 } }, out drawableObject1, out result1); result1 = attemptCatch(new Fruit { HyperDashTarget = new Fruit { X = 100 } });
}); });
AddStep("catch normal fruit", () => AddStep("catch normal fruit", () =>
{ {
attemptCatch(new Fruit(), out drawableObject2, out result2); result2 = attemptCatch(new Fruit());
}); });
AddStep("revert second result", () => AddStep("revert second result", () =>
{ {
@ -87,11 +85,10 @@ namespace osu.Game.Rulesets.Catch.Tests
[Test] [Test]
public void TestCatcherAnimationStateReverted() public void TestCatcherAnimationStateReverted()
{ {
DrawableCatchHitObject drawableObject = null;
JudgementResult result = null; JudgementResult result = null;
AddStep("catch kiai fruit", () => AddStep("catch kiai fruit", () =>
{ {
attemptCatch(new TestKiaiFruit(), out drawableObject, out result); result = attemptCatch(new TestKiaiFruit());
}); });
checkState(CatcherAnimationState.Kiai); checkState(CatcherAnimationState.Kiai);
AddStep("revert result", () => AddStep("revert result", () =>
@ -268,23 +265,19 @@ namespace osu.Game.Rulesets.Catch.Tests
private void checkHyperDash(bool state) => AddAssert($"catcher is {(state ? "" : "not ")}hyper dashing", () => catcher.HyperDashing == state); private void checkHyperDash(bool state) => AddAssert($"catcher is {(state ? "" : "not ")}hyper dashing", () => catcher.HyperDashing == state);
private void attemptCatch(CatchHitObject hitObject)
{
attemptCatch(() => hitObject, 1);
}
private void attemptCatch(Func<CatchHitObject> hitObject, int count) private void attemptCatch(Func<CatchHitObject> hitObject, int count)
{ {
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
attemptCatch(hitObject(), out _, out _); attemptCatch(hitObject());
} }
private void attemptCatch(CatchHitObject hitObject, out DrawableCatchHitObject drawableObject, out JudgementResult result) private JudgementResult attemptCatch(CatchHitObject hitObject)
{ {
hitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); hitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
drawableObject = createDrawableObject(hitObject); var drawableObject = createDrawableObject(hitObject);
result = createResult(hitObject); var result = createResult(hitObject);
applyResult(drawableObject, result); applyResult(drawableObject, result);
return result;
} }
private void applyResult(DrawableCatchHitObject drawableObject, JudgementResult result) private void applyResult(DrawableCatchHitObject drawableObject, JudgementResult result)