Ensure seeding screen is refreshed on entering

This commit is contained in:
Dean Herbert 2022-11-07 18:46:04 +09:00
parent cb6b9898c1
commit de2dac22b8
1 changed files with 19 additions and 13 deletions

View File

@ -70,16 +70,16 @@ private void load()
currentTeam.BindValueChanged(teamChanged, true);
}
private void teamChanged(ValueChangedEvent<TournamentTeam> team) => Scheduler.AddOnce(() =>
{
if (team.NewValue == null)
{
mainContainer.Clear();
return;
}
private void teamChanged(ValueChangedEvent<TournamentTeam> team) => updateTeamDisplay();
showTeam(team.NewValue);
});
public override void Show()
{
base.Show();
// Changes could have been made on editor screen.
// Rather than trying to track all the possibilities (teams / players / scores) just force a full refresh.
updateTeamDisplay();
}
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
{
@ -91,14 +91,20 @@ protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> m
currentTeam.Value = match.NewValue.Team1.Value;
}
private void showTeam(TournamentTeam team)
private void updateTeamDisplay() => Scheduler.AddOnce(() =>
{
if (currentTeam.Value == null)
{
mainContainer.Clear();
return;
}
mainContainer.Children = new Drawable[]
{
new LeftInfo(team) { Position = new Vector2(55, 150), },
new RightInfo(team) { Position = new Vector2(500, 150), },
new LeftInfo(currentTeam.Value) { Position = new Vector2(55, 150), },
new RightInfo(currentTeam.Value) { Position = new Vector2(500, 150), },
};
}
});
private class RightInfo : CompositeDrawable
{