mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 14:12:55 +08:00
Add grouping and move BestOf out of pairing
This commit is contained in:
parent
a3a2a149ca
commit
68cef76468
@ -61,7 +61,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
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 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
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()
|
||||
|
@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
public List<MatchPairing> Pairings = new List<MatchPairing>();
|
||||
public List<(int, int)> Progressions = new List<(int, int)>();
|
||||
public List<TournamentGrouping> Groupings = new List<TournamentGrouping>();
|
||||
}
|
||||
}
|
||||
|
@ -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 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
protected override string Title => @"ladder";
|
||||
|
||||
private PlayerSliderBar<double> sliderBestOf;
|
||||
|
||||
private OsuTextBox textboxTeam1;
|
||||
private OsuTextBox textboxTeam2;
|
||||
|
||||
@ -70,39 +67,38 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
},
|
||||
},
|
||||
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<double>
|
||||
{
|
||||
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<double>
|
||||
// {
|
||||
// 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 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
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 =>
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
public readonly Bindable<bool> Completed = new Bindable<bool>();
|
||||
|
||||
public readonly BindableInt BestOf = new BindableInt(11);
|
||||
public readonly Bindable<TournamentGrouping> Grouping = new Bindable<TournamentGrouping>();
|
||||
|
||||
[JsonIgnore]
|
||||
public readonly Bindable<MatchPairing> Progression = new Bindable<MatchPairing>();
|
||||
|
@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user