1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 09:42:54 +08:00

Merge pull request #8302 from peppy/start-match-on-gameplay

Automatically mark the currently selected match as started on entering gameplay screen
This commit is contained in:
Dean Herbert 2020-03-17 20:04:56 +09:00 committed by GitHub
commit af092966e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,9 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private void load(LadderInfo ladder)
{
currentMatch.BindTo(ladder.CurrentMatch);
currentMatch.BindValueChanged(matchChanged, true);
currentMatch.BindValueChanged(matchChanged);
updateMatch();
}
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
@ -43,10 +45,19 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentTeamScore.UnbindBindings();
currentTeam.UnbindBindings();
if (match.NewValue != null)
Scheduler.AddOnce(updateMatch);
}
private void updateMatch()
{
var match = currentMatch.Value;
if (match != null)
{
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score);
currentTeam.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1 : match.NewValue.Team2);
match.StartMatch();
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.Team1Score : match.Team2Score);
currentTeam.BindTo(teamColour == TeamColour.Red ? match.Team1 : match.Team2);
}
// team may change to same team, which means score is not in a good state.