1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +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
{
public class TestSceneMatchPairings : OsuTestScene
public class TestSceneMatches : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(MatchPairing),
typeof(DrawableMatchPairing),
typeof(TournamentMatch),
typeof(DrawableTournamentMatch),
typeof(DrawableMatchTeam),
typeof(DrawableTournamentTeam),
};
public TestSceneMatchPairings()
public TestSceneMatches()
{
Container<DrawableMatchPairing> level1;
Container<DrawableMatchPairing> level2;
Container<DrawableTournamentMatch> level1;
Container<DrawableTournamentMatch> level2;
var pairing1 = new MatchPairing(
var match1 = new TournamentMatch(
new TournamentTeam { FlagName = { Value = "AU" }, FullName = { Value = "Australia" }, },
new TournamentTeam { FlagName = { Value = "JP" }, FullName = { Value = "Japan" }, Acronym = { Value = "JPN" } })
{
@ -35,7 +35,7 @@ namespace osu.Game.Tournament.Tests
Team2Score = { Value = 1 },
};
var pairing2 = new MatchPairing(
var match2 = new TournamentMatch(
new TournamentTeam
{
FlagName = { Value = "RO" },
@ -49,47 +49,47 @@ namespace osu.Game.Tournament.Tests
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
level1 = new FillFlowContainer<DrawableMatchPairing>
level1 = new FillFlowContainer<DrawableTournamentMatch>
{
AutoSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new[]
{
new DrawableMatchPairing(pairing1),
new DrawableMatchPairing(pairing2),
new DrawableMatchPairing(new MatchPairing()),
new DrawableTournamentMatch(match1),
new DrawableTournamentMatch(match2),
new DrawableTournamentMatch(new TournamentMatch()),
}
},
level2 = new FillFlowContainer<DrawableMatchPairing>
level2 = new FillFlowContainer<DrawableTournamentMatch>
{
AutoSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Margin = new MarginPadding(20),
Children = new[]
{
new DrawableMatchPairing(new MatchPairing()),
new DrawableMatchPairing(new MatchPairing())
new DrawableTournamentMatch(new TournamentMatch()),
new DrawableTournamentMatch(new TournamentMatch())
}
}
}
};
level1.Children[0].Pairing.Progression.Value = level2.Children[0].Pairing;
level1.Children[1].Pairing.Progression.Value = level2.Children[0].Pairing;
level1.Children[0].Match.Progression.Value = level2.Children[0].Match;
level1.Children[1].Match.Progression.Value = level2.Children[0].Match;
AddRepeatStep("change scores", () => pairing1.Team2Score.Value++, 4);
AddStep("add new team", () => pairing2.Team2.Value = new TournamentTeam { FlagName = { Value = "PT" }, FullName = { Value = "Portugal" } });
AddStep("Add progression", () => level1.Children[2].Pairing.Progression.Value = level2.Children[1].Pairing);
AddRepeatStep("change scores", () => match1.Team2Score.Value++, 4);
AddStep("add new team", () => match2.Team2.Value = new TournamentTeam { FlagName = { Value = "PT" }, FullName = { Value = "Portugal" } });
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
{
[Cached]
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>();
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
[BackgroundDependencyLoader]
private void load()
{
var pairing = new MatchPairing();
pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA");
pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN");
pairing.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals");
currentMatch.Value = pairing;
var match = new TournamentMatch();
match.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "USA");
match.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym.Value == "JPN");
match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals");
currentMatch.Value = match;
Add(new TeamIntroScreen
{

View File

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

View File

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

View File

@ -32,7 +32,7 @@ namespace osu.Game.Tournament.Components
public const float HEIGHT = 50;
private readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>();
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private Box flash;
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)
pairing.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged;
pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
if (match.OldValue != null)
match.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged;
match.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
updateState();
}

View File

@ -7,6 +7,6 @@ namespace osu.Game.Tournament.Models
{
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 BindableList<MatchPairing> Pairings = new BindableList<MatchPairing>();
public BindableList<TournamentMatch> Matches = new BindableList<TournamentMatch>();
public BindableList<TournamentRound> Rounds = new BindableList<TournamentRound>();
public BindableList<TournamentTeam> Teams = new BindableList<TournamentTeam>();
@ -17,6 +17,6 @@ namespace osu.Game.Tournament.Models
public List<TournamentProgression> Progressions = new List<TournamentProgression>();
[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.
/// </summary>
[Serializable]
public class MatchPairing
public class TournamentMatch
{
public int ID;
@ -54,10 +54,10 @@ namespace osu.Game.Tournament.Models
public readonly Bindable<TournamentRound> Round = new Bindable<TournamentRound>();
[JsonIgnore]
public readonly Bindable<MatchPairing> Progression = new Bindable<MatchPairing>();
public readonly Bindable<TournamentMatch> Progression = new Bindable<TournamentMatch>();
[JsonIgnore]
public readonly Bindable<MatchPairing> LosersProgression = new Bindable<MatchPairing>();
public readonly Bindable<TournamentMatch> LosersProgression = new Bindable<TournamentMatch>();
/// <summary>
/// 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>();
[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 MatchPairing()
public TournamentMatch()
{
Team1.BindValueChanged(t => Team1Acronym = 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()
{
Team1.Value = team1;

View File

@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Models
public readonly Bindable<DateTimeOffset> StartDate = new Bindable<DateTimeOffset>();
// 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";
}

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
@ -55,35 +55,35 @@ namespace osu.Game.Tournament.Screens.Editors
{
new OsuMenuItem("Create new match", MenuItemType.Highlighted, () =>
{
var pos = PairingsContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position);
LadderInfo.Pairings.Add(new MatchPairing { Position = { Value = new Point((int)pos.X, (int)pos.Y) } });
var pos = MatchesContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position);
LadderInfo.Matches.Add(new TournamentMatch { Position = { Value = new Point((int)pos.X, (int)pos.Y) } });
}),
new OsuMenuItem("Reset teams", MenuItemType.Destructive, () =>
{
foreach (var p in PairingsContainer)
p.Pairing.Reset();
foreach (var p in MatchesContainer)
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 readonly Container<DrawableMatchPairing> pairingsContainer;
public readonly MatchPairing Source;
private readonly Container<DrawableTournamentMatch> matchesContainer;
public readonly TournamentMatch Source;
private readonly bool losers;
private readonly Action complete;
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;
Source = source;
@ -95,9 +95,9 @@ namespace osu.Game.Tournament.Screens.Editors
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)
@ -118,7 +118,7 @@ namespace osu.Game.Tournament.Screens.Editors
if (found == null)
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,
});
@ -132,12 +132,12 @@ namespace osu.Game.Tournament.Screens.Editors
if (found != null)
{
if (found.Pairing != Source)
if (found.Match != Source)
{
if (losers)
Source.LosersProgression.Value = found.Pairing;
Source.LosersProgression.Value = found.Match;
else
Source.Progression.Value = found.Pairing;
Source.Progression.Value = found.Match;
}
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 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<int?> currentTeamScore = new Bindable<int?>();
@ -74,7 +74,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentMatch.BindTo(ladder.CurrentMatch);
}
private void matchChanged(ValueChangedEvent<MatchPairing> match)
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{
currentTeamScore.UnbindBindings();
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 readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>();
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
public RoundDisplay()
{
@ -204,7 +204,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentMatch.BindTo(ladder.CurrentMatch);
}
private void matchChanged(ValueChangedEvent<MatchPairing> match)
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{
InternalChildren = new Drawable[]
{

View File

@ -23,7 +23,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
{
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>();
private TriangleButton warmupButton;

View File

@ -6,9 +6,9 @@ using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Screens.Ladder.Components
{
/// <summary>
/// A pairing that may not necessarily occur.
/// A match that may not necessarily occur.
/// </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
{
public class DrawableMatchPairing : CompositeDrawable
public class DrawableTournamentMatch : CompositeDrawable
{
public readonly MatchPairing Pairing;
public readonly TournamentMatch Match;
private readonly bool editor;
protected readonly FillFlowContainer<DrawableMatchTeam> Flow;
private readonly Drawable selectionBox;
private readonly Drawable currentMatchSelectionBox;
private Bindable<MatchPairing> globalSelection;
private Bindable<TournamentMatch> globalSelection;
[Resolved(CanBeNull = true)]
private LadderEditorInfo editorInfo { get; set; }
@ -32,9 +32,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
[Resolved(CanBeNull = true)]
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;
AutoSizeAxes = Axes.Both;
@ -75,25 +75,25 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
}
};
boundReference(pairing.Team1).BindValueChanged(_ => updateTeams());
boundReference(pairing.Team2).BindValueChanged(_ => updateTeams());
boundReference(pairing.Team1Score).BindValueChanged(_ => updateWinConditions());
boundReference(pairing.Team2Score).BindValueChanged(_ => updateWinConditions());
boundReference(pairing.Round).BindValueChanged(_ =>
boundReference(match.Team1).BindValueChanged(_ => updateTeams());
boundReference(match.Team2).BindValueChanged(_ => updateTeams());
boundReference(match.Team1Score).BindValueChanged(_ => updateWinConditions());
boundReference(match.Team2Score).BindValueChanged(_ => updateWinConditions());
boundReference(match.Round).BindValueChanged(_ =>
{
updateWinConditions();
Changed?.Invoke();
});
boundReference(pairing.Completed).BindValueChanged(_ => updateProgression());
boundReference(pairing.Progression).BindValueChanged(_ => updateProgression());
boundReference(pairing.LosersProgression).BindValueChanged(_ => updateProgression());
boundReference(pairing.Losers).BindValueChanged(_ =>
boundReference(match.Completed).BindValueChanged(_ => updateProgression());
boundReference(match.Progression).BindValueChanged(_ => updateProgression());
boundReference(match.LosersProgression).BindValueChanged(_ => updateProgression());
boundReference(match.Losers).BindValueChanged(_ =>
{
updateTeams();
Changed?.Invoke();
});
boundReference(pairing.Current).BindValueChanged(_ => updateCurrentMatch(), true);
boundReference(pairing.Position).BindValueChanged(pos =>
boundReference(match.Current).BindValueChanged(_ => updateCurrentMatch(), true);
boundReference(match.Position).BindValueChanged(pos =>
{
if (!IsDragged)
Position = new Vector2(pos.NewValue.X, pos.NewValue.Y);
@ -127,7 +127,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateCurrentMatch()
{
if (Pairing.Current.Value)
if (Match.Current.Value)
currentMatchSelectionBox.Show();
else
currentMatchSelectionBox.Hide();
@ -149,9 +149,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{
selectionBox.Show();
if (editor)
editorInfo.Selected.Value = Pairing;
editorInfo.Selected.Value = Match;
else
ladderInfo.CurrentMatch.Value = Pairing;
ladderInfo.CurrentMatch.Value = Match;
}
else
selectionBox.Hide();
@ -160,36 +160,36 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateProgression()
{
if (!Pairing.Completed.Value)
if (!Match.Completed.Value)
{
// ensure we clear any of our teams from our progression.
// this is not pretty logic but should suffice for now.
if (Pairing.Progression.Value != null && Pairing.Progression.Value.Team1.Value == Pairing.Team1.Value)
Pairing.Progression.Value.Team1.Value = null;
if (Match.Progression.Value != null && Match.Progression.Value.Team1.Value == Match.Team1.Value)
Match.Progression.Value.Team1.Value = null;
if (Pairing.Progression.Value != null && Pairing.Progression.Value.Team2.Value == Pairing.Team2.Value)
Pairing.Progression.Value.Team2.Value = null;
if (Match.Progression.Value != null && Match.Progression.Value.Team2.Value == Match.Team2.Value)
Match.Progression.Value.Team2.Value = null;
if (Pairing.LosersProgression.Value != null && Pairing.LosersProgression.Value.Team1.Value == Pairing.Team1.Value)
Pairing.LosersProgression.Value.Team1.Value = null;
if (Match.LosersProgression.Value != null && Match.LosersProgression.Value.Team1.Value == Match.Team1.Value)
Match.LosersProgression.Value.Team1.Value = null;
if (Pairing.LosersProgression.Value != null && Pairing.LosersProgression.Value.Team2.Value == Pairing.Team2.Value)
Pairing.LosersProgression.Value.Team2.Value = null;
if (Match.LosersProgression.Value != null && Match.LosersProgression.Value.Team2.Value == Match.Team2.Value)
Match.LosersProgression.Value.Team2.Value = null;
}
else
{
transferProgression(Pairing.Progression?.Value, Pairing.Winner);
transferProgression(Pairing.LosersProgression?.Value, Pairing.Loser);
transferProgression(Match.Progression?.Value, Match.Winner);
transferProgression(Match.LosersProgression?.Value, Match.Loser);
}
Changed?.Invoke();
}
private void transferProgression(MatchPairing destination, TournamentTeam team)
private void transferProgression(TournamentMatch destination, TournamentTeam team)
{
if (destination == null) return;
bool progressionAbove = destination.ID < Pairing.ID;
bool progressionAbove = destination.ID < Match.ID;
Bindable<TournamentTeam> destinationTeam;
@ -210,12 +210,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
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
&& (Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.Round.Value.BestOf.Value || Pairing.Team1Score.Value > instaWinAmount || Pairing.Team2Score.Value > instaWinAmount);
Match.Completed.Value = Match.Round.Value.BestOf.Value > 0
&& (Match.Team1Score.Value + Match.Team2Score.Value >= Match.Round.Value.BestOf.Value || Match.Team1Score.Value > instaWinAmount || Match.Team2Score.Value > instaWinAmount);
}
protected override void LoadComplete()
@ -228,7 +228,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
globalSelection = editorInfo.Selected.GetBoundCopy();
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.
if (Pairing.Team1.Value == null || Pairing.Team2.Value == null)
Pairing.CancelMatchStart();
if (Match.Team1.Value == null || Match.Team2.Value == null)
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 team2Match = conditional.Acronyms.Contains(Pairing.Team2Acronym);
var team1Match = conditional.Acronyms.Contains(Match.Team1Acronym);
var team2Match = conditional.Acronyms.Contains(Match.Team2Acronym);
if (team1Match && team2Match)
Pairing.Date.Value = conditional.Date.Value;
Match.Date.Value = conditional.Date.Value;
}
}
Flow.Children = new[]
{
new DrawableMatchTeam(Pairing.Team1.Value, Pairing, Pairing.Losers.Value),
new DrawableMatchTeam(Pairing.Team2.Value, Pairing, Pairing.Losers.Value)
new DrawableMatchTeam(Match.Team1.Value, Match, Match.Losers.Value),
new DrawableMatchTeam(Match.Team2.Value, Match, Match.Losers.Value)
};
SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression));
@ -282,7 +282,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
protected override bool OnClick(ClickEvent e)
{
if (editorInfo == null || Pairing is ConditionalMatchPairing)
if (editorInfo == null || Match is ConditionalTournamentMatch)
return false;
Selected = true;
@ -297,17 +297,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
this.MoveToOffset(e.Delta);
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;
}
public void Remove()
{
Selected = false;
Pairing.Progression.Value = null;
Pairing.LosersProgression.Value = null;
Match.Progression.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
{
private readonly MatchPairing pairing;
private readonly TournamentMatch match;
private readonly bool losers;
private OsuSpriteText scoreText;
private Box background;
@ -47,17 +47,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
if (ladderInfo.CurrentMatch.Value != null)
ladderInfo.CurrentMatch.Value.Current.Value = false;
ladderInfo.CurrentMatch.Value = pairing;
ladderInfo.CurrentMatch.Value = match;
ladderInfo.CurrentMatch.Value.Current.Value = true;
}
[Resolved(CanBeNull = true)]
private LadderEditorInfo editorInfo { get; set; }
public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing, bool losers)
public DrawableMatchTeam(TournamentTeam team, TournamentMatch match, bool losers)
: base(team)
{
this.pairing = pairing;
this.match = match;
this.losers = losers;
Size = new Vector2(150, 40);
@ -71,13 +71,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
AcronymText.Padding = new MarginPadding { Left = 50 };
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)
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 (!pairing.Current.Value)
if (!match.Current.Value)
{
setCurrent();
return true;
@ -154,25 +154,25 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{
if (score.Value == null)
{
pairing.StartMatch();
match.StartMatch();
}
else if (!pairing.Completed.Value)
else if (!match.Completed.Value)
score.Value++;
}
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
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
return false;
if (score.Value > 0)
score.Value--;
else
pairing.CancelMatchStart();
match.CancelMatchStart();
}
return false;
@ -197,9 +197,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
return new MenuItem[]
{
new OsuMenuItem("Set as current", MenuItemType.Standard, setCurrent),
new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, false)),
new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, true)),
new OsuMenuItem("Remove", MenuItemType.Destructive, () => ladderEditor.Remove(pairing)),
new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.BeginJoin(match, false)),
new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.BeginJoin(match, true)),
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 DrawableMatchPairing Source { get; private set; }
public DrawableMatchPairing Destination { get; private set; }
public DrawableTournamentMatch Source { get; private set; }
public DrawableTournamentMatch Destination { get; private set; }
public ProgressionPath(DrawableMatchPairing source, DrawableMatchPairing destination)
public ProgressionPath(DrawableTournamentMatch source, DrawableTournamentMatch destination)
{
Source = source;
Destination = destination;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.Ladder
{
public class LadderScreen : TournamentScreen, IProvideVideo
{
protected Container<DrawableMatchPairing> PairingsContainer;
protected Container<DrawableTournamentMatch> MatchesContainer;
private Container<Path> paths;
private Container headings;
@ -53,35 +53,35 @@ namespace osu.Game.Tournament.Screens.Ladder
{
paths = new Container<Path> { 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) =>
PairingsContainer.Add(new DrawableMatchPairing(pairing, this is LadderEditorScreen)
void addMatch(TournamentMatch match) =>
MatchesContainer.Add(new DrawableTournamentMatch(match, this is LadderEditorScreen)
{
Changed = () => layout.Invalidate()
});
foreach (var pairing in LadderInfo.Pairings)
addPairing(pairing);
foreach (var match in LadderInfo.Matches)
addMatch(match);
LadderInfo.Rounds.ItemsAdded += _ => layout.Invalidate();
LadderInfo.Rounds.ItemsRemoved += _ => layout.Invalidate();
LadderInfo.Pairings.ItemsAdded += pairings =>
LadderInfo.Matches.ItemsAdded += matches =>
{
foreach (var p in pairings)
addPairing(p);
foreach (var p in matches)
addMatch(p);
layout.Invalidate();
};
LadderInfo.Pairings.ItemsRemoved += pairings =>
LadderInfo.Matches.ItemsRemoved += matches =>
{
foreach (var p in pairings)
foreach (var d in PairingsContainer.Where(d => d.Pairing == p))
foreach (var p in matches)
foreach (var d in MatchesContainer.Where(d => d.Match == p))
d.Expire();
layout.Invalidate();
@ -110,45 +110,45 @@ namespace osu.Game.Tournament.Screens.Ladder
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)
// clean up outdated progressions.
pairing.Pairing.Progression.Value = null;
match.Match.Progression.Value = null;
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 (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)
// clean up outdated progressions.
pairing.Pairing.LosersProgression.Value = null;
match.Match.LosersProgression.Value = null;
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)
{
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)
{
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 },
Origin = Anchor.BottomCentre,
});
@ -156,13 +156,13 @@ namespace osu.Game.Tournament.Screens.Ladder
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)
{
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 },
Origin = Anchor.BottomCentre,
});

View File

@ -26,7 +26,7 @@ namespace osu.Game.Tournament.Screens.MapPool
{
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)]
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();

View File

@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Screens.Schedule
{
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 LadderInfo ladder;
@ -49,7 +49,7 @@ namespace osu.Game.Tournament.Screens.Schedule
currentMatch.BindTo(ladder.CurrentMatch);
}
private void matchChanged(ValueChangedEvent<MatchPairing> match)
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{
if (match.NewValue == null)
{
@ -57,10 +57,10 @@ namespace osu.Game.Tournament.Screens.Schedule
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
.Pairings.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))));
.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.ConditionalMatches.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a))));
upcoming = upcoming.Concat(conditionals);
upcoming = upcoming.OrderBy(p => p.Date.Value).Take(12);
@ -85,18 +85,18 @@ namespace osu.Game.Tournament.Screens.Schedule
{
RelativeSizeAxes = Axes.Both,
Width = 0.4f,
ChildrenEnumerable = ladder.Pairings
ChildrenEnumerable = 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)
.OrderByDescending(p => p.Date.Value)
.Take(8)
.Select(p => new SchedulePairing(p))
.Select(p => new ScheduleMatch(p))
},
new ScheduleContainer("match overview")
{
RelativeSizeAxes = Axes.Both,
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,
Font = OsuFont.GetFont(size: 20)
},
new SchedulePairing(match.NewValue, false),
new ScheduleMatch(match.NewValue, false),
new OsuSpriteText
{
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)
: base(pairing)
public ScheduleMatch(TournamentMatch match, bool showTimestamp = true)
: base(match)
{
Flow.Direction = FillDirection.Horizontal;
bool conditional = pairing is ConditionalMatchPairing;
bool conditional = match is ConditionalTournamentMatch;
if (conditional)
Colour = OsuColour.Gray(0.5f);
if (showTimestamp)
{
AddInternal(new DrawableDate(Pairing.Date.Value)
AddInternal(new DrawableDate(Match.Date.Value)
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopLeft,
@ -157,7 +157,7 @@ namespace osu.Game.Tournament.Screens.Schedule
Colour = Color4.Black,
Alpha = conditional ? 0.6f : 1,
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 readonly Bindable<MatchPairing> currentMatch = new Bindable<MatchPairing>();
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
[BackgroundDependencyLoader]
private void load(Storage storage)
@ -45,9 +45,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro
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();
return;
@ -55,7 +55,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
mainContainer.Children = new Drawable[]
{
new TeamWithPlayers(pairing.NewValue.Team1.Value, true)
new TeamWithPlayers(match.NewValue.Team1.Value, true)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
@ -63,7 +63,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight
},
new TeamWithPlayers(pairing.NewValue.Team2.Value)
new TeamWithPlayers(match.NewValue.Team2.Value)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
@ -71,7 +71,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft
},
new RoundDisplay(pairing.NewValue)
new RoundDisplay(match.NewValue)
{
RelativeSizeAxes = Axes.Both,
Height = 0.25f,
@ -83,7 +83,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
private class RoundDisplay : CompositeDrawable
{
public RoundDisplay(MatchPairing pairing)
public RoundDisplay(TournamentMatch match)
{
var col = OsuColour.Gray(0.33f);
@ -112,7 +112,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = col,
Text = pairing.Round.Value?.Name.Value ?? "Unknown Round",
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Spacing = new Vector2(10, 0),
Font = OsuFont.GetFont(size: 50, weight: FontWeight.Light)
},
@ -121,7 +121,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
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)
},
}

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
{
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 TourneyVideo blueWinVideo;
@ -61,31 +61,31 @@ namespace osu.Game.Tournament.Screens.TeamWin
currentCompleted.BindValueChanged(_ => update());
}
private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{
currentCompleted.UnbindBindings();
currentCompleted.BindTo(pairing.NewValue.Completed);
currentCompleted.BindTo(match.NewValue.Completed);
update();
}
private void update()
{
var pairing = currentMatch.Value;
var match = currentMatch.Value;
if (pairing.Winner == null)
if (match.Winner == null)
{
mainContainer.Clear();
return;
}
bool redWin = pairing.Winner == pairing.Team1.Value;
bool redWin = match.Winner == match.Team1.Value;
redWinVideo.Alpha = redWin ? 1 : 0;
blueWinVideo.Alpha = redWin ? 0 : 1;
mainContainer.Children = new Drawable[]
{
new TeamWithPlayers(pairing.Winner, redWin)
new TeamWithPlayers(match.Winner, redWin)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
@ -93,7 +93,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
Anchor = Anchor.Centre,
Origin = Anchor.Centre
},
new RoundDisplay(pairing)
new RoundDisplay(match)
{
RelativeSizeAxes = Axes.Both,
Height = 0.25f,
@ -105,7 +105,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
private class RoundDisplay : CompositeDrawable
{
public RoundDisplay(MatchPairing pairing)
public RoundDisplay(TournamentMatch match)
{
var col = OsuColour.Gray(0.33f);
@ -133,7 +133,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
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),
Spacing = new Vector2(10, 0),
},
@ -142,7 +142,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
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),
},
}

View File

@ -61,7 +61,7 @@ namespace osu.Game.Tournament
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());
Add(ipc);
@ -97,24 +97,24 @@ namespace osu.Game.Tournament
bool addedInfo = false;
// 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);
pairing.Team2.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == pairing.Team2Acronym);
match.Team1.Value = ladder.Teams.FirstOrDefault(t => t.Acronym.Value == match.Team1Acronym);
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.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
foreach (var pair in ladder.Progressions)
{
var src = ladder.Pairings.FirstOrDefault(p => p.ID == pair.SourceID);
var dest = ladder.Pairings.FirstOrDefault(p => p.ID == pair.TargetID);
var src = ladder.Matches.FirstOrDefault(p => p.ID == pair.SourceID);
var dest = ladder.Matches.FirstOrDefault(p => p.ID == pair.TargetID);
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 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)
{
@ -245,10 +245,10 @@ namespace osu.Game.Tournament
protected virtual void SaveChanges()
{
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.Pairings.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true)))
ladder.Progressions = ladder.Matches.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat(
ladder.Matches.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true)))
.ToList();
using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create))