mirror of https://github.com/ppy/osu
Adjust pooling implementation with branch changes
This commit is contained in:
parent
bf72961959
commit
1ea526b5ef
|
@ -12,6 +12,7 @@
|
|||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Configuration;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
|
@ -33,17 +34,21 @@ public DrawableOsuRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>
|
|||
{
|
||||
}
|
||||
|
||||
protected override bool PoolHitObjects => true;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
RegisterPool<HitCircle, DrawableHitCircle>(10, 100);
|
||||
RegisterPool<Slider, DrawableSlider>(10, 100);
|
||||
RegisterPool<Spinner, DrawableSpinner>(2, 20);
|
||||
registerPool<HitCircle, DrawableHitCircle>(10, 100);
|
||||
registerPool<Slider, DrawableSlider>(10, 100);
|
||||
registerPool<Spinner, DrawableSpinner>(2, 20);
|
||||
}
|
||||
|
||||
protected override DrawablePool<TDrawable> CreatePool<TDrawable>(int initialSize, int? maximumSize = null)
|
||||
private void registerPool<TObject, TDrawable>(int initialSize, int? maximumSize = null)
|
||||
where TObject : HitObject
|
||||
where TDrawable : DrawableHitObject, new()
|
||||
=> RegisterPool<TObject, TDrawable>(CreatePool<TDrawable>(initialSize, maximumSize));
|
||||
|
||||
protected virtual DrawablePool<TDrawable> CreatePool<TDrawable>(int initialSize, int? maximumSize = null)
|
||||
where TDrawable : DrawableHitObject, new()
|
||||
=> new OsuDrawablePool<TDrawable>(Playfield.CheckHittable, Playfield.OnHitObjectLoaded, initialSize, maximumSize);
|
||||
|
||||
protected override HitObjectLifetimeEntry CreateLifetimeEntry(OsuHitObject hitObject) => new OsuHitObjectLifetimeEntry(hitObject);
|
||||
|
|
Loading…
Reference in New Issue