1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Create completion progress delegate immediately

This commit is contained in:
smoogipoo 2020-12-18 18:20:36 +09:00
parent 1369b75a86
commit 8826d01559

View File

@ -529,21 +529,38 @@ namespace osu.Game.Screens.Play
if (!showResults) return;
scoreSubmissionTask ??= SubmitScore(CreateScore());
scoreSubmissionTask.ContinueWith(t => Schedule(() =>
scoreSubmissionTask ??= Task.Run(async () =>
{
using (BeginDelayedSequence(RESULTS_DISPLAY_DELAY))
var score = CreateScore();
try
{
completionProgressDelegate = Schedule(() =>
{
// screen may be in the exiting transition phase.
if (this.IsCurrentScreen())
this.Push(CreateResults(t.Result));
});
return await SubmitScore(score);
}
}));
catch (Exception ex)
{
Logger.Error(ex, "Score submission failed!");
return score.ScoreInfo;
}
});
using (BeginDelayedSequence(RESULTS_DISPLAY_DELAY))
scheduleCompletion();
}
private void scheduleCompletion() => completionProgressDelegate = Schedule(() =>
{
if (!scoreSubmissionTask.IsCompleted)
{
scheduleCompletion();
return;
}
// screen may be in the exiting transition phase.
if (this.IsCurrentScreen())
this.Push(CreateResults(scoreSubmissionTask.Result));
});
protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !GameplayClockContainer.IsPaused.Value;
#region Fail Logic