Skip to content

Commit

Permalink
Move non-current handling to PerformExit
Browse files Browse the repository at this point in the history
Co-authored-by: Dean Herbert <[email protected]>
  • Loading branch information
frenzibyte and peppy committed Dec 4, 2024
1 parent 53dce83 commit fa87df6
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions osu.Game/Screens/Play/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ protected bool PerformExit(bool skipTransition = false)
// import current score if possible.
prepareAndImportScoreAsync();

// Screen may not be current if a restart has been performed.
if (this.IsCurrentScreen())
{
skipExitTransition = skipTransition;
Expand All @@ -657,6 +656,12 @@ protected bool PerformExit(bool skipTransition = false)
// - the pause / fail dialog was requested but couldn't be displayed due to the type or state of this Player instance.
this.Exit();
}
else
{
// May be restarting from results screen.
if (this.GetChildScreen() != null)
this.MakeCurrent();
}

return true;
}
Expand Down Expand Up @@ -722,16 +727,6 @@ public bool Restart(bool quickRestart = false)
skipExitTransition = quickRestart;
PrepareLoaderForRestart?.Invoke(quickRestart);

if (!this.IsCurrentScreen())
{
// if we're called externally (i.e. from results screen),
// use MakeCurrent to exit results screen as well as this player screen
// since ValidForResume = false in here
Debug.Assert(!ValidForResume);
this.MakeCurrent();
return true;
}

return PerformExit(quickRestart);
}

Expand Down

0 comments on commit fa87df6

Please sign in to comment.