From c3ddf773b75c2d2bd64bf918a4c275ea8ae971f5 Mon Sep 17 00:00:00 2001 From: Rodrigo Pina Date: Tue, 28 Nov 2023 14:56:07 +0000 Subject: [PATCH] # osu.Game.Tournament.Models + Add: New property BanCount in TournamentRound to save the number of bans # osu.Game.Tournament/Screens + Add: New slider setting in RoundEditorScreen to select the number of bans per round * Change: Modified setNextMode behavior to get the round ban count, and select bans accordingly --- osu.Game.Tournament/Models/TournamentRound.cs | 1 + .../Screens/Editors/RoundEditorScreen.cs | 6 ++++++ osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs | 11 +++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/Models/TournamentRound.cs b/osu.Game.Tournament/Models/TournamentRound.cs index a92bab690e..7aa8bbb44f 100644 --- a/osu.Game.Tournament/Models/TournamentRound.cs +++ b/osu.Game.Tournament/Models/TournamentRound.cs @@ -18,6 +18,7 @@ namespace osu.Game.Tournament.Models public readonly Bindable Description = new Bindable(string.Empty); public readonly BindableInt BestOf = new BindableInt(9) { Default = 9, MinValue = 3, MaxValue = 23 }; + public readonly BindableInt BanCount = new BindableInt(1) { Default = 1, MinValue = 0, MaxValue = 5 }; [JsonProperty] public readonly BindableList Beatmaps = new BindableList(); diff --git a/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs index f887c41749..253cca8c98 100644 --- a/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/RoundEditorScreen.cs @@ -82,6 +82,12 @@ namespace osu.Game.Tournament.Screens.Editors Current = Model.StartDate }, new SettingsSlider + { + LabelText = "# of Bans", + Width = 0.33f, + Current = Model.BanCount + }, + new SettingsSlider { LabelText = "Best of", Width = 0.33f, diff --git a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs index f80f43bb77..5f5fb873f4 100644 --- a/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs +++ b/osu.Game.Tournament/Screens/MapPool/MapPoolScreen.cs @@ -146,17 +146,24 @@ namespace osu.Game.Tournament.Screens.MapPool private void setNextMode() { + int banCount = 2; + if (CurrentMatch.Value == null) return; + if (CurrentMatch.Value.Round.Value != null) + { + banCount = CurrentMatch.Value.Round.Value.BanCount.Value * 2; + } + const TeamColour roll_winner = TeamColour.Red; //todo: draw from match var nextColour = (CurrentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner) == TeamColour.Red ? TeamColour.Blue : TeamColour.Red; - if (pickType == ChoiceType.Ban && CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2) + if (pickType == ChoiceType.Ban && CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= banCount) setMode(pickColour, ChoiceType.Pick); else - setMode(nextColour, CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2 ? ChoiceType.Pick : ChoiceType.Ban); + setMode(nextColour, CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= banCount ? ChoiceType.Pick : ChoiceType.Ban); } protected override bool OnMouseDown(MouseDownEvent e)