mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Remove unnecessary lists
This commit is contained in:
parent
0d285ac0f4
commit
24216b6600
@ -39,9 +39,8 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
|
||||
private Bindable<WorkingBeatmap> workingBeatmap;
|
||||
|
||||
private readonly List<DrawableTaikoMascot> mascots = new List<DrawableTaikoMascot>();
|
||||
private readonly List<TaikoPlayfield> playfields = new List<TaikoPlayfield>();
|
||||
private readonly List<DrawableTaikoRuleset> rulesets = new List<DrawableTaikoRuleset>();
|
||||
private IEnumerable<TestDrawableTaikoMascot> mascots => this.ChildrenOfType<TestDrawableTaikoMascot>();
|
||||
private IEnumerable<TaikoPlayfield> playfields => this.ChildrenOfType<TaikoPlayfield>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(Bindable<WorkingBeatmap> beatmap)
|
||||
@ -56,14 +55,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
|
||||
AddStep("Create mascot (idle)", () =>
|
||||
{
|
||||
mascots.Clear();
|
||||
|
||||
SetContents(() =>
|
||||
{
|
||||
var mascot = new TestDrawableTaikoMascot();
|
||||
mascots.Add(mascot);
|
||||
return mascot;
|
||||
});
|
||||
SetContents(() => new TestDrawableTaikoMascot());
|
||||
});
|
||||
|
||||
AddStep("Clear state", () => setState(TaikoMascotAnimationState.Clear));
|
||||
@ -80,19 +72,13 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
|
||||
AddStep("Create ruleset", () =>
|
||||
{
|
||||
rulesets.Clear();
|
||||
SetContents(() =>
|
||||
{
|
||||
var ruleset = new TaikoRuleset();
|
||||
var drawableRuleset = new DrawableTaikoRuleset(ruleset, workingBeatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo));
|
||||
rulesets.Add(drawableRuleset);
|
||||
return drawableRuleset;
|
||||
return new DrawableTaikoRuleset(ruleset, workingBeatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo));
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("Collect playfields", collectPlayfields);
|
||||
AddStep("Collect mascots", collectMascots);
|
||||
|
||||
AddStep("Create hit (miss)", () =>
|
||||
{
|
||||
foreach (var playfield in playfields)
|
||||
@ -121,19 +107,13 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
{
|
||||
workingBeatmap.Value.Track.Start();
|
||||
|
||||
rulesets.Clear();
|
||||
SetContents(() =>
|
||||
{
|
||||
var ruleset = new TaikoRuleset();
|
||||
var drawableRuleset = new DrawableTaikoRuleset(ruleset, workingBeatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo));
|
||||
rulesets.Add(drawableRuleset);
|
||||
return drawableRuleset;
|
||||
return new DrawableTaikoRuleset(ruleset, workingBeatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo));
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("Collect playfields", collectPlayfields);
|
||||
AddStep("Collect mascots", collectMascots);
|
||||
|
||||
AddUntilStep("Wait for fail state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Fail));
|
||||
|
||||
AddStep("Create hit (great)", () =>
|
||||
@ -177,26 +157,6 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
mascot?.ShowState(state);
|
||||
}
|
||||
|
||||
private void collectPlayfields()
|
||||
{
|
||||
playfields.Clear();
|
||||
foreach (var ruleset in rulesets)
|
||||
playfields.Add(ruleset.ChildrenOfType<TaikoPlayfield>().Single());
|
||||
}
|
||||
|
||||
private void collectMascots()
|
||||
{
|
||||
mascots.Clear();
|
||||
|
||||
foreach (var playfield in playfields)
|
||||
{
|
||||
var mascot = playfield.ChildrenOfType<DrawableTaikoMascot>()
|
||||
.SingleOrDefault();
|
||||
|
||||
if (mascot != null) mascots.Add(mascot);
|
||||
}
|
||||
}
|
||||
|
||||
private void addJudgement(TaikoPlayfield playfield, HitResult result)
|
||||
{
|
||||
playfield.OnNewResult(new DrawableHit(new Hit()), new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = result });
|
||||
|
Loading…
Reference in New Issue
Block a user