mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 13:32:54 +08:00
Debounce schedule at base class
This commit is contained in:
parent
8dd48d48f6
commit
fc442713bb
@ -126,7 +126,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
return;
|
||||
|
||||
scope = value;
|
||||
UpdateScores();
|
||||
RefreshScores();
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
case PlaceholderState.NetworkFailure:
|
||||
replacePlaceholder(new ClickablePlaceholder(@"Couldn't fetch scores!", FontAwesome.Solid.Sync)
|
||||
{
|
||||
Action = UpdateScores,
|
||||
Action = RefreshScores
|
||||
});
|
||||
break;
|
||||
|
||||
@ -254,8 +254,6 @@ namespace osu.Game.Online.Leaderboards
|
||||
apiState.BindValueChanged(onlineStateChanged, true);
|
||||
}
|
||||
|
||||
public void RefreshScores() => UpdateScores();
|
||||
|
||||
private APIRequest getScoresRequest;
|
||||
|
||||
protected abstract bool IsOnlineScope { get; }
|
||||
@ -267,12 +265,14 @@ namespace osu.Game.Online.Leaderboards
|
||||
case APIState.Online:
|
||||
case APIState.Offline:
|
||||
if (IsOnlineScope)
|
||||
UpdateScores();
|
||||
RefreshScores();
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
public void RefreshScores() => Scheduler.AddOnce(UpdateScores);
|
||||
|
||||
protected void UpdateScores()
|
||||
{
|
||||
// don't display any scores or placeholder until the first Scores_Set has been called.
|
||||
|
@ -103,7 +103,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
if (Scope != BeatmapLeaderboardScope.Local)
|
||||
return;
|
||||
|
||||
Scheduler.AddOnce(RefreshScores);
|
||||
RefreshScores();
|
||||
}
|
||||
|
||||
private void onScoreAdded(ValueChangedEvent<WeakReference<ScoreInfo>> score)
|
||||
@ -111,7 +111,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
if (Scope != BeatmapLeaderboardScope.Local)
|
||||
return;
|
||||
|
||||
Scheduler.AddOnce(RefreshScores);
|
||||
RefreshScores();
|
||||
}
|
||||
|
||||
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
|
||||
|
Loading…
Reference in New Issue
Block a user