1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:07:44 +08:00

Fix failed scores not prepared before import

This commit is contained in:
Salman Ahmed 2022-07-15 22:28:09 +03:00
parent 68afb65aff
commit 6285442b7d

View File

@ -267,7 +267,12 @@ namespace osu.Game.Screens.Play
},
FailOverlay = new FailOverlay
{
SaveReplay = saveFailedReplay,
SaveReplay = () =>
{
Score.ScoreInfo.Passed = false;
Score.ScoreInfo.Rank = ScoreRank.F;
return prepareAndImportScore();
},
OnRetry = Restart,
OnQuit = () => PerformExit(true),
},
@ -721,7 +726,7 @@ namespace osu.Game.Screens.Play
if (!Configuration.ShowResults)
return;
prepareScoreForDisplayTask ??= Task.Run(prepareScoreForResults);
prepareScoreForDisplayTask ??= Task.Run(prepareAndImportScore);
bool storyboardHasOutro = DimmableStoryboard.ContentDisplayed && !DimmableStoryboard.HasStoryboardEnded.Value;
@ -740,7 +745,7 @@ namespace osu.Game.Screens.Play
/// Asynchronously run score preparation operations (database import, online submission etc.).
/// </summary>
/// <returns>The final score.</returns>
private async Task<ScoreInfo> prepareScoreForResults()
private async Task<ScoreInfo> prepareAndImportScore()
{
var scoreCopy = Score.DeepClone();
@ -1044,26 +1049,6 @@ namespace osu.Game.Screens.Play
return base.OnExiting(e);
}
private async Task<ScoreInfo> saveFailedReplay()
{
Score.ScoreInfo.Passed = false;
Score.ScoreInfo.Rank = ScoreRank.F;
var scoreCopy = Score.DeepClone();
try
{
await ImportScore(scoreCopy);
}
catch (Exception ex)
{
Logger.Error(ex, @"Score import failed!");
return null;
}
return scoreCopy.ScoreInfo;
}
/// <summary>
/// Creates the player's <see cref="Scoring.Score"/>.
/// </summary>