1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 04:32:57 +08:00

# 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
This commit is contained in:
Rodrigo Pina 2023-11-28 14:56:07 +00:00
parent 537c9e031d
commit c3ddf773b7
3 changed files with 16 additions and 2 deletions

View File

@ -18,6 +18,7 @@ namespace osu.Game.Tournament.Models
public readonly Bindable<string> Description = new Bindable<string>(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<RoundBeatmap> Beatmaps = new BindableList<RoundBeatmap>();

View File

@ -82,6 +82,12 @@ namespace osu.Game.Tournament.Screens.Editors
Current = Model.StartDate
},
new SettingsSlider<int>
{
LabelText = "# of Bans",
Width = 0.33f,
Current = Model.BanCount
},
new SettingsSlider<int>
{
LabelText = "Best of",
Width = 0.33f,

View File

@ -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)