mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Add conditional match support
This commit is contained in:
@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// A pairing that may not necessarily occur.
|
||||
/// </summary>
|
||||
public class ConditionalMatchPairing : MatchPairing
|
||||
{
|
||||
}
|
||||
}
|
@ -199,6 +199,18 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
if (Pairing.Team1.Value == null || Pairing.Team2.Value == null)
|
||||
Pairing.CancelMatchStart();
|
||||
|
||||
if (Pairing.ConditionalPairings.Count > 0)
|
||||
{
|
||||
foreach (var conditional in Pairing.ConditionalPairings)
|
||||
{
|
||||
var team1Match = conditional.Acronyms.Contains(Pairing.Team1Acronym);
|
||||
var team2Match = conditional.Acronyms.Contains(Pairing.Team2Acronym);
|
||||
|
||||
if (team1Match && team2Match)
|
||||
Pairing.Date.Value = conditional.Date;
|
||||
}
|
||||
}
|
||||
|
||||
Flow.Children = new[]
|
||||
{
|
||||
new DrawableMatchTeam(Pairing.Team1, Pairing, Pairing.Losers),
|
||||
@ -226,7 +238,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (editorInfo == null)
|
||||
if (editorInfo == null || Pairing is ConditionalMatchPairing)
|
||||
return false;
|
||||
|
||||
Selected = true;
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Configuration;
|
||||
@ -17,6 +18,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
public int ID;
|
||||
|
||||
public List<string> Acronyms
|
||||
{
|
||||
get
|
||||
{
|
||||
List<string> acronyms = new List<string>();
|
||||
if (Team1Acronym != null) acronyms.Add(Team1Acronym);
|
||||
if (Team2Acronym != null) acronyms.Add(Team2Acronym);
|
||||
return acronyms;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public readonly Bindable<TournamentTeam> Team1 = new Bindable<TournamentTeam>();
|
||||
|
||||
@ -53,6 +65,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
public readonly Bindable<DateTimeOffset> Date = new Bindable<DateTimeOffset>();
|
||||
|
||||
public readonly BindableCollection<ConditionalMatchPairing> ConditionalPairings = new BindableCollection<ConditionalMatchPairing>();
|
||||
|
||||
public readonly Bindable<Point> Position = new Bindable<Point>();
|
||||
|
||||
public MatchPairing()
|
||||
@ -74,7 +88,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
[JsonIgnore]
|
||||
public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value;
|
||||
|
||||
public int PointsToWin => Grouping.Value.BestOf / 2 + 1;
|
||||
public int PointsToWin => Grouping.Value == null ? 0 : Grouping.Value.BestOf / 2 + 1;
|
||||
|
||||
/// <summary>
|
||||
/// Remove scores from the match, in case of a false click or false start.
|
||||
|
Reference in New Issue
Block a user