1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 04:42:55 +08:00

WIP: make pooling also by strongness

This commit is contained in:
Nikita-str 2024-12-27 00:38:03 +03:00
parent 45c81aacc4
commit c145cff5a0
3 changed files with 14 additions and 9 deletions

View File

@ -42,8 +42,9 @@ namespace osu.Game.Rulesets.Taiko.Objects
SamplesBindable.BindCollectionChanged((_, _) => updateTypeFromSamples()); SamplesBindable.BindCollectionChanged((_, _) => updateTypeFromSamples());
} }
public Hit(HitType type) : this() public Hit(HitType type, bool isStroing) : this()
{ {
IsStrong = isStroing;
Type = type; Type = type;
} }

View File

@ -11,13 +11,15 @@ namespace osu.Game.Rulesets.Taiko.UI
internal partial class HitPool : DrawablePool<DrawableHit> internal partial class HitPool : DrawablePool<DrawableHit>
{ {
private readonly HitType hitType; private readonly HitType hitType;
private readonly bool isStrong;
public HitPool(HitType hitType, int initialSize) public HitPool(int initialSize, HitType hitType, bool isStrong)
: base(initialSize) : base(initialSize)
{ {
this.hitType = hitType; this.hitType = hitType;
this.isStrong = isStrong;
} }
protected override DrawableHit CreateNewDrawable() => new DrawableHit(new Hit(hitType)); protected override DrawableHit CreateNewDrawable() => new DrawableHit(new Hit(hitType, isStrong));
} }
} }

View File

@ -205,18 +205,20 @@ namespace osu.Game.Rulesets.Taiko.UI
AddRangeInternal(poolsHit.Values); AddRangeInternal(poolsHit.Values);
} }
private readonly IDictionary<HitType, HitPool> poolsHit = new Dictionary<HitType, HitPool>() private readonly IDictionary<(HitType, bool), HitPool> poolsHit = new Dictionary<(HitType, bool), HitPool>()
{ {
{HitType.Centre, new HitPool(HitType.Centre, 50)}, // Non strong (pool size is 50 for each type):
{HitType.Rim, new HitPool(HitType.Rim, 50)}, {(HitType.Centre, false), new HitPool(50, HitType.Centre, false)},
{(HitType.Rim, false), new HitPool(50, HitType.Rim, false)},
// Strong (pool size is 20 for each type):
{(HitType.Centre, true), new HitPool(20, HitType.Centre, true)},
{(HitType.Rim, true), new HitPool(20, HitType.Rim, true)},
}; };
protected override IDrawablePool? AdditionalPrepareDrawablePool(HitObject hitObject) protected override IDrawablePool? AdditionalPrepareDrawablePool(HitObject hitObject)
{ {
switch (hitObject) switch (hitObject)
{ {
case Hit hit: return poolsHit[hit.Type]; case Hit hit: return poolsHit[(hit.Type, hit.IsStrong)];
// TODO: ???
//case Hit.StrongNestedHit hitStrong: return ;
default: return null; default: return null;
} }
} }