mirror of
https://github.com/ppy/osu.git
synced 2025-02-28 23:23:20 +08:00
Fixed tilde-key crash at end of beatmap.
This commit is contained in:
parent
64c32f5715
commit
ad2df8d8df
@ -88,6 +88,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true;
|
||||
|
||||
private bool allowRestart = true;
|
||||
private bool exited = false;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuConfigManager config, APIAccess api)
|
||||
{
|
||||
@ -208,10 +211,12 @@ namespace osu.Game.Screens.Play
|
||||
new HotkeyRetryOverlay
|
||||
{
|
||||
Action = () => {
|
||||
//we want to hide the hitrenderer immediately (looks better).
|
||||
//we may be able to remove this once the mouse cursor trail is improved.
|
||||
RulesetContainer?.Hide();
|
||||
Restart();
|
||||
if (allowRestart) {
|
||||
//we want to hide the hitrenderer immediately (looks better).
|
||||
//we may be able to remove this once the mouse cursor trail is improved.
|
||||
RulesetContainer?.Hide();
|
||||
Restart();
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
@ -266,6 +271,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
exited = true;
|
||||
sampleRestart?.Play();
|
||||
ValidForResume = false;
|
||||
RestartRequested?.Invoke();
|
||||
@ -288,6 +294,11 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
onCompletionEvent = Schedule(delegate
|
||||
{
|
||||
// This is here to mimic OsuStable behavior. It could be placed outside the delay timer,
|
||||
// which would remove the need for the check on Push() below, and would make it impossible
|
||||
// to quick-restart after hitting the last note.
|
||||
allowRestart = false;
|
||||
|
||||
var score = new Score
|
||||
{
|
||||
Beatmap = Beatmap.Value.BeatmapInfo,
|
||||
@ -295,7 +306,7 @@ namespace osu.Game.Screens.Play
|
||||
};
|
||||
scoreProcessor.PopulateScore(score);
|
||||
score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value;
|
||||
Push(new Results(score));
|
||||
if (!exited) Push(new Results(score));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user