1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:17:51 +08:00

Slight refactoring

This commit is contained in:
Craftplacer 2020-04-28 22:24:19 +02:00
parent 6de6f068fd
commit 902326e7ac
2 changed files with 24 additions and 26 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="true" />
</component>
<component name="ProjectNotificationSettings">
<option name="askShowProject" value="false" />
</component>
</project>

View File

@ -93,21 +93,11 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
AddStep("Collect playfields", collectPlayfields); AddStep("Collect playfields", collectPlayfields);
AddStep("Collect mascots", collectMascots); AddStep("Collect mascots", collectMascots);
AddStep("Create hit (miss)", () => AddStep("Create hit (great)", () => addJudgement(HitResult.Miss));
{ AddUntilStep("Wait for idle state", () => checkForState(TaikoMascotAnimationState.Fail));
foreach (var playfield in playfields)
addJudgement(playfield, HitResult.Miss);
});
AddUntilStep("Wait for fail state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Fail)); AddStep("Create hit (great)", () => addJudgement(HitResult.Great));
AddUntilStep("Wait for idle state", () => checkForState(TaikoMascotAnimationState.Idle));
AddStep("Create hit (great)", () =>
{
foreach (var playfield in playfields)
addJudgement(playfield, HitResult.Great);
});
AddUntilStep("Wait for idle state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Idle));
} }
[Test] [Test]
@ -134,15 +124,10 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
AddStep("Collect playfields", collectPlayfields); AddStep("Collect playfields", collectPlayfields);
AddStep("Collect mascots", collectMascots); AddStep("Collect mascots", collectMascots);
AddUntilStep("Wait for fail state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Fail)); AddUntilStep("Wait for idle state", () => checkForState(TaikoMascotAnimationState.Fail));
AddStep("Create hit (great)", () => AddStep("Create hit (great)", () => addJudgement(HitResult.Great));
{ AddUntilStep("Wait for idle state", () => checkForState(TaikoMascotAnimationState.Kiai));
foreach (var playfield in playfields)
addJudgement(playfield, HitResult.Great);
});
AddUntilStep("Wait for kiai state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Kiai));
} }
private void setBeatmap(bool kiai = false) private void setBeatmap(bool kiai = false)
@ -190,18 +175,22 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
foreach (var playfield in playfields) foreach (var playfield in playfields)
{ {
var mascot = playfield.ChildrenOfType<DrawableTaikoMascot>() var mascot = playfield.ChildrenOfType<TestDrawableTaikoMascot>()
.SingleOrDefault(); .SingleOrDefault();
if (mascot != null) mascots.Add(mascot); if (mascot != null)
mascots.Add(mascot);
} }
} }
private void addJudgement(TaikoPlayfield playfield, HitResult result) private void addJudgement(HitResult result)
{ {
foreach (var playfield in playfields)
playfield.OnNewResult(new DrawableHit(new Hit()), new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = result }); playfield.OnNewResult(new DrawableHit(new Hit()), new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = result });
} }
private bool checkForState(TaikoMascotAnimationState state) => mascots.All(d => d.State == state);
private class TestDrawableTaikoMascot : DrawableTaikoMascot private class TestDrawableTaikoMascot : DrawableTaikoMascot
{ {
public TestDrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascotAnimationState.Idle) public TestDrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascotAnimationState.Idle)