mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:02:55 +08:00
Fix regressing issues when attempting to exit Player
after an unsuccessful beatmap load
This commit is contained in:
parent
1ee0be5e39
commit
2eb3365f46
@ -12,6 +12,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
|
||||
/// <summary>
|
||||
/// This test also covers the scenario of exiting Player after an unsuccessful beatmap load.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestUnknownModDoesntEnterGameplay()
|
||||
{
|
||||
|
@ -994,24 +994,27 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
if (!GameplayState.HasPassed && !GameplayState.HasFailed)
|
||||
GameplayState.HasQuit = true;
|
||||
|
||||
screenSuspension?.RemoveAndDisposeImmediately();
|
||||
failAnimationLayer?.RemoveFilters();
|
||||
|
||||
// if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap.
|
||||
if (prepareScoreForDisplayTask == null)
|
||||
if (LoadedBeatmapSuccessfully)
|
||||
{
|
||||
Score.ScoreInfo.Passed = false;
|
||||
// potentially should be ScoreRank.F instead? this is the best alternative for now.
|
||||
Score.ScoreInfo.Rank = ScoreRank.D;
|
||||
}
|
||||
if (!GameplayState.HasPassed && !GameplayState.HasFailed)
|
||||
GameplayState.HasQuit = true;
|
||||
|
||||
// EndPlaying() is typically called from ReplayRecorder.Dispose(). Disposal is currently asynchronous.
|
||||
// To resolve test failures, forcefully end playing synchronously when this screen exits.
|
||||
// Todo: Replace this with a more permanent solution once osu-framework has a synchronous cleanup method.
|
||||
spectatorClient.EndPlaying(GameplayState);
|
||||
// if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap.
|
||||
if (prepareScoreForDisplayTask == null)
|
||||
{
|
||||
Score.ScoreInfo.Passed = false;
|
||||
// potentially should be ScoreRank.F instead? this is the best alternative for now.
|
||||
Score.ScoreInfo.Rank = ScoreRank.D;
|
||||
}
|
||||
|
||||
// EndPlaying() is typically called from ReplayRecorder.Dispose(). Disposal is currently asynchronous.
|
||||
// To resolve test failures, forcefully end playing synchronously when this screen exits.
|
||||
// Todo: Replace this with a more permanent solution once osu-framework has a synchronous cleanup method.
|
||||
spectatorClient.EndPlaying(GameplayState);
|
||||
}
|
||||
|
||||
// GameplayClockContainer performs seeks / start / stop operations on the beatmap's track.
|
||||
// as we are no longer the current screen, we cannot guarantee the track is still usable.
|
||||
|
@ -119,7 +119,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
bool exiting = base.OnExiting(next);
|
||||
|
||||
submitScore(Score.DeepClone());
|
||||
if (LoadedBeatmapSuccessfully)
|
||||
submitScore(Score.DeepClone());
|
||||
|
||||
return exiting;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user