mirror of
https://github.com/ppy/osu
synced 2025-01-14 01:51:04 +00:00
Use PerformFromScreen
to exit sub screens instead
This commit is contained in:
parent
00ed5d6f92
commit
5232588a1f
osu.Game.Tests/Visual/Navigation
osu.Game/Screens/OnlinePlay
@ -83,7 +83,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
|
||||
AddStep("go back to song select", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(playlistScreen.ChildrenOfType<PurpleTriangleButton>().Single(b => b.Text == "Edit playlist"));
|
||||
InputManager.MoveMouseTo(playlistScreen.ChildrenOfType<PurpleRoundedButton>().Single(b => b.Text == "Edit playlist"));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
|
@ -45,6 +45,9 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
[Resolved]
|
||||
protected IAPIProvider API { get; private set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private IPerformFromScreenRunner performer { get; set; }
|
||||
|
||||
protected OnlinePlayScreen()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
@ -148,13 +151,17 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
|
||||
public override bool OnExiting(ScreenExitEvent e)
|
||||
{
|
||||
while (screenStack.CurrentScreen is not LoungeSubScreen)
|
||||
if (screenStack.CurrentScreen is not LoungeSubScreen)
|
||||
{
|
||||
var lastSubScreen = screenStack.CurrentScreen;
|
||||
if (((Drawable)lastSubScreen)?.IsLoaded == true)
|
||||
screenStack.Exit();
|
||||
if (performer != null)
|
||||
{
|
||||
performer.PerformFromScreen(_ => e.Destination.MakeCurrent(), new[] { typeof(LoungeSubScreen) });
|
||||
return true;
|
||||
}
|
||||
|
||||
if (lastSubScreen == screenStack.CurrentScreen) return true;
|
||||
// TODO: make isolated tests work with IPerformFromScreenRunner
|
||||
if ((screenStack.CurrentScreen as Drawable)?.IsLoaded == true && screenStack.CurrentScreen.OnExiting(e))
|
||||
return true;
|
||||
}
|
||||
|
||||
RoomManager.PartRoom();
|
||||
|
Loading…
Reference in New Issue
Block a user