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