mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Move leaderboard update scheduling to a more central method
This commit is contained in:
parent
b0a1b25983
commit
388ca5d572
@ -175,7 +175,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
private APIAccess api;
|
||||
private BeatmapInfo beatmap;
|
||||
|
||||
private ScheduledDelegate pendingBeatmapSwitch;
|
||||
private ScheduledDelegate pendingUpdateScores;
|
||||
|
||||
public BeatmapInfo Beatmap
|
||||
{
|
||||
@ -188,8 +188,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
beatmap = value;
|
||||
Scores = null;
|
||||
|
||||
pendingBeatmapSwitch?.Cancel();
|
||||
pendingBeatmapSwitch = Schedule(updateScores);
|
||||
updateScores();
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,6 +227,12 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
}
|
||||
|
||||
private void updateScores()
|
||||
{
|
||||
getScoresRequest?.Cancel();
|
||||
getScoresRequest = null;
|
||||
|
||||
pendingUpdateScores?.Cancel();
|
||||
pendingUpdateScores = Schedule(() =>
|
||||
{
|
||||
if (Scope == LeaderboardScope.Local)
|
||||
{
|
||||
@ -257,7 +262,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
PlaceholderState = PlaceholderState.Retrieving;
|
||||
loading.Show();
|
||||
|
||||
getScoresRequest = new GetScoresRequest(Beatmap, osuGame?.Ruleset.Value ?? Beatmap.Ruleset, Scope);
|
||||
getScoresRequest = new GetScoresRequest(Beatmap, ruleset.Value ?? Beatmap.Ruleset, Scope);
|
||||
getScoresRequest.Success += r => Schedule(() =>
|
||||
{
|
||||
Scores = r.Scores;
|
||||
@ -274,6 +279,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
});
|
||||
|
||||
api.Queue(getScoresRequest);
|
||||
});
|
||||
}
|
||||
|
||||
private Placeholder currentPlaceholder;
|
||||
|
Loading…
Reference in New Issue
Block a user