1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Improve tiling logic

This commit is contained in:
Dean Herbert 2020-05-01 19:49:01 +09:00
parent afcb45f28b
commit 510df8b282

View File

@ -21,9 +21,16 @@ namespace osu.Game.Rulesets.Taiko.Skinning
{ {
base.Update(); base.Update();
while (true)
{
float? additiveX = null;
foreach (var sprite in InternalChildren) foreach (var sprite in InternalChildren)
{ {
sprite.X -= (float)Time.Elapsed * 0.1f; // add the x coordinates and perform re-layout on all sprites as spacing may change with gameplay scale.
sprite.X = additiveX ??= sprite.X - (float)Time.Elapsed * 0.1f;
additiveX += sprite.DrawWidth - 1;
if (sprite.X + sprite.DrawWidth < 0) if (sprite.X + sprite.DrawWidth < 0)
sprite.Expire(); sprite.Expire();
@ -31,9 +38,11 @@ namespace osu.Game.Rulesets.Taiko.Skinning
var last = InternalChildren.LastOrDefault(); var last = InternalChildren.LastOrDefault();
if (last == null || last.ScreenSpaceDrawQuad.TopRight.X < ScreenSpaceDrawQuad.TopRight.X) // only break from this loop once we have saturated horizontal space completely.
{ if (last != null && last.ScreenSpaceDrawQuad.TopRight.X >= ScreenSpaceDrawQuad.TopRight.X)
AddInternal(new ScrollerSprite { X = last == null ? 0 : last.X + last.DrawWidth }); break;
AddInternal(new ScrollerSprite());
} }
} }