1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 19:07:20 +08:00

Use IsCurrentScreen instead of a bool

This commit is contained in:
Michael Manis 2018-01-21 22:00:18 -05:00
parent 806da21760
commit 964c6da9a4

View File

@ -89,7 +89,6 @@ namespace osu.Game.Screens.Play
private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true;
private bool allowRestart = true;
private bool exited;
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config, APIAccess api)
@ -271,7 +270,6 @@ namespace osu.Game.Screens.Play
public void Restart()
{
exited = true;
sampleRestart?.Play();
ValidForResume = false;
RestartRequested?.Invoke();
@ -294,19 +292,19 @@ 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
if (IsCurrentScreen)
{
Beatmap = Beatmap.Value.BeatmapInfo,
Ruleset = ruleset
};
scoreProcessor.PopulateScore(score);
score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value;
if (!exited) Push(new Results(score));
allowRestart = false;
var score = new Score
{
Beatmap = Beatmap.Value.BeatmapInfo,
Ruleset = ruleset
};
scoreProcessor.PopulateScore(score);
score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value;
Push(new Results(score));
}
});
}
}