mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 21:12:55 +08:00
Revert "Fix uninitialized scrollLength value is used"
This reverts commit 73dfb04d
This commit is contained in:
parent
aa42cf2fc0
commit
2c65b8fa93
@ -185,6 +185,8 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
layoutComputed.Remove(hitObject);
|
layoutComputed.Remove(hitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float scrollLength;
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
@ -197,16 +199,29 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
layoutComputed.Clear();
|
layoutComputed.Clear();
|
||||||
|
|
||||||
scrollingInfo.Algorithm.Reset();
|
scrollingInfo.Algorithm.Reset();
|
||||||
|
|
||||||
|
switch (direction.Value)
|
||||||
|
{
|
||||||
|
case ScrollingDirection.Up:
|
||||||
|
case ScrollingDirection.Down:
|
||||||
|
scrollLength = DrawSize.Y;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
scrollLength = DrawSize.X;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
layoutCache.Validate();
|
layoutCache.Validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to calculate hit object positions (including nested hit objects) as soon as possible after lifetimes
|
|
||||||
// to prevent hit objects displayed in a wrong position for one frame.
|
|
||||||
protected override void UpdateAfterChildrenLife()
|
protected override void UpdateAfterChildrenLife()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildrenLife();
|
base.UpdateAfterChildrenLife();
|
||||||
|
|
||||||
|
// We need to calculate hit object positions (including nested hit objects) as soon as possible after lifetimes
|
||||||
|
// to prevent hit objects displayed in a wrong position for one frame.
|
||||||
// Only AliveObjects need to be considered for layout (reduces overhead in the case of scroll speed changes).
|
// Only AliveObjects need to be considered for layout (reduces overhead in the case of scroll speed changes).
|
||||||
foreach (var obj in AliveObjects)
|
foreach (var obj in AliveObjects)
|
||||||
{
|
{
|
||||||
@ -245,7 +260,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.LifetimeStart = scrollingInfo.Algorithm.GetDisplayStartTime(entry.HitObject.StartTime, startOffset, timeRange.Value, getLength());
|
entry.LifetimeStart = scrollingInfo.Algorithm.GetDisplayStartTime(entry.HitObject.StartTime, startOffset, timeRange.Value, scrollLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLayoutRecursive(DrawableHitObject hitObject)
|
private void updateLayoutRecursive(DrawableHitObject hitObject)
|
||||||
@ -256,12 +271,12 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
{
|
{
|
||||||
case ScrollingDirection.Up:
|
case ScrollingDirection.Up:
|
||||||
case ScrollingDirection.Down:
|
case ScrollingDirection.Down:
|
||||||
hitObject.Height = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, e.EndTime, timeRange.Value, getLength());
|
hitObject.Height = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, e.EndTime, timeRange.Value, scrollLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScrollingDirection.Left:
|
case ScrollingDirection.Left:
|
||||||
case ScrollingDirection.Right:
|
case ScrollingDirection.Right:
|
||||||
hitObject.Width = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, e.EndTime, timeRange.Value, getLength());
|
hitObject.Width = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, e.EndTime, timeRange.Value, scrollLength);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,19 +295,19 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
switch (direction.Value)
|
switch (direction.Value)
|
||||||
{
|
{
|
||||||
case ScrollingDirection.Up:
|
case ScrollingDirection.Up:
|
||||||
hitObject.Y = scrollingInfo.Algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, timeRange.Value, getLength());
|
hitObject.Y = scrollingInfo.Algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, timeRange.Value, scrollLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScrollingDirection.Down:
|
case ScrollingDirection.Down:
|
||||||
hitObject.Y = -scrollingInfo.Algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, timeRange.Value, getLength());
|
hitObject.Y = -scrollingInfo.Algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, timeRange.Value, scrollLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScrollingDirection.Left:
|
case ScrollingDirection.Left:
|
||||||
hitObject.X = scrollingInfo.Algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, timeRange.Value, getLength());
|
hitObject.X = scrollingInfo.Algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, timeRange.Value, scrollLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScrollingDirection.Right:
|
case ScrollingDirection.Right:
|
||||||
hitObject.X = -scrollingInfo.Algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, timeRange.Value, getLength());
|
hitObject.X = -scrollingInfo.Algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, timeRange.Value, scrollLength);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user