1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 19:22: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,19 +21,28 @@ namespace osu.Game.Rulesets.Taiko.Skinning
{ {
base.Update(); base.Update();
foreach (var sprite in InternalChildren) while (true)
{ {
sprite.X -= (float)Time.Elapsed * 0.1f; float? additiveX = null;
if (sprite.X + sprite.DrawWidth < 0) foreach (var sprite in InternalChildren)
sprite.Expire(); {
} // 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;
var last = InternalChildren.LastOrDefault(); additiveX += sprite.DrawWidth - 1;
if (last == null || last.ScreenSpaceDrawQuad.TopRight.X < ScreenSpaceDrawQuad.TopRight.X) if (sprite.X + sprite.DrawWidth < 0)
{ sprite.Expire();
AddInternal(new ScrollerSprite { X = last == null ? 0 : last.X + last.DrawWidth }); }
var last = InternalChildren.LastOrDefault();
// only break from this loop once we have saturated horizontal space completely.
if (last != null && last.ScreenSpaceDrawQuad.TopRight.X >= ScreenSpaceDrawQuad.TopRight.X)
break;
AddInternal(new ScrollerSprite());
} }
} }