mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 13:02:54 +08:00
Refactor updateCompletionState implementation for legibility and code share
This commit is contained in:
parent
5a2129da7c
commit
a91c63819b
@ -423,8 +423,6 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!this.IsCurrentScreen())
|
if (!this.IsCurrentScreen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// cancel push delegate in case judges reverted
|
|
||||||
// after delegate may have already been scheduled.
|
|
||||||
if (!completionState.NewValue)
|
if (!completionState.NewValue)
|
||||||
{
|
{
|
||||||
completionProgressDelegate?.Cancel();
|
completionProgressDelegate?.Cancel();
|
||||||
@ -433,8 +431,11 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (completionProgressDelegate != null)
|
||||||
|
throw new InvalidOperationException($"{nameof(updateCompletionState)} was fired more than once");
|
||||||
|
|
||||||
// Only show the completion screen if the player hasn't failed
|
// Only show the completion screen if the player hasn't failed
|
||||||
if (HealthProcessor.HasFailed || completionProgressDelegate != null)
|
if (HealthProcessor.HasFailed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
@ -442,7 +443,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!showResults) return;
|
if (!showResults) return;
|
||||||
|
|
||||||
using (BeginDelayedSequence(RESULTS_DISPLAY_DELAY))
|
using (BeginDelayedSequence(RESULTS_DISPLAY_DELAY))
|
||||||
scheduleGotoRanking();
|
completionProgressDelegate = Schedule(GotoRanking);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ScoreInfo CreateScore()
|
protected virtual ScoreInfo CreateScore()
|
||||||
@ -694,12 +695,6 @@ namespace osu.Game.Screens.Play
|
|||||||
storyboardReplacesBackground.Value = false;
|
storyboardReplacesBackground.Value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scheduleGotoRanking()
|
|
||||||
{
|
|
||||||
completionProgressDelegate?.Cancel();
|
|
||||||
completionProgressDelegate = Schedule(GotoRanking);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user