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