1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Merge branch 'simplify-mp-subscreen-disables' into lounge-ruleset-filtering

This commit is contained in:
Dean Herbert 2020-02-06 14:22:52 +09:00
commit a84386ba01
5 changed files with 47 additions and 30 deletions

View File

@ -91,6 +91,22 @@ namespace osu.Game.Screens.Multi.Lounge
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
onReturning();
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
if (currentRoom.Value?.RoomID.Value == null)
currentRoom.Value = new Room();
onReturning();
}
private void onReturning()
{
Filter.Search.HoldFocus = true;
}
@ -106,14 +122,6 @@ namespace osu.Game.Screens.Multi.Lounge
Filter.Search.HoldFocus = false;
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
if (currentRoom.Value?.RoomID.Value == null)
currentRoom.Value = new Room();
}
private void joinRequested(Room room)
{
processingOverlay.Show();

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;

View File

@ -0,0 +1,24 @@
// 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.Screens;
namespace osu.Game.Screens.Multi
{
public class MultiplayerSubScreenStack : OsuScreenStack
{
protected override void ScreenChanged(IScreen prev, IScreen next)
{
base.ScreenChanged(prev, next);
// because this is a screen stack within a screen stack, let's manually handle disabled changes to simplify things.
var osuScreen = ((OsuScreen)next);
bool disallowChanges = osuScreen.DisallowExternalBeatmapRulesetChanges;
osuScreen.Beatmap.Disabled = disallowChanges;
osuScreen.Ruleset.Disabled = disallowChanges;
osuScreen.Mods.Disabled = disallowChanges;
}
}
}

View File

@ -26,7 +26,7 @@ namespace osu.Game.Screens
};
ScreenPushed += screenPushed;
ScreenExited += screenExited;
ScreenExited += ScreenChanged;
}
private void screenPushed(IScreen prev, IScreen next)
@ -42,10 +42,10 @@ namespace osu.Game.Screens
// create dependencies synchronously to ensure leases are in a sane state.
((OsuScreen)next).CreateLeasedDependencies((prev as OsuScreen)?.Dependencies ?? Dependencies);
setParallax(next);
ScreenChanged(prev, next);
}
private void screenExited(IScreen prev, IScreen next)
protected virtual void ScreenChanged(IScreen prev, IScreen next)
{
setParallax(next);
}

View File

@ -65,20 +65,7 @@ namespace osu.Game.Screens.Select
Mods.Value = CurrentItem.Value.RequiredMods?.ToArray() ?? Array.Empty<Mod>();
}
Beatmap.Disabled = true;
Ruleset.Disabled = true;
Mods.Disabled = true;
return false;
}
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
Beatmap.Disabled = false;
Ruleset.Disabled = false;
Mods.Disabled = false;
}
}
}