Simplify the way multiple subscreens handle their disable states via a custom stack

This commit is contained in:
Dean Herbert
2020-02-06 14:22:01 +09:00
parent 75eb9ca040
commit 81cadb7875
5 changed files with 47 additions and 30 deletions

View File

@ -32,6 +32,8 @@ namespace osu.Game.Screens.Multi
{
public override bool CursorVisible => (screenStack.CurrentScreen as IMultiplayerSubScreen)?.CursorVisible ?? true;
// this is required due to PlayerLoader eventually being pushed to the main stack
// while leases may be taken out by a subscreen.
public override bool DisallowExternalBeatmapRulesetChanges => true;
private readonly MultiplayerWaveContainer waves;
@ -96,7 +98,7 @@ namespace osu.Game.Screens.Multi
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = Header.HEIGHT },
Child = screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }
Child = screenStack = new MultiplayerSubScreenStack { RelativeSizeAxes = Axes.Both }
},
new Header(screenStack),
createButton = new HeaderButton
@ -277,11 +279,7 @@ namespace osu.Game.Screens.Multi
private void updateTrack(ValueChangedEvent<WorkingBeatmap> _ = null)
{
bool isMatch = screenStack.CurrentScreen is MatchSubScreen;
Beatmap.Disabled = isMatch;
if (isMatch)
if (screenStack.CurrentScreen is MatchSubScreen)
{
var track = Beatmap.Value?.Track;