mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Merge pull request #14981 from peppy/fix-leaderboard-incorrect-load
Fix leaderboard potentially displaying the wrong scores
This commit is contained in:
commit
0d1243a0b5
@ -255,6 +255,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
}
|
}
|
||||||
|
|
||||||
private APIRequest getScoresRequest;
|
private APIRequest getScoresRequest;
|
||||||
|
private ScheduledDelegate getScoresRequestCallback;
|
||||||
|
|
||||||
protected abstract bool IsOnlineScope { get; }
|
protected abstract bool IsOnlineScope { get; }
|
||||||
|
|
||||||
@ -282,13 +283,16 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
getScoresRequest?.Cancel();
|
getScoresRequest?.Cancel();
|
||||||
getScoresRequest = null;
|
getScoresRequest = null;
|
||||||
|
|
||||||
|
getScoresRequestCallback?.Cancel();
|
||||||
|
getScoresRequestCallback = null;
|
||||||
|
|
||||||
pendingUpdateScores?.Cancel();
|
pendingUpdateScores?.Cancel();
|
||||||
pendingUpdateScores = Schedule(() =>
|
pendingUpdateScores = Schedule(() =>
|
||||||
{
|
{
|
||||||
PlaceholderState = PlaceholderState.Retrieving;
|
PlaceholderState = PlaceholderState.Retrieving;
|
||||||
loading.Show();
|
loading.Show();
|
||||||
|
|
||||||
getScoresRequest = FetchScores(scores => Schedule(() =>
|
getScoresRequest = FetchScores(scores => getScoresRequestCallback = Schedule(() =>
|
||||||
{
|
{
|
||||||
Scores = scores.ToArray();
|
Scores = scores.ToArray();
|
||||||
PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores;
|
PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores;
|
||||||
@ -297,7 +301,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
if (getScoresRequest == null)
|
if (getScoresRequest == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getScoresRequest.Failure += e => Schedule(() =>
|
getScoresRequest.Failure += e => getScoresRequestCallback = Schedule(() =>
|
||||||
{
|
{
|
||||||
if (e is OperationCanceledException)
|
if (e is OperationCanceledException)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user