2021-07-16 22:34:28 +08: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.
|
|
|
|
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Tournament.Models;
|
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Screens
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
public abstract partial class TournamentMatchScreen : TournamentScreen
|
2021-07-16 22:34:28 +08:00
|
|
|
{
|
2023-07-25 19:50:55 +08:00
|
|
|
protected readonly Bindable<TournamentMatch?> CurrentMatch = new Bindable<TournamentMatch?>();
|
|
|
|
private WarningBox? noMatchWarning;
|
2021-07-16 22:34:28 +08:00
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
CurrentMatch.BindTo(LadderInfo.CurrentMatch);
|
|
|
|
CurrentMatch.BindValueChanged(CurrentMatchChanged, true);
|
|
|
|
}
|
|
|
|
|
2023-07-25 19:50:55 +08:00
|
|
|
protected virtual void CurrentMatchChanged(ValueChangedEvent<TournamentMatch?> match)
|
2021-07-16 22:34:28 +08:00
|
|
|
{
|
|
|
|
if (match.NewValue == null)
|
|
|
|
{
|
|
|
|
AddInternal(noMatchWarning = new WarningBox("Choose a match first from the brackets screen"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
noMatchWarning?.Expire();
|
|
|
|
noMatchWarning = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|