1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

End high performance session when showing results screen

This commit is contained in:
Dean Herbert 2024-09-09 18:30:15 +09:00
parent f0e2b803de
commit b01fb2a5bf
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View File

@ -57,6 +57,11 @@ namespace osu.Game.Screens.Play
/// </summary> /// </summary>
public event Action OnGameplayStarted; public event Action OnGameplayStarted;
/// <summary>
/// Raised after all gameplay has finished.
/// </summary>
public event Action OnShowingResults;
public override bool AllowBackButton => false; // handled by HoldForMenuButton public override bool AllowBackButton => false; // handled by HoldForMenuButton
protected override bool PlayExitSound => !isRestarting; protected override bool PlayExitSound => !isRestarting;
@ -820,6 +825,7 @@ namespace osu.Game.Screens.Play
// This player instance may already be in the process of exiting. // This player instance may already be in the process of exiting.
return; return;
OnShowingResults?.Invoke();
this.Push(CreateResults(prepareScoreForDisplayTask.GetResultSafely())); this.Push(CreateResults(prepareScoreForDisplayTask.GetResultSafely()));
}, Time.Current + delay, 50); }, Time.Current + delay, 50);

View File

@ -529,7 +529,13 @@ namespace osu.Game.Screens.Play
scheduledPushPlayer = Scheduler.AddDelayed(() => scheduledPushPlayer = Scheduler.AddDelayed(() =>
{ {
// ensure that once we have reached this "point of no return", readyForPush will be false for all future checks (until a new player instance is prepared). // ensure that once we have reached this "point of no return", readyForPush will be false for all future checks (until a new player instance is prepared).
var consumedPlayer = consumePlayer(); Player consumedPlayer = consumePlayer();
consumedPlayer.OnShowingResults += () =>
{
highPerformanceSession?.Dispose();
highPerformanceSession = null;
};
ContentOut(); ContentOut();