2021-07-16 14:34:28 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-07-16 14:34:28 +00:00
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Tournament.Models;
|
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Screens
|
|
|
|
{
|
|
|
|
public abstract class TournamentMatchScreen : TournamentScreen
|
|
|
|
{
|
|
|
|
protected readonly Bindable<TournamentMatch> CurrentMatch = new Bindable<TournamentMatch>();
|
|
|
|
private WarningBox noMatchWarning;
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
CurrentMatch.BindTo(LadderInfo.CurrentMatch);
|
|
|
|
CurrentMatch.BindValueChanged(CurrentMatchChanged, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
|
|
|
{
|
|
|
|
if (match.NewValue == null)
|
|
|
|
{
|
|
|
|
AddInternal(noMatchWarning = new WarningBox("Choose a match first from the brackets screen"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
noMatchWarning?.Expire();
|
|
|
|
noMatchWarning = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|