diff --git a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs index 7f8956c24d..a7ebbfa8b3 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/DrawableMatchPairing.cs @@ -61,7 +61,7 @@ public DrawableMatchPairing(MatchPairing pairing) pairing.Team2.BindValueChanged(_ => updateTeams()); pairing.Team1Score.BindValueChanged(_ => updateWinConditions()); pairing.Team2Score.BindValueChanged(_ => updateWinConditions()); - pairing.BestOf.BindValueChanged(_ => updateWinConditions()); + pairing.Grouping.BindValueChanged(_ => updateWinConditions()); pairing.Completed.BindValueChanged(_ => updateProgression()); pairing.Progression.BindValueChanged(_ => updateProgression()); @@ -112,11 +112,11 @@ private void updateProgression() private void updateWinConditions() { - if (conditions.Value == null) return; + if (conditions.Value == null || Pairing.Grouping.Value == null) return; - var instaWinAmount = Pairing.BestOf.Value / 2; + var instaWinAmount = Pairing.Grouping.Value.BestOf / 2; - Pairing.Completed.Value = Pairing.Team1Score + Pairing.Team2Score >= Pairing.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount; + Pairing.Completed.Value = Pairing.Grouping.Value.BestOf > 0 && (Pairing.Team1Score + Pairing.Team2Score >= Pairing.Grouping.Value.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount); } protected override void LoadComplete() diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs index 0860966502..e1da676f22 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderInfo.cs @@ -1,3 +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; namespace osu.Game.Tournament.Screens.Ladder.Components @@ -6,5 +9,6 @@ public class LadderInfo { public List Pairings = new List(); public List<(int, int)> Progressions = new List<(int, int)>(); + public List Groupings = new List(); } } diff --git a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs index a2275784a0..7532cee0f0 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/LadderSettings.cs @@ -3,7 +3,6 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -18,8 +17,6 @@ public class LadderEditorSettings : PlayerSettingsGroup protected override string Title => @"ladder"; - private PlayerSliderBar sliderBestOf; - private OsuTextBox textboxTeam1; private OsuTextBox textboxTeam2; @@ -70,39 +67,38 @@ private void load() }, }, textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 }, - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = padding }, - Children = new Drawable[] - { - new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Text = "Best of", - }, - }, - }, - sliderBestOf = new PlayerSliderBar - { - Bindable = new BindableDouble - { - Default = 11, - Value = 11, - MinValue = 1, - MaxValue = 21, - Precision = 1, - }, - } + // new Container + // { + // RelativeSizeAxes = Axes.X, + // AutoSizeAxes = Axes.Y, + // Padding = new MarginPadding { Horizontal = padding }, + // Children = new Drawable[] + // { + // new OsuSpriteText + // { + // Anchor = Anchor.CentreLeft, + // Origin = Anchor.CentreLeft, + // Text = "Best of", + // }, + // }, + // }, + // sliderBestOf = new PlayerSliderBar + // { + // Bindable = new BindableDouble + // { + // Default = 11, + // Value = 11, + // MinValue = 1, + // MaxValue = 21, + // Precision = 1, + // }, + // } }; editorInfo.Selected.ValueChanged += selection => { textboxTeam1.Text = selection?.Team1.Value?.Acronym; textboxTeam2.Text = selection?.Team2.Value?.Acronym; - sliderBestOf.Bindable.Value = selection?.BestOf ?? sliderBestOf.Bindable.Default; }; textboxTeam1.OnCommit = (val, newText) => @@ -117,10 +113,10 @@ private void load() editorInfo.Selected.Value.Team2.Value = teamEntries.FirstOrDefault(t => t.Acronym == val.Text); }; - sliderBestOf.Bindable.ValueChanged += val => - { - if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.BestOf.Value = (int)val; - }; + // sliderBestOf.Bindable.ValueChanged += val => + // { + // if (editorInfo.Selected.Value != null) editorInfo.Selected.Value.BestOf.Value = (int)val; + // }; editorInfo.EditingEnabled.ValueChanged += enabled => { diff --git a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs index c47e3ea440..0bdfb5c300 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/MatchPairing.cs @@ -25,7 +25,7 @@ public class MatchPairing public readonly Bindable Completed = new Bindable(); - public readonly BindableInt BestOf = new BindableInt(11); + public readonly Bindable Grouping = new Bindable(); [JsonIgnore] public readonly Bindable Progression = new Bindable(); diff --git a/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs new file mode 100644 index 0000000000..0178885307 --- /dev/null +++ b/osu.Game.Tournament/Screens/Ladder/Components/TournamentGrouping.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tournament.Screens.Ladder.Components +{ + public class TournamentGrouping + { + public int ID; + + public string Name; + public string Description; + + public int BestOf; + } +}