From 604cb4cb9ee4060d3512cc58391c780f372947a6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 15 Nov 2018 14:12:41 +0900 Subject: [PATCH] Update to support new dropdown logic --- .../Screens/Ladder/Components/LadderEditorSettings.cs | 8 +++----- .../Screens/Ladder/Components/TournamentGrouping.cs | 2 ++ osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs index 3fa7fdf7e8..afb20a68f0 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderEditorSettings.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -36,8 +35,7 @@ private void load() { var teamEntries = ladderInfo.Teams; - var groupingOptions = ladderInfo.Groupings.Select(g => new KeyValuePair(g.Name, g)) - .Prepend(new KeyValuePair("None", new TournamentGrouping())); + var groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping()); Children = new Drawable[] { @@ -80,7 +78,7 @@ private void load() textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, groupingDropdown = new SettingsDropdown { - Bindable = new Bindable { Default = groupingOptions.First().Value }, + Bindable = new Bindable { Default = groupingOptions.First() }, Items = groupingOptions }, losersCheckbox = new PlayerCheckbox @@ -94,7 +92,7 @@ private void load() { textboxTeam1.Text = selection?.Team1.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; }; diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs index 17f76a0143..370f0ea643 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -22,5 +22,7 @@ public class TournamentGrouping public readonly Bindable StartDate = new Bindable(); public List Pairings = new List(); + + public override string ToString() => Name.Value ?? "None"; } } diff --git a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs index 3c1bcdd1ae..a6f6e7038a 100644 --- a/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs +++ b/osu.Game.Tournament/Screens/TeamWin/TeamWinScreen.cs @@ -47,7 +47,7 @@ private void load(TextureStore textures, LadderInfo ladder, Storage storage) RelativeSizeAxes = Axes.Both, Loop = true, }, - new TournamentLogo() + new TournamentLogo { Y = 40, }, @@ -163,7 +163,6 @@ private class TeamWithPlayers : CompositeDrawable public TeamWithPlayers(TournamentTeam team, bool left = false) { - FillFlowContainer players; var colour = left ? red : blue; InternalChildren = new Drawable[] { @@ -172,7 +171,7 @@ public TeamWithPlayers(TournamentTeam team, bool left = false) Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - players = new FillFlowContainer + new FillFlowContainer { Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both,