Update to support new dropdown logic

This commit is contained in:
Dean Herbert
2018-11-15 14:12:41 +09:00
parent 8eff21d128
commit 604cb4cb9e
3 changed files with 7 additions and 8 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Configuration;
@ -36,8 +35,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
var teamEntries = ladderInfo.Teams; var teamEntries = ladderInfo.Teams;
var groupingOptions = ladderInfo.Groupings.Select(g => new KeyValuePair<string, TournamentGrouping>(g.Name, g)) var groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping());
.Prepend(new KeyValuePair<string, TournamentGrouping>("None", new TournamentGrouping()));
Children = new Drawable[] Children = new Drawable[]
{ {
@ -80,7 +78,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 },
groupingDropdown = new SettingsDropdown<TournamentGrouping> groupingDropdown = new SettingsDropdown<TournamentGrouping>
{ {
Bindable = new Bindable<TournamentGrouping> { Default = groupingOptions.First().Value }, Bindable = new Bindable<TournamentGrouping> { Default = groupingOptions.First() },
Items = groupingOptions Items = groupingOptions
}, },
losersCheckbox = new PlayerCheckbox losersCheckbox = new PlayerCheckbox
@ -94,7 +92,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
textboxTeam1.Text = selection?.Team1.Value?.Acronym; textboxTeam1.Text = selection?.Team1.Value?.Acronym;
textboxTeam2.Text = selection?.Team2.Value?.Acronym; textboxTeam2.Text = selection?.Team2.Value?.Acronym;
groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First().Value; groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First();
losersCheckbox.Current.Value = selection?.Losers.Value ?? false; losersCheckbox.Current.Value = selection?.Losers.Value ?? false;
}; };

View File

@ -22,5 +22,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
public readonly Bindable<DateTimeOffset> StartDate = new Bindable<DateTimeOffset>(); public readonly Bindable<DateTimeOffset> StartDate = new Bindable<DateTimeOffset>();
public List<int> Pairings = new List<int>(); public List<int> Pairings = new List<int>();
public override string ToString() => Name.Value ?? "None";
} }
} }

View File

@ -47,7 +47,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
new TournamentLogo() new TournamentLogo
{ {
Y = 40, Y = 40,
}, },
@ -163,7 +163,6 @@ namespace osu.Game.Tournament.Screens.TeamWin
public TeamWithPlayers(TournamentTeam team, bool left = false) public TeamWithPlayers(TournamentTeam team, bool left = false)
{ {
FillFlowContainer players;
var colour = left ? red : blue; var colour = left ? red : blue;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -172,7 +171,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
}, },
players = new FillFlowContainer new FillFlowContainer
{ {
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,