mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 19:27:26 +08:00
Merge branch 'master' into letterboxing
This commit is contained in:
commit
2fc3e77be7
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -30,6 +31,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
private readonly LoadingAnimation loading;
|
private readonly LoadingAnimation loading;
|
||||||
|
|
||||||
private ScheduledDelegate showScoresDelegate;
|
private ScheduledDelegate showScoresDelegate;
|
||||||
|
private CancellationTokenSource showScoresCancellationSource;
|
||||||
|
|
||||||
private bool scoresLoadedOnce;
|
private bool scoresLoadedOnce;
|
||||||
|
|
||||||
@ -49,6 +51,10 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
loading.Hide();
|
loading.Hide();
|
||||||
|
|
||||||
|
// schedule because we may not be loaded yet (LoadComponentAsync complains).
|
||||||
|
showScoresDelegate?.Cancel();
|
||||||
|
showScoresCancellationSource?.Cancel();
|
||||||
|
|
||||||
if (scores == null || !scores.Any())
|
if (scores == null || !scores.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -58,8 +64,6 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
scrollFlow = CreateScoreFlow();
|
scrollFlow = CreateScoreFlow();
|
||||||
scrollFlow.ChildrenEnumerable = scores.Select((s, index) => CreateDrawableScore(s, index + 1));
|
scrollFlow.ChildrenEnumerable = scores.Select((s, index) => CreateDrawableScore(s, index + 1));
|
||||||
|
|
||||||
// schedule because we may not be loaded yet (LoadComponentAsync complains).
|
|
||||||
showScoresDelegate?.Cancel();
|
|
||||||
if (!IsLoaded)
|
if (!IsLoaded)
|
||||||
showScoresDelegate = Schedule(showScores);
|
showScoresDelegate = Schedule(showScores);
|
||||||
else
|
else
|
||||||
@ -77,7 +81,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
}
|
}
|
||||||
|
|
||||||
scrollContainer.ScrollTo(0f, false);
|
scrollContainer.ScrollTo(0f, false);
|
||||||
});
|
}, (showScoresCancellationSource = new CancellationTokenSource()).Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user