mirror of https://github.com/ppy/osu
Refactor implementation to support hitobjects nested multiple levels deep
This commit is contained in:
parent
a754dc6d3b
commit
26860a903e
|
@ -236,8 +236,10 @@ private void setComputedLifetimeStart(HitObjectLifetimeEntry entry)
|
|||
entry.LifetimeStart = Math.Min(entry.HitObject.StartTime - judgementOffset, computedStartTime);
|
||||
}
|
||||
|
||||
private void updateLayoutRecursive(DrawableHitObject hitObject)
|
||||
private void updateLayoutRecursive(DrawableHitObject hitObject, double? parentHitObjectStartTime = null)
|
||||
{
|
||||
parentHitObjectStartTime ??= hitObject.HitObject.StartTime;
|
||||
|
||||
if (hitObject.HitObject is IHasDuration e)
|
||||
{
|
||||
float length = LengthAtTime(hitObject.HitObject.StartTime, e.EndTime);
|
||||
|
@ -249,10 +251,10 @@ private void updateLayoutRecursive(DrawableHitObject hitObject)
|
|||
|
||||
foreach (var obj in hitObject.NestedHitObjects)
|
||||
{
|
||||
updateLayoutRecursive(obj);
|
||||
updateLayoutRecursive(obj, parentHitObjectStartTime);
|
||||
|
||||
// Nested hitobjects don't need to scroll, but they do need accurate positions and start lifetime
|
||||
updatePosition(obj, hitObject.HitObject.StartTime, hitObject.HitObject.StartTime);
|
||||
updatePosition(obj, hitObject.HitObject.StartTime, parentHitObjectStartTime);
|
||||
setComputedLifetimeStart(obj.Entry);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue