Refactor to just exit sub screens until lounge sub screen

Co-Authored-By: Salman Ahmed <frenzibyte@gmail.com>
This commit is contained in:
Joseph Madamba 2022-12-25 21:56:22 -08:00
parent 5232588a1f
commit 0dba25e0ab

View File

@ -45,9 +45,6 @@ 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;
@ -151,17 +148,13 @@ namespace osu.Game.Screens.OnlinePlay
public override bool OnExiting(ScreenExitEvent e)
{
if (screenStack.CurrentScreen is not LoungeSubScreen)
while (screenStack.CurrentScreen != null && screenStack.CurrentScreen is not LoungeSubScreen)
{
if (performer != null)
{
performer.PerformFromScreen(_ => e.Destination.MakeCurrent(), new[] { typeof(LoungeSubScreen) });
var subScreen = (Screen)screenStack.CurrentScreen;
if (subScreen.IsLoaded && subScreen.OnExiting(e))
return true;
}
// TODO: make isolated tests work with IPerformFromScreenRunner
if ((screenStack.CurrentScreen as Drawable)?.IsLoaded == true && screenStack.CurrentScreen.OnExiting(e))
return true;
subScreen.Exit();
}
RoomManager.PartRoom();