mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 02:13:21 +08:00
Merge pull request #13906 from peppy/tournament-flow-warnings
Show warning on screens which require a current match to be selected
This commit is contained in:
commit
7be7fb4ca9
@ -11,7 +11,7 @@ using osu.Game.Tournament.IPC;
|
||||
|
||||
namespace osu.Game.Tournament.Screens
|
||||
{
|
||||
public abstract class BeatmapInfoScreen : TournamentScreen
|
||||
public abstract class BeatmapInfoScreen : TournamentMatchScreen
|
||||
{
|
||||
protected readonly SongBar SongBar;
|
||||
|
||||
|
@ -24,8 +24,6 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
{
|
||||
private readonly BindableBool warmup = new BindableBool();
|
||||
|
||||
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
|
||||
|
||||
public readonly Bindable<TourneyState> State = new Bindable<TourneyState>();
|
||||
private OsuButton warmupButton;
|
||||
private MatchIPCInfo ipc;
|
||||
@ -131,14 +129,6 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
|
||||
ladder.ChromaKeyWidth.BindValueChanged(width => chroma.Width = width.NewValue, true);
|
||||
|
||||
currentMatch.BindValueChanged(m =>
|
||||
{
|
||||
warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0;
|
||||
scheduledOperation?.Cancel();
|
||||
});
|
||||
|
||||
currentMatch.BindTo(ladder.CurrentMatch);
|
||||
|
||||
warmup.BindValueChanged(w =>
|
||||
{
|
||||
warmupButton.Alpha = !w.NewValue ? 0.5f : 1;
|
||||
@ -146,6 +136,17 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
base.CurrentMatchChanged(match);
|
||||
|
||||
if (match.NewValue == null)
|
||||
return;
|
||||
|
||||
warmup.Value = match.NewValue.Team1Score.Value + match.NewValue.Team2Score.Value == 0;
|
||||
scheduledOperation?.Cancel();
|
||||
}
|
||||
|
||||
private ScheduledDelegate scheduledOperation;
|
||||
private MatchScoreDisplay scoreDisplay;
|
||||
|
||||
@ -161,9 +162,9 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
if (warmup.Value) return;
|
||||
|
||||
if (ipc.Score1.Value > ipc.Score2.Value)
|
||||
currentMatch.Value.Team1Score.Value++;
|
||||
CurrentMatch.Value.Team1Score.Value++;
|
||||
else
|
||||
currentMatch.Value.Team2Score.Value++;
|
||||
CurrentMatch.Value.Team2Score.Value++;
|
||||
}
|
||||
|
||||
scheduledOperation?.Cancel();
|
||||
@ -198,9 +199,9 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
// we should automatically proceed after a short delay
|
||||
if (lastState == TourneyState.Ranking && !warmup.Value)
|
||||
{
|
||||
if (currentMatch.Value?.Completed.Value == true)
|
||||
if (CurrentMatch.Value?.Completed.Value == true)
|
||||
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, delay_before_progression);
|
||||
else if (currentMatch.Value?.Completed.Value == false)
|
||||
else if (CurrentMatch.Value?.Completed.Value == false)
|
||||
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, delay_before_progression);
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,10 @@ using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.MapPool
|
||||
{
|
||||
public class MapPoolScreen : TournamentScreen
|
||||
public class MapPoolScreen : TournamentMatchScreen
|
||||
{
|
||||
private readonly FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>> mapFlows;
|
||||
|
||||
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private TournamentSceneManager sceneManager { get; set; }
|
||||
|
||||
@ -96,7 +94,7 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
Action = reset
|
||||
},
|
||||
new ControlPanel.Spacer(),
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -104,15 +102,12 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(MatchIPCInfo ipc)
|
||||
{
|
||||
currentMatch.BindValueChanged(matchChanged);
|
||||
currentMatch.BindTo(LadderInfo.CurrentMatch);
|
||||
|
||||
ipc.Beatmap.BindValueChanged(beatmapChanged);
|
||||
}
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<BeatmapInfo> beatmap)
|
||||
{
|
||||
if (currentMatch.Value == null || currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2)
|
||||
if (CurrentMatch.Value == null || CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2)
|
||||
return;
|
||||
|
||||
// if bans have already been placed, beatmap changes result in a selection being made autoamtically
|
||||
@ -137,12 +132,12 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
{
|
||||
const TeamColour roll_winner = TeamColour.Red; //todo: draw from match
|
||||
|
||||
var nextColour = (currentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner) == TeamColour.Red ? TeamColour.Blue : TeamColour.Red;
|
||||
var nextColour = (CurrentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner) == TeamColour.Red ? TeamColour.Blue : TeamColour.Red;
|
||||
|
||||
if (pickType == ChoiceType.Ban && currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2)
|
||||
if (pickType == ChoiceType.Ban && CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2)
|
||||
setMode(pickColour, ChoiceType.Pick);
|
||||
else
|
||||
setMode(nextColour, currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2 ? ChoiceType.Pick : ChoiceType.Ban);
|
||||
setMode(nextColour, CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2 ? ChoiceType.Pick : ChoiceType.Ban);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
@ -156,11 +151,11 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
addForBeatmap(map.Beatmap.OnlineBeatmapID.Value);
|
||||
else
|
||||
{
|
||||
var existing = currentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == map.Beatmap.OnlineBeatmapID);
|
||||
var existing = CurrentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == map.Beatmap.OnlineBeatmapID);
|
||||
|
||||
if (existing != null)
|
||||
{
|
||||
currentMatch.Value.PicksBans.Remove(existing);
|
||||
CurrentMatch.Value.PicksBans.Remove(existing);
|
||||
setNextMode();
|
||||
}
|
||||
}
|
||||
@ -173,7 +168,7 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
|
||||
private void reset()
|
||||
{
|
||||
currentMatch.Value.PicksBans.Clear();
|
||||
CurrentMatch.Value.PicksBans.Clear();
|
||||
setNextMode();
|
||||
}
|
||||
|
||||
@ -181,18 +176,18 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
|
||||
private void addForBeatmap(int beatmapId)
|
||||
{
|
||||
if (currentMatch.Value == null)
|
||||
if (CurrentMatch.Value == null)
|
||||
return;
|
||||
|
||||
if (currentMatch.Value.Round.Value.Beatmaps.All(b => b.BeatmapInfo.OnlineBeatmapID != beatmapId))
|
||||
if (CurrentMatch.Value.Round.Value.Beatmaps.All(b => b.BeatmapInfo.OnlineBeatmapID != beatmapId))
|
||||
// don't attempt to add if the beatmap isn't in our pool
|
||||
return;
|
||||
|
||||
if (currentMatch.Value.PicksBans.Any(p => p.BeatmapID == beatmapId))
|
||||
if (CurrentMatch.Value.PicksBans.Any(p => p.BeatmapID == beatmapId))
|
||||
// don't attempt to add if already exists.
|
||||
return;
|
||||
|
||||
currentMatch.Value.PicksBans.Add(new BeatmapChoice
|
||||
CurrentMatch.Value.PicksBans.Add(new BeatmapChoice
|
||||
{
|
||||
Team = pickColour,
|
||||
Type = pickType,
|
||||
@ -201,17 +196,22 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
|
||||
setNextMode();
|
||||
|
||||
if (pickType == ChoiceType.Pick && currentMatch.Value.PicksBans.Any(i => i.Type == ChoiceType.Pick))
|
||||
if (pickType == ChoiceType.Pick && CurrentMatch.Value.PicksBans.Any(i => i.Type == ChoiceType.Pick))
|
||||
{
|
||||
scheduledChange?.Cancel();
|
||||
scheduledChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(GameplayScreen)); }, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
base.CurrentMatchChanged(match);
|
||||
|
||||
mapFlows.Clear();
|
||||
|
||||
if (match.NewValue == null)
|
||||
return;
|
||||
|
||||
int totalRows = 0;
|
||||
|
||||
if (match.NewValue.Round.Value != null)
|
||||
|
@ -2,10 +2,12 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Tournament.Models;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Showcase
|
||||
@ -39,5 +41,11 @@ namespace osu.Game.Tournament.Screens.Showcase
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
// showcase screen doesn't care about a match being selected.
|
||||
// base call intentionally omitted to not show match warning.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,10 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
{
|
||||
public class SeedingScreen : TournamentScreen, IProvideVideo
|
||||
public class SeedingScreen : TournamentMatchScreen, IProvideVideo
|
||||
{
|
||||
private Container mainContainer;
|
||||
|
||||
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
|
||||
|
||||
private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -50,13 +48,13 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Show first team",
|
||||
Action = () => currentTeam.Value = currentMatch.Value.Team1.Value,
|
||||
Action = () => currentTeam.Value = CurrentMatch.Value.Team1.Value,
|
||||
},
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Show second team",
|
||||
Action = () => currentTeam.Value = currentMatch.Value.Team2.Value,
|
||||
Action = () => currentTeam.Value = CurrentMatch.Value.Team2.Value,
|
||||
},
|
||||
new SettingsTeamDropdown(LadderInfo.Teams)
|
||||
{
|
||||
@ -67,9 +65,6 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
}
|
||||
};
|
||||
|
||||
currentMatch.BindValueChanged(matchChanged);
|
||||
currentMatch.BindTo(LadderInfo.CurrentMatch);
|
||||
|
||||
currentTeam.BindValueChanged(teamChanged, true);
|
||||
}
|
||||
|
||||
@ -84,8 +79,15 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
showTeam(team.NewValue);
|
||||
}
|
||||
|
||||
private void matchChanged(ValueChangedEvent<TournamentMatch> match) =>
|
||||
currentTeam.Value = currentMatch.Value.Team1.Value;
|
||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
base.CurrentMatchChanged(match);
|
||||
|
||||
if (match.NewValue == null)
|
||||
return;
|
||||
|
||||
currentTeam.Value = match.NewValue.Team1.Value;
|
||||
}
|
||||
|
||||
private void showTeam(TournamentTeam team)
|
||||
{
|
||||
|
@ -12,12 +12,10 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
{
|
||||
public class TeamIntroScreen : TournamentScreen, IProvideVideo
|
||||
public class TeamIntroScreen : TournamentMatchScreen, IProvideVideo
|
||||
{
|
||||
private Container mainContainer;
|
||||
|
||||
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(Storage storage)
|
||||
{
|
||||
@ -35,18 +33,16 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
};
|
||||
|
||||
currentMatch.BindValueChanged(matchChanged);
|
||||
currentMatch.BindTo(LadderInfo.CurrentMatch);
|
||||
}
|
||||
|
||||
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
base.CurrentMatchChanged(match);
|
||||
|
||||
mainContainer.Clear();
|
||||
|
||||
if (match.NewValue == null)
|
||||
{
|
||||
mainContainer.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
const float y_flag_offset = 292;
|
||||
|
||||
|
@ -13,11 +13,10 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.TeamWin
|
||||
{
|
||||
public class TeamWinScreen : TournamentScreen, IProvideVideo
|
||||
public class TeamWinScreen : TournamentMatchScreen, IProvideVideo
|
||||
{
|
||||
private Container mainContainer;
|
||||
|
||||
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
|
||||
private readonly Bindable<bool> currentCompleted = new Bindable<bool>();
|
||||
|
||||
private TourneyVideo blueWinVideo;
|
||||
@ -48,17 +47,19 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
||||
}
|
||||
};
|
||||
|
||||
currentMatch.BindValueChanged(matchChanged);
|
||||
currentMatch.BindTo(ladder.CurrentMatch);
|
||||
|
||||
currentCompleted.BindValueChanged(_ => update());
|
||||
}
|
||||
|
||||
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
currentCompleted.UnbindBindings();
|
||||
currentCompleted.BindTo(match.NewValue.Completed);
|
||||
base.CurrentMatchChanged(match);
|
||||
|
||||
currentCompleted.UnbindBindings();
|
||||
|
||||
if (match.NewValue == null)
|
||||
return;
|
||||
|
||||
currentCompleted.BindTo(match.NewValue.Completed);
|
||||
update();
|
||||
}
|
||||
|
||||
@ -66,7 +67,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
||||
|
||||
private void update() => Schedule(() =>
|
||||
{
|
||||
var match = currentMatch.Value;
|
||||
var match = CurrentMatch.Value;
|
||||
|
||||
if (match.Winner == null)
|
||||
{
|
||||
|
34
osu.Game.Tournament/Screens/TournamentMatchScreen.cs
Normal file
34
osu.Game.Tournament/Screens/TournamentMatchScreen.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// 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
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -97,7 +97,12 @@ namespace osu.Game.Tournament
|
||||
},
|
||||
}
|
||||
},
|
||||
heightWarning = new WarningBox("Please make the window wider"),
|
||||
heightWarning = new WarningBox("Please make the window wider")
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Margin = new MarginPadding(20),
|
||||
},
|
||||
new OsuContextMenuContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
Loading…
Reference in New Issue
Block a user