Fix TeamScoreDisplay not tracking team changes properly

This commit is contained in:
Dean Herbert
2022-07-13 18:15:59 +09:00
parent 1516756d8b
commit 5c6fa2341f

View File

@ -42,6 +42,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
currentMatch.BindValueChanged(matchChanged); currentMatch.BindValueChanged(matchChanged);
currentTeam.BindValueChanged(teamChanged);
updateMatch(); updateMatch();
} }
@ -67,7 +69,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
// team may change to same team, which means score is not in a good state. // team may change to same team, which means score is not in a good state.
// thus we handle this manually. // thus we handle this manually.
teamChanged(currentTeam.Value); currentTeam.TriggerChange();
} }
protected override bool OnMouseDown(MouseDownEvent e) protected override bool OnMouseDown(MouseDownEvent e)
@ -88,11 +90,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
return base.OnMouseDown(e); return base.OnMouseDown(e);
} }
private void teamChanged(TournamentTeam team) private void teamChanged(ValueChangedEvent<TournamentTeam> team)
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
teamDisplay = new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0), teamDisplay = new TeamDisplay(team.NewValue, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0),
}; };
} }
} }