mirror of https://github.com/ppy/osu
Fix spawning too many sprites due to not yet populated sizing
This commit is contained in:
parent
e28e89213f
commit
00efeb7cc6
|
@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||||
{
|
{
|
||||||
public class LegacyTaikoScroller : CompositeDrawable
|
public class LegacyTaikoScroller : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
public Bindable<JudgementResult> LastResult = new Bindable<JudgementResult>();
|
||||||
|
|
||||||
public LegacyTaikoScroller()
|
public LegacyTaikoScroller()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
@ -50,21 +52,16 @@ protected override void LoadComplete()
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bindable<JudgementResult> LastResult = new Bindable<JudgementResult>();
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
bool wideEnough() =>
|
|
||||||
InternalChildren.Any()
|
|
||||||
&& InternalChildren.First().ScreenSpaceDrawQuad.Width * InternalChildren.Count >= ScreenSpaceDrawQuad.Width * 2;
|
|
||||||
|
|
||||||
// store X before checking wide enough so if we perform layout there is no positional discrepancy.
|
// store X before checking wide enough so if we perform layout there is no positional discrepancy.
|
||||||
float currentX = (InternalChildren?.FirstOrDefault()?.X ?? 0) - (float)Clock.ElapsedFrameTime * 0.1f;
|
float currentX = (InternalChildren?.FirstOrDefault()?.X ?? 0) - (float)Clock.ElapsedFrameTime * 0.1f;
|
||||||
|
|
||||||
// ensure we have enough sprites
|
// ensure we have enough sprites
|
||||||
while (!wideEnough())
|
if (!InternalChildren.Any()
|
||||||
|
|| InternalChildren.First().ScreenSpaceDrawQuad.Width * InternalChildren.Count < ScreenSpaceDrawQuad.Width * 2)
|
||||||
AddInternal(new ScrollerSprite { Passing = passing });
|
AddInternal(new ScrollerSprite { Passing = passing });
|
||||||
|
|
||||||
var first = InternalChildren.First();
|
var first = InternalChildren.First();
|
||||||
|
|
Loading…
Reference in New Issue