mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 14:43:22 +08:00
WIP: make pooling also by strongness
This commit is contained in:
parent
45c81aacc4
commit
c145cff5a0
@ -42,8 +42,9 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
SamplesBindable.BindCollectionChanged((_, _) => updateTypeFromSamples());
|
||||
}
|
||||
|
||||
public Hit(HitType type) : this()
|
||||
public Hit(HitType type, bool isStroing) : this()
|
||||
{
|
||||
IsStrong = isStroing;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
|
@ -11,13 +11,15 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
internal partial class HitPool : DrawablePool<DrawableHit>
|
||||
{
|
||||
private readonly HitType hitType;
|
||||
private readonly bool isStrong;
|
||||
|
||||
public HitPool(HitType hitType, int initialSize)
|
||||
public HitPool(int initialSize, HitType hitType, bool isStrong)
|
||||
: base(initialSize)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -205,18 +205,20 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
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)},
|
||||
{HitType.Rim, new HitPool(HitType.Rim, 50)},
|
||||
// Non strong (pool size is 50 for each type):
|
||||
{(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)
|
||||
{
|
||||
switch (hitObject)
|
||||
{
|
||||
case Hit hit: return poolsHit[hit.Type];
|
||||
// TODO: ???
|
||||
//case Hit.StrongNestedHit hitStrong: return ;
|
||||
case Hit hit: return poolsHit[(hit.Type, hit.IsStrong)];
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user