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

MatchPairing -> TournamentMatch

This commit is contained in:
Dean Herbert 2019-06-18 14:57:05 +09:00
parent 96e24ebd20
commit da20904a57
22 changed files with 228 additions and 228 deletions

View File

@ -12,22 +12,22 @@ using osu.Game.Tournament.Screens.Ladder.Components;
namespace osu.Game.Tournament.Tests namespace osu.Game.Tournament.Tests
{ {
public class TestSceneMatchPairings : OsuTestScene public class TestSceneMatches : OsuTestScene
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
typeof(MatchPairing), typeof(TournamentMatch),
typeof(DrawableMatchPairing), typeof(DrawableTournamentMatch),
typeof(DrawableMatchTeam), typeof(DrawableMatchTeam),
typeof(DrawableTournamentTeam), typeof(DrawableTournamentTeam),
}; };
public TestSceneMatchPairings() public TestSceneMatches()
{ {
Container<DrawableMatchPairing> level1; Container<DrawableTournamentMatch> level1;
Container<DrawableMatchPairing> level2; Container<DrawableTournamentMatch> level2;
var pairing1 = new MatchPairing( var match1 = new TournamentMatch(
new TournamentTeam { FlagName = { Value = "AU" }, FullName = { Value = "Australia" }, }, new TournamentTeam { FlagName = { Value = "AU" }, FullName = { Value = "Australia" }, },
new TournamentTeam { FlagName = { Value = "JP" }, FullName = { Value = "Japan" }, Acronym = { Value = "JPN" } }) new TournamentTeam { FlagName = { Value = "JP" }, FullName = { Value = "Japan" }, Acronym = { Value = "JPN" } })
{ {
@ -35,7 +35,7 @@ namespace osu.Game.Tournament.Tests
Team2Score = { Value = 1 }, Team2Score = { Value = 1 },
}; };
var pairing2 = new MatchPairing( var match2 = new TournamentMatch(
new TournamentTeam new TournamentTeam
{ {
FlagName = { Value = "RO" }, FlagName = { Value = "RO" },
@ -49,47 +49,47 @@ namespace osu.Game.Tournament.Tests
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Children = new Drawable[] Children = new Drawable[]
{ {
level1 = new FillFlowContainer<DrawableMatchPairing> level1 = new FillFlowContainer<DrawableTournamentMatch>
{ {
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new[] Children = new[]
{ {
new DrawableMatchPairing(pairing1), new DrawableTournamentMatch(match1),
new DrawableMatchPairing(pairing2), new DrawableTournamentMatch(match2),
new DrawableMatchPairing(new MatchPairing()), new DrawableTournamentMatch(new TournamentMatch()),
} }
}, },
level2 = new FillFlowContainer<DrawableMatchPairing> level2 = new FillFlowContainer<DrawableTournamentMatch>
{ {
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Margin = new MarginPadding(20), Margin = new MarginPadding(20),
Children = new[] Children = new[]
{ {
new DrawableMatchPairing(new MatchPairing()), new DrawableTournamentMatch(new TournamentMatch()),
new DrawableMatchPairing(new MatchPairing()) new DrawableTournamentMatch(new TournamentMatch())
} }
} }
} }
}; };
level1.Children[0].Pairing.Progression.Value = level2.Children[0].Pairing; level1.Children[0].Match.Progression.Value = level2.Children[0].Match;
level1.Children[1].Pairing.Progression.Value = level2.Children[0].Pairing; level1.Children[1].Match.Progression.Value = level2.Children[0].Match;
AddRepeatStep("change scores", () => pairing1.Team2Score.Value++, 4); AddRepeatStep("change scores", () => match1.Team2Score.Value++, 4);
AddStep("add new team", () => pairing2.Team2.Value = new TournamentTeam { FlagName = { Value = "PT" }, FullName = { Value = "Portugal" } }); AddStep("add new team", () => match2.Team2.Value = new TournamentTeam { FlagName = { Value = "PT" }, FullName = { Value = "Portugal" } });
AddStep("Add progression", () => level1.Children[2].Pairing.Progression.Value = level2.Children[1].Pairing); AddStep("Add progression", () => level1.Children[2].Match.Progression.Value = level2.Children[1].Match);
AddStep("start match", () => pairing2.StartMatch()); AddStep("start match", () => match2.StartMatch());
AddRepeatStep("change scores", () => pairing2.Team1Score.Value++, 10); AddRepeatStep("change scores", () => match2.Team1Score.Value++, 10);
AddStep("start submatch", () => level2.Children[0].Pairing.StartMatch()); AddStep("start submatch", () => level2.Children[0].Match.StartMatch());
AddRepeatStep("change scores", () => level2.Children[0].Pairing.Team1Score.Value++, 5); AddRepeatStep("change scores", () => level2.Children[0].Match.Team1Score.Value++, 5);
AddRepeatStep("change scores", () => level2.Children[0].Pairing.Team2Score.Value++, 4); AddRepeatStep("change scores", () => level2.Children[0].Match.Team2Score.Value++, 4);
} }
} }
} }

View File

@ -13,16 +13,16 @@ namespace osu.Game.Tournament.Tests
public class TestSceneTeamIntro : LadderTestScene public class TestSceneTeamIntro : LadderTestScene
{ {
[Cached] [Cached]
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
var pairing = new MatchPairing(); var match = new TournamentMatch();
pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); match.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA");
pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); match.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN");
pairing.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals");
currentMatch.Value = pairing; currentMatch.Value = match;
Add(new TeamIntroScreen Add(new TeamIntroScreen
{ {

View File

@ -13,16 +13,16 @@ namespace osu.Game.Tournament.Tests
public class TestSceneTeamWin : LadderTestScene public class TestSceneTeamWin : LadderTestScene
{ {
[Cached] [Cached]
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
var pairing = new MatchPairing(); var match = new TournamentMatch();
pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA"); match.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA");
pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN"); match.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN");
pairing.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals"); match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals");
currentMatch.Value = pairing; currentMatch.Value = match;
Add(new TeamWinScreen Add(new TeamWinScreen
{ {

View File

@ -53,7 +53,7 @@ namespace osu.Game.Tournament.Tests
Origin = Anchor.Centre, Origin = Anchor.Centre,
}); });
ladderInfo.CurrentMatch.Value = new MatchPairing ladderInfo.CurrentMatch.Value = new TournamentMatch
{ {
Team1 = Team1 =
{ {

View File

@ -32,7 +32,7 @@ namespace osu.Game.Tournament.Components
public const float HEIGHT = 50; public const float HEIGHT = 50;
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private Box flash; private Box flash;
public TournamentBeatmapPanel(BeatmapInfo beatmap, string mods = null) public TournamentBeatmapPanel(BeatmapInfo beatmap, string mods = null)
@ -141,11 +141,11 @@ namespace osu.Game.Tournament.Components
}); });
} }
private void matchChanged(ValueChangedEvent<MatchPairing> pairing) private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
if (pairing.OldValue != null) if (match.OldValue != null)
pairing.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged; match.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged;
pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged; match.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
updateState(); updateState();
} }

View File

@ -7,6 +7,6 @@ namespace osu.Game.Tournament.Models
{ {
public class LadderEditorInfo public class LadderEditorInfo
{ {
public readonly Bindable<MatchPairing> Selected = new Bindable<MatchPairing>(); public readonly Bindable<TournamentMatch> Selected = new Bindable<TournamentMatch>();
} }
} }

View File

@ -9,7 +9,7 @@ namespace osu.Game.Tournament.Models
{ {
public class LadderInfo public class LadderInfo
{ {
public BindableList<MatchPairing> Pairings = new BindableList<MatchPairing>(); public BindableList<TournamentMatch> Matches = new BindableList<TournamentMatch>();
public BindableList<TournamentRound> Rounds = new BindableList<TournamentRound>(); public BindableList<TournamentRound> Rounds = new BindableList<TournamentRound>();
public BindableList<TournamentTeam> Teams = new BindableList<TournamentTeam>(); public BindableList<TournamentTeam> Teams = new BindableList<TournamentTeam>();
@ -17,6 +17,6 @@ namespace osu.Game.Tournament.Models
public List<TournamentProgression> Progressions = new List<TournamentProgression>(); public List<TournamentProgression> Progressions = new List<TournamentProgression>();
[JsonIgnore] [JsonIgnore]
public Bindable<MatchPairing> CurrentMatch = new Bindable<MatchPairing>(); public Bindable<TournamentMatch> CurrentMatch = new Bindable<TournamentMatch>();
} }
} }

View File

@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Models
/// A collection of two teams competing in a head-to-head match. /// A collection of two teams competing in a head-to-head match.
/// </summary> /// </summary>
[Serializable] [Serializable]
public class MatchPairing public class TournamentMatch
{ {
public int ID; public int ID;
@ -54,10 +54,10 @@ namespace osu.Game.Tournament.Models
public readonly Bindable<TournamentRound> Round = new Bindable<TournamentRound>(); public readonly Bindable<TournamentRound> Round = new Bindable<TournamentRound>();
[JsonIgnore] [JsonIgnore]
public readonly Bindable<MatchPairing> Progression = new Bindable<MatchPairing>(); public readonly Bindable<TournamentMatch> Progression = new Bindable<TournamentMatch>();
[JsonIgnore] [JsonIgnore]
public readonly Bindable<MatchPairing> LosersProgression = new Bindable<MatchPairing>(); public readonly Bindable<TournamentMatch> LosersProgression = new Bindable<TournamentMatch>();
/// <summary> /// <summary>
/// Should not be set directly. Use LadderInfo.CurrentMatch.Value = this instead. /// Should not be set directly. Use LadderInfo.CurrentMatch.Value = this instead.
@ -67,17 +67,17 @@ namespace osu.Game.Tournament.Models
public readonly Bindable<DateTimeOffset> Date = new Bindable<DateTimeOffset>(); public readonly Bindable<DateTimeOffset> Date = new Bindable<DateTimeOffset>();
[JsonProperty] [JsonProperty]
public readonly BindableList<ConditionalMatchPairing> ConditionalPairings = new BindableList<ConditionalMatchPairing>(); public readonly BindableList<ConditionalTournamentMatch> ConditionalMatches = new BindableList<ConditionalTournamentMatch>();
public readonly Bindable<Point> Position = new Bindable<Point>(); public readonly Bindable<Point> Position = new Bindable<Point>();
public MatchPairing() public TournamentMatch()
{ {
Team1.BindValueChanged(t => Team1Acronym = t.NewValue?.Acronym.Value, true); Team1.BindValueChanged(t => Team1Acronym = t.NewValue?.Acronym.Value, true);
Team2.BindValueChanged(t => Team2Acronym = t.NewValue?.Acronym.Value, true); Team2.BindValueChanged(t => Team2Acronym = t.NewValue?.Acronym.Value, true);
} }
public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) public TournamentMatch(TournamentTeam team1 = null, TournamentTeam team2 = null)
: this() : this()
{ {
Team1.Value = team1; Team1.Value = team1;

View File

@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Models
public readonly Bindable<DateTimeOffset> StartDate = new Bindable<DateTimeOffset>(); public readonly Bindable<DateTimeOffset> StartDate = new Bindable<DateTimeOffset>();
// only used for serialisation // only used for serialisation
public List<int> Pairings = new List<int>(); public List<int> Matches = new List<int>();
public override string ToString() => Name.Value ?? "None"; public override string ToString() => Name.Value ?? "None";
} }

View File

@ -39,9 +39,9 @@ namespace osu.Game.Tournament.Screens.Editors
}); });
} }
public void BeginJoin(MatchPairing pairing, bool losers) public void BeginJoin(TournamentMatch match, bool losers)
{ {
ScrollContent.Add(new JoinVisualiser(PairingsContainer, pairing, losers, UpdateLayout)); ScrollContent.Add(new JoinVisualiser(MatchesContainer, match, losers, UpdateLayout));
} }
public MenuItem[] ContextMenuItems public MenuItem[] ContextMenuItems
@ -55,35 +55,35 @@ namespace osu.Game.Tournament.Screens.Editors
{ {
new OsuMenuItem("Create new match", MenuItemType.Highlighted, () => new OsuMenuItem("Create new match", MenuItemType.Highlighted, () =>
{ {
var pos = PairingsContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); var pos = MatchesContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position);
LadderInfo.Pairings.Add(new MatchPairing { Position = { Value = new Point((int)pos.X, (int)pos.Y) } }); LadderInfo.Matches.Add(new TournamentMatch { Position = { Value = new Point((int)pos.X, (int)pos.Y) } });
}), }),
new OsuMenuItem("Reset teams", MenuItemType.Destructive, () => new OsuMenuItem("Reset teams", MenuItemType.Destructive, () =>
{ {
foreach (var p in PairingsContainer) foreach (var p in MatchesContainer)
p.Pairing.Reset(); p.Match.Reset();
}) })
}; };
} }
} }
public void Remove(MatchPairing pairing) public void Remove(TournamentMatch match)
{ {
PairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove(); MatchesContainer.FirstOrDefault(p => p.Match == match)?.Remove();
} }
private class JoinVisualiser : CompositeDrawable private class JoinVisualiser : CompositeDrawable
{ {
private readonly Container<DrawableMatchPairing> pairingsContainer; private readonly Container<DrawableTournamentMatch> matchesContainer;
public readonly MatchPairing Source; public readonly TournamentMatch Source;
private readonly bool losers; private readonly bool losers;
private readonly Action complete; private readonly Action complete;
private ProgressionPath path; private ProgressionPath path;
public JoinVisualiser(Container<DrawableMatchPairing> pairingsContainer, MatchPairing source, bool losers, Action complete) public JoinVisualiser(Container<DrawableTournamentMatch> matchesContainer, TournamentMatch source, bool losers, Action complete)
{ {
this.pairingsContainer = pairingsContainer; this.matchesContainer = matchesContainer;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Source = source; Source = source;
@ -95,9 +95,9 @@ namespace osu.Game.Tournament.Screens.Editors
Source.Progression.Value = null; Source.Progression.Value = null;
} }
private DrawableMatchPairing findTarget(InputState state) private DrawableTournamentMatch findTarget(InputState state)
{ {
return pairingsContainer.FirstOrDefault(d => d.ReceivePositionalInputAt(state.Mouse.Position)); return matchesContainer.FirstOrDefault(d => d.ReceivePositionalInputAt(state.Mouse.Position));
} }
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
@ -118,7 +118,7 @@ namespace osu.Game.Tournament.Screens.Editors
if (found == null) if (found == null)
return false; return false;
AddInternal(path = new ProgressionPath(pairingsContainer.First(c => c.Pairing == Source), found) AddInternal(path = new ProgressionPath(matchesContainer.First(c => c.Match == Source), found)
{ {
Colour = Color4.Yellow, Colour = Color4.Yellow,
}); });
@ -132,12 +132,12 @@ namespace osu.Game.Tournament.Screens.Editors
if (found != null) if (found != null)
{ {
if (found.Pairing != Source) if (found.Match != Source)
{ {
if (losers) if (losers)
Source.LosersProgression.Value = found.Pairing; Source.LosersProgression.Value = found.Match;
else else
Source.Progression.Value = found.Pairing; Source.Progression.Value = found.Match;
} }
complete?.Invoke(); complete?.Invoke();

View File

@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private readonly Color4 red = new Color4(129, 68, 65, 255); private readonly Color4 red = new Color4(129, 68, 65, 255);
private readonly Color4 blue = new Color4(41, 91, 97, 255); private readonly Color4 blue = new Color4(41, 91, 97, 255);
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>(); private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>();
private readonly Bindable<int?> currentTeamScore = new Bindable<int?>(); private readonly Bindable<int?> currentTeamScore = new Bindable<int?>();
@ -74,7 +74,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
} }
private void matchChanged(ValueChangedEvent<MatchPairing> match) private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
currentTeamScore.UnbindBindings(); currentTeamScore.UnbindBindings();
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score); currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score);
@ -187,7 +187,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private class RoundDisplay : CompositeDrawable private class RoundDisplay : CompositeDrawable
{ {
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
public RoundDisplay() public RoundDisplay()
{ {
@ -204,7 +204,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
} }
private void matchChanged(ValueChangedEvent<MatchPairing> match) private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {

View File

@ -23,7 +23,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
{ {
private readonly BindableBool warmup = new BindableBool(); private readonly BindableBool warmup = new BindableBool();
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
public readonly Bindable<TourneyState> State = new Bindable<TourneyState>(); public readonly Bindable<TourneyState> State = new Bindable<TourneyState>();
private TriangleButton warmupButton; private TriangleButton warmupButton;

View File

@ -6,9 +6,9 @@ using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Screens.Ladder.Components namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
/// <summary> /// <summary>
/// A pairing that may not necessarily occur. /// A match that may not necessarily occur.
/// </summary> /// </summary>
public class ConditionalMatchPairing : MatchPairing public class ConditionalTournamentMatch : TournamentMatch
{ {
} }
} }

View File

@ -17,14 +17,14 @@ using SixLabors.Primitives;
namespace osu.Game.Tournament.Screens.Ladder.Components namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
public class DrawableMatchPairing : CompositeDrawable public class DrawableTournamentMatch : CompositeDrawable
{ {
public readonly MatchPairing Pairing; public readonly TournamentMatch Match;
private readonly bool editor; private readonly bool editor;
protected readonly FillFlowContainer<DrawableMatchTeam> Flow; protected readonly FillFlowContainer<DrawableMatchTeam> Flow;
private readonly Drawable selectionBox; private readonly Drawable selectionBox;
private readonly Drawable currentMatchSelectionBox; private readonly Drawable currentMatchSelectionBox;
private Bindable<MatchPairing> globalSelection; private Bindable<TournamentMatch> globalSelection;
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private LadderEditorInfo editorInfo { get; set; } private LadderEditorInfo editorInfo { get; set; }
@ -32,9 +32,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private LadderInfo ladderInfo { get; set; } private LadderInfo ladderInfo { get; set; }
public DrawableMatchPairing(MatchPairing pairing, bool editor = false) public DrawableTournamentMatch(TournamentMatch match, bool editor = false)
{ {
Pairing = pairing; Match = match;
this.editor = editor; this.editor = editor;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
@ -75,25 +75,25 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
} }
}; };
boundReference(pairing.Team1).BindValueChanged(_ => updateTeams()); boundReference(match.Team1).BindValueChanged(_ => updateTeams());
boundReference(pairing.Team2).BindValueChanged(_ => updateTeams()); boundReference(match.Team2).BindValueChanged(_ => updateTeams());
boundReference(pairing.Team1Score).BindValueChanged(_ => updateWinConditions()); boundReference(match.Team1Score).BindValueChanged(_ => updateWinConditions());
boundReference(pairing.Team2Score).BindValueChanged(_ => updateWinConditions()); boundReference(match.Team2Score).BindValueChanged(_ => updateWinConditions());
boundReference(pairing.Round).BindValueChanged(_ => boundReference(match.Round).BindValueChanged(_ =>
{ {
updateWinConditions(); updateWinConditions();
Changed?.Invoke(); Changed?.Invoke();
}); });
boundReference(pairing.Completed).BindValueChanged(_ => updateProgression()); boundReference(match.Completed).BindValueChanged(_ => updateProgression());
boundReference(pairing.Progression).BindValueChanged(_ => updateProgression()); boundReference(match.Progression).BindValueChanged(_ => updateProgression());
boundReference(pairing.LosersProgression).BindValueChanged(_ => updateProgression()); boundReference(match.LosersProgression).BindValueChanged(_ => updateProgression());
boundReference(pairing.Losers).BindValueChanged(_ => boundReference(match.Losers).BindValueChanged(_ =>
{ {
updateTeams(); updateTeams();
Changed?.Invoke(); Changed?.Invoke();
}); });
boundReference(pairing.Current).BindValueChanged(_ => updateCurrentMatch(), true); boundReference(match.Current).BindValueChanged(_ => updateCurrentMatch(), true);
boundReference(pairing.Position).BindValueChanged(pos => boundReference(match.Position).BindValueChanged(pos =>
{ {
if (!IsDragged) if (!IsDragged)
Position = new Vector2(pos.NewValue.X, pos.NewValue.Y); Position = new Vector2(pos.NewValue.X, pos.NewValue.Y);
@ -127,7 +127,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateCurrentMatch() private void updateCurrentMatch()
{ {
if (Pairing.Current.Value) if (Match.Current.Value)
currentMatchSelectionBox.Show(); currentMatchSelectionBox.Show();
else else
currentMatchSelectionBox.Hide(); currentMatchSelectionBox.Hide();
@ -149,9 +149,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
selectionBox.Show(); selectionBox.Show();
if (editor) if (editor)
editorInfo.Selected.Value = Pairing; editorInfo.Selected.Value = Match;
else else
ladderInfo.CurrentMatch.Value = Pairing; ladderInfo.CurrentMatch.Value = Match;
} }
else else
selectionBox.Hide(); selectionBox.Hide();
@ -160,36 +160,36 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateProgression() private void updateProgression()
{ {
if (!Pairing.Completed.Value) if (!Match.Completed.Value)
{ {
// ensure we clear any of our teams from our progression. // ensure we clear any of our teams from our progression.
// this is not pretty logic but should suffice for now. // this is not pretty logic but should suffice for now.
if (Pairing.Progression.Value != null && Pairing.Progression.Value.Team1.Value == Pairing.Team1.Value) if (Match.Progression.Value != null && Match.Progression.Value.Team1.Value == Match.Team1.Value)
Pairing.Progression.Value.Team1.Value = null; Match.Progression.Value.Team1.Value = null;
if (Pairing.Progression.Value != null && Pairing.Progression.Value.Team2.Value == Pairing.Team2.Value) if (Match.Progression.Value != null && Match.Progression.Value.Team2.Value == Match.Team2.Value)
Pairing.Progression.Value.Team2.Value = null; Match.Progression.Value.Team2.Value = null;
if (Pairing.LosersProgression.Value != null && Pairing.LosersProgression.Value.Team1.Value == Pairing.Team1.Value) if (Match.LosersProgression.Value != null && Match.LosersProgression.Value.Team1.Value == Match.Team1.Value)
Pairing.LosersProgression.Value.Team1.Value = null; Match.LosersProgression.Value.Team1.Value = null;
if (Pairing.LosersProgression.Value != null && Pairing.LosersProgression.Value.Team2.Value == Pairing.Team2.Value) if (Match.LosersProgression.Value != null && Match.LosersProgression.Value.Team2.Value == Match.Team2.Value)
Pairing.LosersProgression.Value.Team2.Value = null; Match.LosersProgression.Value.Team2.Value = null;
} }
else else
{ {
transferProgression(Pairing.Progression?.Value, Pairing.Winner); transferProgression(Match.Progression?.Value, Match.Winner);
transferProgression(Pairing.LosersProgression?.Value, Pairing.Loser); transferProgression(Match.LosersProgression?.Value, Match.Loser);
} }
Changed?.Invoke(); Changed?.Invoke();
} }
private void transferProgression(MatchPairing destination, TournamentTeam team) private void transferProgression(TournamentMatch destination, TournamentTeam team)
{ {
if (destination == null) return; if (destination == null) return;
bool progressionAbove = destination.ID < Pairing.ID; bool progressionAbove = destination.ID < Match.ID;
Bindable<TournamentTeam> destinationTeam; Bindable<TournamentTeam> destinationTeam;
@ -210,12 +210,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateWinConditions() private void updateWinConditions()
{ {
if (Pairing.Round.Value == null) return; if (Match.Round.Value == null) return;
var instaWinAmount = Pairing.Round.Value.BestOf.Value / 2; var instaWinAmount = Match.Round.Value.BestOf.Value / 2;
Pairing.Completed.Value = Pairing.Round.Value.BestOf.Value > 0 Match.Completed.Value = Match.Round.Value.BestOf.Value > 0
&& (Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.Round.Value.BestOf.Value || Pairing.Team1Score.Value > instaWinAmount || Pairing.Team2Score.Value > instaWinAmount); && (Match.Team1Score.Value + Match.Team2Score.Value >= Match.Round.Value.BestOf.Value || Match.Team1Score.Value > instaWinAmount || Match.Team2Score.Value > instaWinAmount);
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -228,7 +228,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
globalSelection = editorInfo.Selected.GetBoundCopy(); globalSelection = editorInfo.Selected.GetBoundCopy();
globalSelection.BindValueChanged(s => globalSelection.BindValueChanged(s =>
{ {
if (s.NewValue != Pairing) Selected = false; if (s.NewValue != Match) Selected = false;
}); });
} }
} }
@ -240,25 +240,25 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
// todo: teams may need to be bindable for transitions at a later point. // todo: teams may need to be bindable for transitions at a later point.
if (Pairing.Team1.Value == null || Pairing.Team2.Value == null) if (Match.Team1.Value == null || Match.Team2.Value == null)
Pairing.CancelMatchStart(); Match.CancelMatchStart();
if (Pairing.ConditionalPairings.Count > 0) if (Match.ConditionalMatches.Count > 0)
{ {
foreach (var conditional in Pairing.ConditionalPairings) foreach (var conditional in Match.ConditionalMatches)
{ {
var team1Match = conditional.Acronyms.Contains(Pairing.Team1Acronym); var team1Match = conditional.Acronyms.Contains(Match.Team1Acronym);
var team2Match = conditional.Acronyms.Contains(Pairing.Team2Acronym); var team2Match = conditional.Acronyms.Contains(Match.Team2Acronym);
if (team1Match && team2Match) if (team1Match && team2Match)
Pairing.Date.Value = conditional.Date.Value; Match.Date.Value = conditional.Date.Value;
} }
} }
Flow.Children = new[] Flow.Children = new[]
{ {
new DrawableMatchTeam(Pairing.Team1.Value, Pairing, Pairing.Losers.Value), new DrawableMatchTeam(Match.Team1.Value, Match, Match.Losers.Value),
new DrawableMatchTeam(Pairing.Team2.Value, Pairing, Pairing.Losers.Value) new DrawableMatchTeam(Match.Team2.Value, Match, Match.Losers.Value)
}; };
SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression)); SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression));
@ -282,7 +282,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)
{ {
if (editorInfo == null || Pairing is ConditionalMatchPairing) if (editorInfo == null || Match is ConditionalTournamentMatch)
return false; return false;
Selected = true; Selected = true;
@ -297,17 +297,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
this.MoveToOffset(e.Delta); this.MoveToOffset(e.Delta);
var pos = Position; var pos = Position;
Pairing.Position.Value = new Point((int)pos.X, (int)pos.Y); Match.Position.Value = new Point((int)pos.X, (int)pos.Y);
return true; return true;
} }
public void Remove() public void Remove()
{ {
Selected = false; Selected = false;
Pairing.Progression.Value = null; Match.Progression.Value = null;
Pairing.LosersProgression.Value = null; Match.LosersProgression.Value = null;
ladderInfo.Pairings.Remove(Pairing); ladderInfo.Matches.Remove(Match);
} }
} }
} }

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
public class DrawableMatchTeam : DrawableTournamentTeam, IHasContextMenu public class DrawableMatchTeam : DrawableTournamentTeam, IHasContextMenu
{ {
private readonly MatchPairing pairing; private readonly TournamentMatch match;
private readonly bool losers; private readonly bool losers;
private OsuSpriteText scoreText; private OsuSpriteText scoreText;
private Box background; private Box background;
@ -47,17 +47,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
if (ladderInfo.CurrentMatch.Value != null) if (ladderInfo.CurrentMatch.Value != null)
ladderInfo.CurrentMatch.Value.Current.Value = false; ladderInfo.CurrentMatch.Value.Current.Value = false;
ladderInfo.CurrentMatch.Value = pairing; ladderInfo.CurrentMatch.Value = match;
ladderInfo.CurrentMatch.Value.Current.Value = true; ladderInfo.CurrentMatch.Value.Current.Value = true;
} }
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private LadderEditorInfo editorInfo { get; set; } private LadderEditorInfo editorInfo { get; set; }
public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing, bool losers) public DrawableMatchTeam(TournamentTeam team, TournamentMatch match, bool losers)
: base(team) : base(team)
{ {
this.pairing = pairing; this.match = match;
this.losers = losers; this.losers = losers;
Size = new Vector2(150, 40); Size = new Vector2(150, 40);
@ -71,13 +71,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
AcronymText.Padding = new MarginPadding { Left = 50 }; AcronymText.Padding = new MarginPadding { Left = 50 };
AcronymText.Font = OsuFont.GetFont(size: 24); AcronymText.Font = OsuFont.GetFont(size: 24);
if (pairing != null) if (match != null)
{ {
isWinner = () => pairing.Winner == Team; isWinner = () => match.Winner == Team;
completed.BindTo(pairing.Completed); completed.BindTo(match.Completed);
if (team != null) if (team != null)
score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); score.BindTo(team == match.Team1.Value ? match.Team1Score : match.Team2Score);
} }
} }
@ -144,7 +144,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
if (Team == null || editorInfo != null) return false; if (Team == null || editorInfo != null) return false;
if (!pairing.Current.Value) if (!match.Current.Value)
{ {
setCurrent(); setCurrent();
return true; return true;
@ -154,25 +154,25 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
if (score.Value == null) if (score.Value == null)
{ {
pairing.StartMatch(); match.StartMatch();
} }
else if (!pairing.Completed.Value) else if (!match.Completed.Value)
score.Value++; score.Value++;
} }
else else
{ {
if (pairing.Progression.Value?.Completed.Value == true) if (match.Progression.Value?.Completed.Value == true)
// don't allow changing scores if the match has a progression. can cause large data loss // don't allow changing scores if the match has a progression. can cause large data loss
return false; return false;
if (pairing.Completed.Value && pairing.Winner != Team) if (match.Completed.Value && match.Winner != Team)
// don't allow changing scores from the non-winner // don't allow changing scores from the non-winner
return false; return false;
if (score.Value > 0) if (score.Value > 0)
score.Value--; score.Value--;
else else
pairing.CancelMatchStart(); match.CancelMatchStart();
} }
return false; return false;
@ -197,9 +197,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
return new MenuItem[] return new MenuItem[]
{ {
new OsuMenuItem("Set as current", MenuItemType.Standard, setCurrent), new OsuMenuItem("Set as current", MenuItemType.Standard, setCurrent),
new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, false)), new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.BeginJoin(match, false)),
new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, true)), new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.BeginJoin(match, true)),
new OsuMenuItem("Remove", MenuItemType.Destructive, () => ladderEditor.Remove(pairing)), new OsuMenuItem("Remove", MenuItemType.Destructive, () => ladderEditor.Remove(match)),
}; };
} }
} }

View File

@ -10,10 +10,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
public class ProgressionPath : Path public class ProgressionPath : Path
{ {
public DrawableMatchPairing Source { get; private set; } public DrawableTournamentMatch Source { get; private set; }
public DrawableMatchPairing Destination { get; private set; } public DrawableTournamentMatch Destination { get; private set; }
public ProgressionPath(DrawableMatchPairing source, DrawableMatchPairing destination) public ProgressionPath(DrawableTournamentMatch source, DrawableTournamentMatch destination)
{ {
Source = source; Source = source;
Destination = destination; Destination = destination;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.Ladder
{ {
public class LadderScreen : TournamentScreen, IProvideVideo public class LadderScreen : TournamentScreen, IProvideVideo
{ {
protected Container<DrawableMatchPairing> PairingsContainer; protected Container<DrawableTournamentMatch> MatchesContainer;
private Container<Path> paths; private Container<Path> paths;
private Container headings; private Container headings;
@ -53,35 +53,35 @@ namespace osu.Game.Tournament.Screens.Ladder
{ {
paths = new Container<Path> { RelativeSizeAxes = Axes.Both }, paths = new Container<Path> { RelativeSizeAxes = Axes.Both },
headings = new Container { RelativeSizeAxes = Axes.Both }, headings = new Container { RelativeSizeAxes = Axes.Both },
PairingsContainer = new Container<DrawableMatchPairing> { RelativeSizeAxes = Axes.Both }, MatchesContainer = new Container<DrawableTournamentMatch> { RelativeSizeAxes = Axes.Both },
} }
}, },
} }
}; };
void addPairing(MatchPairing pairing) => void addMatch(TournamentMatch match) =>
PairingsContainer.Add(new DrawableMatchPairing(pairing, this is LadderEditorScreen) MatchesContainer.Add(new DrawableTournamentMatch(match, this is LadderEditorScreen)
{ {
Changed = () => layout.Invalidate() Changed = () => layout.Invalidate()
}); });
foreach (var pairing in LadderInfo.Pairings) foreach (var match in LadderInfo.Matches)
addPairing(pairing); addMatch(match);
LadderInfo.Rounds.ItemsAdded += _ => layout.Invalidate(); LadderInfo.Rounds.ItemsAdded += _ => layout.Invalidate();
LadderInfo.Rounds.ItemsRemoved += _ => layout.Invalidate(); LadderInfo.Rounds.ItemsRemoved += _ => layout.Invalidate();
LadderInfo.Pairings.ItemsAdded += pairings => LadderInfo.Matches.ItemsAdded += matches =>
{ {
foreach (var p in pairings) foreach (var p in matches)
addPairing(p); addMatch(p);
layout.Invalidate(); layout.Invalidate();
}; };
LadderInfo.Pairings.ItemsRemoved += pairings => LadderInfo.Matches.ItemsRemoved += matches =>
{ {
foreach (var p in pairings) foreach (var p in matches)
foreach (var d in PairingsContainer.Where(d => d.Pairing == p)) foreach (var d in MatchesContainer.Where(d => d.Match == p))
d.Expire(); d.Expire();
layout.Invalidate(); layout.Invalidate();
@ -110,45 +110,45 @@ namespace osu.Game.Tournament.Screens.Ladder
int id = 1; int id = 1;
foreach (var pairing in PairingsContainer.OrderBy(d => d.Y).ThenBy(d => d.X)) foreach (var match in MatchesContainer.OrderBy(d => d.Y).ThenBy(d => d.X))
{ {
pairing.Pairing.ID = id++; match.Match.ID = id++;
if (pairing.Pairing.Progression.Value != null) if (match.Match.Progression.Value != null)
{ {
var dest = PairingsContainer.FirstOrDefault(p => p.Pairing == pairing.Pairing.Progression.Value); var dest = MatchesContainer.FirstOrDefault(p => p.Match == match.Match.Progression.Value);
if (dest == null) if (dest == null)
// clean up outdated progressions. // clean up outdated progressions.
pairing.Pairing.Progression.Value = null; match.Match.Progression.Value = null;
else else
paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers.Value ? losersPathColour : normalPathColour }); paths.Add(new ProgressionPath(match, dest) { Colour = match.Match.Losers.Value ? losersPathColour : normalPathColour });
} }
if (DrawLoserPaths) if (DrawLoserPaths)
{ {
if (pairing.Pairing.LosersProgression.Value != null) if (match.Match.LosersProgression.Value != null)
{ {
var dest = PairingsContainer.FirstOrDefault(p => p.Pairing == pairing.Pairing.LosersProgression.Value); var dest = MatchesContainer.FirstOrDefault(p => p.Match == match.Match.LosersProgression.Value);
if (dest == null) if (dest == null)
// clean up outdated progressions. // clean up outdated progressions.
pairing.Pairing.LosersProgression.Value = null; match.Match.LosersProgression.Value = null;
else else
paths.Add(new ProgressionPath(pairing, dest) { Colour = losersPathColour.Opacity(0.1f) }); paths.Add(new ProgressionPath(match, dest) { Colour = losersPathColour.Opacity(0.1f) });
} }
} }
} }
foreach (var round in LadderInfo.Rounds) foreach (var round in LadderInfo.Rounds)
{ {
var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers.Value && p.Pairing.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); var topMatch = MatchesContainer.Where(p => !p.Match.Losers.Value && p.Match.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault();
if (topPairing == null) continue; if (topMatch == null) continue;
headings.Add(new DrawableTournamentRound(round) headings.Add(new DrawableTournamentRound(round)
{ {
Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), Position = headings.ToLocalSpace((topMatch.ScreenSpaceDrawQuad.TopLeft + topMatch.ScreenSpaceDrawQuad.TopRight) / 2),
Margin = new MarginPadding { Bottom = 10 }, Margin = new MarginPadding { Bottom = 10 },
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
}); });
@ -156,13 +156,13 @@ namespace osu.Game.Tournament.Screens.Ladder
foreach (var round in LadderInfo.Rounds) foreach (var round in LadderInfo.Rounds)
{ {
var topPairing = PairingsContainer.Where(p => p.Pairing.Losers.Value && p.Pairing.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault(); var topMatch = MatchesContainer.Where(p => p.Match.Losers.Value && p.Match.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault();
if (topPairing == null) continue; if (topMatch == null) continue;
headings.Add(new DrawableTournamentRound(round, true) headings.Add(new DrawableTournamentRound(round, true)
{ {
Position = headings.ToLocalSpace((topPairing.ScreenSpaceDrawQuad.TopLeft + topPairing.ScreenSpaceDrawQuad.TopRight) / 2), Position = headings.ToLocalSpace((topMatch.ScreenSpaceDrawQuad.TopLeft + topMatch.ScreenSpaceDrawQuad.TopRight) / 2),
Margin = new MarginPadding { Bottom = 10 }, Margin = new MarginPadding { Bottom = 10 },
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
}); });

View File

@ -26,7 +26,7 @@ namespace osu.Game.Tournament.Screens.MapPool
{ {
private readonly FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>> mapFlows; private readonly FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>> mapFlows;
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private TournamentSceneManager sceneManager { get; set; } private TournamentSceneManager sceneManager { get; set; }
@ -203,7 +203,7 @@ namespace osu.Game.Tournament.Screens.MapPool
} }
} }
private void matchChanged(ValueChangedEvent<MatchPairing> match) private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
mapFlows.Clear(); mapFlows.Clear();

View File

@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Screens.Schedule
{ {
public class ScheduleScreen : TournamentScreen, IProvideVideo public class ScheduleScreen : TournamentScreen, IProvideVideo
{ {
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private Container mainContainer; private Container mainContainer;
private LadderInfo ladder; private LadderInfo ladder;
@ -49,7 +49,7 @@ namespace osu.Game.Tournament.Screens.Schedule
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
} }
private void matchChanged(ValueChangedEvent<MatchPairing> match) private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
if (match.NewValue == null) if (match.NewValue == null)
{ {
@ -57,10 +57,10 @@ namespace osu.Game.Tournament.Screens.Schedule
return; return;
} }
var upcoming = ladder.Pairings.Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4); var upcoming = ladder.Matches.Where(p => !p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4);
var conditionals = ladder var conditionals = ladder
.Pairings.Where(p => !p.Completed.Value && (p.Team1.Value == null || p.Team2.Value == null) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) .Matches.Where(p => !p.Completed.Value && (p.Team1.Value == null || p.Team2.Value == null) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4)
.SelectMany(m => m.ConditionalPairings.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a)))); .SelectMany(m => m.ConditionalMatches.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a))));
upcoming = upcoming.Concat(conditionals); upcoming = upcoming.Concat(conditionals);
upcoming = upcoming.OrderBy(p => p.Date.Value).Take(12); upcoming = upcoming.OrderBy(p => p.Date.Value).Take(12);
@ -85,18 +85,18 @@ namespace osu.Game.Tournament.Screens.Schedule
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.4f, Width = 0.4f,
ChildrenEnumerable = ladder.Pairings ChildrenEnumerable = ladder.Matches
.Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null .Where(p => p.Completed.Value && p.Team1.Value != null && p.Team2.Value != null
&& Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4) && Math.Abs(p.Date.Value.DayOfYear - DateTimeOffset.UtcNow.DayOfYear) < 4)
.OrderByDescending(p => p.Date.Value) .OrderByDescending(p => p.Date.Value)
.Take(8) .Take(8)
.Select(p => new SchedulePairing(p)) .Select(p => new ScheduleMatch(p))
}, },
new ScheduleContainer("match overview") new ScheduleContainer("match overview")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.6f, Width = 0.6f,
ChildrenEnumerable = upcoming.Select(p => new SchedulePairing(p)) ChildrenEnumerable = upcoming.Select(p => new ScheduleMatch(p))
}, },
} }
} }
@ -115,7 +115,7 @@ namespace osu.Game.Tournament.Screens.Schedule
Colour = Color4.Black, Colour = Color4.Black,
Font = OsuFont.GetFont(size: 20) Font = OsuFont.GetFont(size: 20)
}, },
new SchedulePairing(match.NewValue, false), new ScheduleMatch(match.NewValue, false),
new OsuSpriteText new OsuSpriteText
{ {
Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"),
@ -128,21 +128,21 @@ namespace osu.Game.Tournament.Screens.Schedule
}; };
} }
public class SchedulePairing : DrawableMatchPairing public class ScheduleMatch : DrawableTournamentMatch
{ {
public SchedulePairing(MatchPairing pairing, bool showTimestamp = true) public ScheduleMatch(TournamentMatch match, bool showTimestamp = true)
: base(pairing) : base(match)
{ {
Flow.Direction = FillDirection.Horizontal; Flow.Direction = FillDirection.Horizontal;
bool conditional = pairing is ConditionalMatchPairing; bool conditional = match is ConditionalTournamentMatch;
if (conditional) if (conditional)
Colour = OsuColour.Gray(0.5f); Colour = OsuColour.Gray(0.5f);
if (showTimestamp) if (showTimestamp)
{ {
AddInternal(new DrawableDate(Pairing.Date.Value) AddInternal(new DrawableDate(Match.Date.Value)
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
@ -157,7 +157,7 @@ namespace osu.Game.Tournament.Screens.Schedule
Colour = Color4.Black, Colour = Color4.Black,
Alpha = conditional ? 0.6f : 1, Alpha = conditional ? 0.6f : 1,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
Text = pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "") Text = match.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "")
}); });
} }
} }

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
{ {
private Container mainContainer; private Container mainContainer;
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(Storage storage) private void load(Storage storage)
@ -45,9 +45,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro
currentMatch.BindTo(LadderInfo.CurrentMatch); currentMatch.BindTo(LadderInfo.CurrentMatch);
} }
private void matchChanged(ValueChangedEvent<MatchPairing> pairing) private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
if (pairing.NewValue == null) if (match.NewValue == null)
{ {
mainContainer.Clear(); mainContainer.Clear();
return; return;
@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
mainContainer.Children = new Drawable[] mainContainer.Children = new Drawable[]
{ {
new TeamWithPlayers(pairing.NewValue.Team1.Value, true) new TeamWithPlayers(match.NewValue.Team1.Value, true)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
@ -63,7 +63,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.CentreRight Origin = Anchor.CentreRight
}, },
new TeamWithPlayers(pairing.NewValue.Team2.Value) new TeamWithPlayers(match.NewValue.Team2.Value)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
@ -71,7 +71,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft Origin = Anchor.CentreLeft
}, },
new RoundDisplay(pairing.NewValue) new RoundDisplay(match.NewValue)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.25f, Height = 0.25f,
@ -83,7 +83,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
private class RoundDisplay : CompositeDrawable private class RoundDisplay : CompositeDrawable
{ {
public RoundDisplay(MatchPairing pairing) public RoundDisplay(TournamentMatch match)
{ {
var col = OsuColour.Gray(0.33f); var col = OsuColour.Gray(0.33f);
@ -112,7 +112,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Colour = col, Colour = col,
Text = pairing.Round.Value?.Name.Value ?? "Unknown Round", Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light) Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light)
}, },
@ -121,7 +121,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Colour = col, Colour = col,
Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), Text = match.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"),
Font = OsuFont.GetFont(size: 20) Font = OsuFont.GetFont(size: 20)
}, },
} }

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
{ {
private Container mainContainer; private Container mainContainer;
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private readonly Bindable<bool> currentCompleted = new Bindable<bool>(); private readonly Bindable<bool> currentCompleted = new Bindable<bool>();
private TourneyVideo blueWinVideo; private TourneyVideo blueWinVideo;
@ -61,31 +61,31 @@ namespace osu.Game.Tournament.Screens.TeamWin
currentCompleted.BindValueChanged(_ => update()); currentCompleted.BindValueChanged(_ => update());
} }
private void matchChanged(ValueChangedEvent<MatchPairing> pairing) private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
currentCompleted.UnbindBindings(); currentCompleted.UnbindBindings();
currentCompleted.BindTo(pairing.NewValue.Completed); currentCompleted.BindTo(match.NewValue.Completed);
update(); update();
} }
private void update() private void update()
{ {
var pairing = currentMatch.Value; var match = currentMatch.Value;
if (pairing.Winner == null) if (match.Winner == null)
{ {
mainContainer.Clear(); mainContainer.Clear();
return; return;
} }
bool redWin = pairing.Winner == pairing.Team1.Value; bool redWin = match.Winner == match.Team1.Value;
redWinVideo.Alpha = redWin ? 1 : 0; redWinVideo.Alpha = redWin ? 1 : 0;
blueWinVideo.Alpha = redWin ? 0 : 1; blueWinVideo.Alpha = redWin ? 0 : 1;
mainContainer.Children = new Drawable[] mainContainer.Children = new Drawable[]
{ {
new TeamWithPlayers(pairing.Winner, redWin) new TeamWithPlayers(match.Winner, redWin)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
@ -93,7 +93,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre
}, },
new RoundDisplay(pairing) new RoundDisplay(match)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.25f, Height = 0.25f,
@ -105,7 +105,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
private class RoundDisplay : CompositeDrawable private class RoundDisplay : CompositeDrawable
{ {
public RoundDisplay(MatchPairing pairing) public RoundDisplay(TournamentMatch match)
{ {
var col = OsuColour.Gray(0.33f); var col = OsuColour.Gray(0.33f);
@ -133,7 +133,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Colour = col, Colour = col,
Text = pairing.Round.Value?.Name.Value ?? "Unknown Round", Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 50, FontWeight.Light), Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 50, FontWeight.Light),
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
}, },
@ -142,7 +142,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Colour = col, Colour = col,
Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"), Text = match.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"),
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Light), Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Light),
}, },
} }

View File

@ -61,7 +61,7 @@ namespace osu.Game.Tournament
readBracket(); readBracket();
ladder.CurrentMatch.Value = ladder.Pairings.FirstOrDefault(p => p.Current.Value); ladder.CurrentMatch.Value = ladder.Matches.FirstOrDefault(p => p.Current.Value);
dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC()); dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC());
Add(ipc); Add(ipc);
@ -97,24 +97,24 @@ namespace osu.Game.Tournament
bool addedInfo = false; bool addedInfo = false;
// assign teams // assign teams
foreach (var pairing in ladder.Pairings) foreach (var match in ladder.Matches)
{ {
pairing.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == pairing.Team1Acronym); match.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == match.Team1Acronym);
pairing.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == pairing.Team2Acronym); match.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == match.Team2Acronym);
foreach (var conditional in pairing.ConditionalPairings) foreach (var conditional in match.ConditionalMatches)
{ {
conditional.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == conditional.Team1Acronym); conditional.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == conditional.Team1Acronym);
conditional.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == conditional.Team2Acronym); conditional.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == conditional.Team2Acronym);
conditional.Round.Value = pairing.Round.Value; conditional.Round.Value = match.Round.Value;
} }
} }
// assign progressions // assign progressions
foreach (var pair in ladder.Progressions) foreach (var pair in ladder.Progressions)
{ {
var src = ladder.Pairings.FirstOrDefault(p => p.ID == pair.SourceID); var src = ladder.Matches.FirstOrDefault(p => p.ID == pair.SourceID);
var dest = ladder.Pairings.FirstOrDefault(p => p.ID == pair.TargetID); var dest = ladder.Matches.FirstOrDefault(p => p.ID == pair.TargetID);
if (src == null) throw new InvalidOperationException(); if (src == null) throw new InvalidOperationException();
@ -127,11 +127,11 @@ namespace osu.Game.Tournament
} }
} }
// link pairings to rounds // link matches to rounds
foreach (var round in ladder.Rounds) foreach (var round in ladder.Rounds)
foreach (var id in round.Pairings) foreach (var id in round.Matches)
{ {
var found = ladder.Pairings.FirstOrDefault(p => p.ID == id); var found = ladder.Matches.FirstOrDefault(p => p.ID == id);
if (found != null) if (found != null)
{ {
@ -245,10 +245,10 @@ namespace osu.Game.Tournament
protected virtual void SaveChanges() protected virtual void SaveChanges()
{ {
foreach (var r in ladder.Rounds) foreach (var r in ladder.Rounds)
r.Pairings = ladder.Pairings.Where(p => p.Round.Value == r).Select(p => p.ID).ToList(); r.Matches = ladder.Matches.Where(p => p.Round.Value == r).Select(p => p.ID).ToList();
ladder.Progressions = ladder.Pairings.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat( ladder.Progressions = ladder.Matches.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat(
ladder.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true))) ladder.Matches.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true)))
.ToList(); .ToList();
using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create)) using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create))