1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 03:22:54 +08:00

Refactor implementation to support hitobjects nested multiple levels deep

This commit is contained in:
Dean Herbert 2022-10-20 22:30:30 +09:00
parent a754dc6d3b
commit 26860a903e

View File

@ -236,8 +236,10 @@ namespace osu.Game.Rulesets.UI.Scrolling
entry.LifetimeStart = Math.Min(entry.HitObject.StartTime - judgementOffset, computedStartTime); 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) if (hitObject.HitObject is IHasDuration e)
{ {
float length = LengthAtTime(hitObject.HitObject.StartTime, e.EndTime); float length = LengthAtTime(hitObject.HitObject.StartTime, e.EndTime);
@ -249,10 +251,10 @@ namespace osu.Game.Rulesets.UI.Scrolling
foreach (var obj in hitObject.NestedHitObjects) 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 // 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); setComputedLifetimeStart(obj.Entry);
} }
} }