1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Merge pull request #21154 from peppy/seeding-fixes

Fix multiple issues with seeding screen in tournament client
This commit is contained in:
Dan Balasescu 2022-11-10 23:05:20 +09:00 committed by GitHub
commit 980acb0a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 18 deletions

View File

@ -256,7 +256,7 @@ namespace osu.Game.Tournament.Screens.Editors
mods.BindValueChanged(modString => Model.Mods = modString.NewValue); mods.BindValueChanged(modString => Model.Mods = modString.NewValue);
} }
private void updatePanel() private void updatePanel() => Schedule(() =>
{ {
drawableContainer.Clear(); drawableContainer.Clear();
@ -269,7 +269,7 @@ namespace osu.Game.Tournament.Screens.Editors
Width = 300 Width = 300
}; };
} }
} });
} }
} }
} }

View File

@ -26,6 +26,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro
private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>(); private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>();
private TourneyButton showFirstTeamButton;
private TourneyButton showSecondTeamButton;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -46,13 +49,13 @@ namespace osu.Game.Tournament.Screens.TeamIntro
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new TourneyButton showFirstTeamButton = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Show first team", Text = "Show first team",
Action = () => currentTeam.Value = CurrentMatch.Value.Team1.Value, Action = () => currentTeam.Value = CurrentMatch.Value.Team1.Value,
}, },
new TourneyButton showSecondTeamButton = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Show second team", Text = "Show second team",
@ -70,35 +73,48 @@ namespace osu.Game.Tournament.Screens.TeamIntro
currentTeam.BindValueChanged(teamChanged, true); currentTeam.BindValueChanged(teamChanged, true);
} }
private void teamChanged(ValueChangedEvent<TournamentTeam> team) => Scheduler.AddOnce(() => private void teamChanged(ValueChangedEvent<TournamentTeam> team) => updateTeamDisplay();
{
if (team.NewValue == null)
{
mainContainer.Clear();
return;
}
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) protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
base.CurrentMatchChanged(match); base.CurrentMatchChanged(match);
if (match.NewValue == null) if (match.NewValue == null)
{
showFirstTeamButton.Enabled.Value = false;
showSecondTeamButton.Enabled.Value = false;
return; return;
}
showFirstTeamButton.Enabled.Value = true;
showSecondTeamButton.Enabled.Value = true;
currentTeam.Value = match.NewValue.Team1.Value; 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[] mainContainer.Children = new Drawable[]
{ {
new LeftInfo(team) { Position = new Vector2(55, 150), }, new LeftInfo(currentTeam.Value) { Position = new Vector2(55, 150), },
new RightInfo(team) { Position = new Vector2(500, 150), }, new RightInfo(currentTeam.Value) { Position = new Vector2(500, 150), },
}; };
} });
private class RightInfo : CompositeDrawable private class RightInfo : CompositeDrawable
{ {

View File

@ -238,7 +238,7 @@ namespace osu.Game.Tournament
var beatmapsRequiringPopulation = ladder.Teams var beatmapsRequiringPopulation = ladder.Teams
.SelectMany(r => r.SeedingResults) .SelectMany(r => r.SeedingResults)
.SelectMany(r => r.Beatmaps) .SelectMany(r => r.Beatmaps)
.Where(b => b.Beatmap?.OnlineID == 0 && b.ID > 0).ToList(); .Where(b => (b.Beatmap == null || b.Beatmap.OnlineID == 0) && b.ID > 0).ToList();
if (beatmapsRequiringPopulation.Count == 0) if (beatmapsRequiringPopulation.Count == 0)
return false; return false;