mirror of
https://github.com/ppy/osu
synced 2025-02-09 14:47:33 +00:00
Fix test failures due to null current match
This commit is contained in:
parent
e4f07e5284
commit
832e64cc95
@ -92,17 +92,20 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LadderInfo ladder)
|
private void load(LadderInfo ladder)
|
||||||
{
|
{
|
||||||
currentMatch.BindValueChanged(matchChanged);
|
|
||||||
currentMatch.BindTo(ladder.CurrentMatch);
|
currentMatch.BindTo(ladder.CurrentMatch);
|
||||||
|
currentMatch.BindValueChanged(matchChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
|
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||||
{
|
{
|
||||||
currentTeamScore.UnbindBindings();
|
currentTeamScore.UnbindBindings();
|
||||||
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score);
|
|
||||||
|
|
||||||
currentTeam.UnbindBindings();
|
currentTeam.UnbindBindings();
|
||||||
currentTeam.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1 : match.NewValue.Team2);
|
|
||||||
|
if (match.NewValue != null)
|
||||||
|
{
|
||||||
|
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score);
|
||||||
|
currentTeam.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1 : match.NewValue.Team2);
|
||||||
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
@ -131,7 +134,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
teamDisplay = new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value.PointsToWin),
|
teamDisplay = new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user