Move hitobject pooling to Playfield

This commit is contained in:
smoogipoo
2020-11-14 00:41:18 +09:00
parent f093acc9d5
commit 36f1833f6e
6 changed files with 130 additions and 80 deletions

View File

@ -134,19 +134,13 @@ namespace osu.Game.Tests.Visual.Gameplay
{
}
[BackgroundDependencyLoader]
private void load()
{
RegisterPool<TestHitObject, DrawableTestHitObject>(PoolSize);
}
protected override HitObjectLifetimeEntry CreateLifetimeEntry(TestHitObject hitObject) => new TestHitObjectLifetimeEntry(hitObject);
public override DrawableHitObject<TestHitObject> CreateDrawableRepresentation(TestHitObject h) => null;
protected override PassThroughInputManager CreateInputManager() => new PassThroughInputManager();
protected override Playfield CreatePlayfield() => new TestPlayfield();
protected override Playfield CreatePlayfield() => new TestPlayfield(PoolSize);
private class TestHitObjectLifetimeEntry : HitObjectLifetimeEntry
{
@ -161,11 +155,20 @@ namespace osu.Game.Tests.Visual.Gameplay
private class TestPlayfield : Playfield
{
public TestPlayfield()
private readonly int poolSize;
public TestPlayfield(int poolSize)
{
this.poolSize = poolSize;
AddInternal(HitObjectContainer);
}
[BackgroundDependencyLoader]
private void load()
{
RegisterPool<TestHitObject, DrawableTestHitObject>(poolSize);
}
protected override GameplayCursorContainer CreateCursor() => null;
}