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:
commit
af092966e4
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user