Move `Schedule` call to base implementation of error meter for extra safety

This commit is contained in:
Dean Herbert 2021-12-21 12:55:21 +09:00
parent 28d6ff5d9c
commit 52db7b36fc
2 changed files with 8 additions and 3 deletions

View File

@ -53,13 +53,13 @@ public JudgementFlow()
LayoutEasing = Easing.OutQuint;
}
public void Push(Color4 colour) => Schedule(() =>
public void Push(Color4 colour)
{
Add(new HitErrorCircle(colour, drawable_judgement_size));
if (Children.Count > max_available_judgements)
Children.FirstOrDefault(c => !c.IsRemoved)?.Remove();
});
}
}
internal class HitErrorCircle : Container

View File

@ -40,9 +40,14 @@ protected override void LoadComplete()
if (gameplayClockContainer != null)
gameplayClockContainer.OnSeek += Clear;
processor.NewJudgement += OnNewJudgement;
// Scheduled as meter implementations are likely going to change/add drawables when reacting to this.
processor.NewJudgement += j => Schedule(() => OnNewJudgement(j));
}
/// <summary>
/// Fired when a new judgement arrives.
/// </summary>
/// <param name="judgement">The new judgement.</param>
protected abstract void OnNewJudgement(JudgementResult judgement);
protected Color4 GetColourForHitResult(HitResult result)