mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Pass DroppedObjectContainer
via constructor instead of DI
It is now just one level deep, so it is not beneficial to use DI here.
This effectively reverts ae09c23e
.
This commit is contained in:
@ -113,36 +113,45 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
|
||||
private void checkHyperDashCatcherColour(ISkin skin, Color4 expectedCatcherColour, Color4? expectedEndGlowColour = null)
|
||||
{
|
||||
CatcherArea catcherArea = null;
|
||||
Container trailsContainer = null;
|
||||
Catcher catcher = null;
|
||||
CatcherTrailDisplay trails = null;
|
||||
|
||||
AddStep("create hyper-dashing catcher", () =>
|
||||
{
|
||||
Child = setupSkinHierarchy(catcherArea = new TestCatcherArea
|
||||
trailsContainer = new Container();
|
||||
Child = setupSkinHierarchy(new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
Children = new Drawable[]
|
||||
{
|
||||
catcher = new Catcher(trailsContainer, new DroppedObjectContainer())
|
||||
{
|
||||
Scale = new Vector2(4)
|
||||
},
|
||||
trailsContainer
|
||||
}
|
||||
}, skin);
|
||||
});
|
||||
|
||||
AddStep("get trails container", () =>
|
||||
{
|
||||
trails = catcherArea.OfType<CatcherTrailDisplay>().Single();
|
||||
catcherArea.MovableCatcher.SetHyperDashState(2);
|
||||
trails = trailsContainer.OfType<CatcherTrailDisplay>().Single();
|
||||
catcher.SetHyperDashState(2);
|
||||
});
|
||||
|
||||
AddUntilStep("catcher colour is correct", () => catcherArea.MovableCatcher.Colour == expectedCatcherColour);
|
||||
AddUntilStep("catcher colour is correct", () => catcher.Colour == expectedCatcherColour);
|
||||
|
||||
AddAssert("catcher trails colours are correct", () => trails.HyperDashTrailsColour == expectedCatcherColour);
|
||||
AddAssert("catcher end-glow colours are correct", () => trails.EndGlowSpritesColour == (expectedEndGlowColour ?? expectedCatcherColour));
|
||||
|
||||
AddStep("finish hyper-dashing", () =>
|
||||
{
|
||||
catcherArea.MovableCatcher.SetHyperDashState();
|
||||
catcherArea.MovableCatcher.FinishTransforms();
|
||||
catcher.SetHyperDashState();
|
||||
catcher.FinishTransforms();
|
||||
});
|
||||
|
||||
AddAssert("catcher colour returned to white", () => catcherArea.MovableCatcher.Colour == Color4.White);
|
||||
AddAssert("catcher colour returned to white", () => catcher.Colour == Color4.White);
|
||||
}
|
||||
|
||||
private void checkHyperDashFruitColour(ISkin skin, Color4 expectedColour)
|
||||
@ -205,21 +214,5 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class TestCatcherArea : CatcherArea
|
||||
{
|
||||
[Cached]
|
||||
private readonly DroppedObjectContainer droppedObjectContainer;
|
||||
|
||||
public TestCatcherArea()
|
||||
{
|
||||
MovableCatcher = new Catcher(this, new BeatmapDifficulty())
|
||||
{
|
||||
X = CatchPlayfield.CENTER_X,
|
||||
Scale = new Vector2(4)
|
||||
};
|
||||
AddInternal(droppedObjectContainer = new DroppedObjectContainer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user