mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Add support for song select leaderboard to handle newly imported scores
This commit is contained in:
parent
ebe850fe9f
commit
8dd48d48f6
@ -44,9 +44,9 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private IEnumerable<TScoreInfo> scores;
|
||||
private ICollection<TScoreInfo> scores;
|
||||
|
||||
public IEnumerable<TScoreInfo> Scores
|
||||
public ICollection<TScoreInfo> Scores
|
||||
{
|
||||
get => scores;
|
||||
set
|
||||
@ -290,7 +290,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
getScoresRequest = FetchScores(scores => Schedule(() =>
|
||||
{
|
||||
Scores = scores;
|
||||
Scores = scores.ToArray();
|
||||
PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores;
|
||||
}));
|
||||
|
||||
|
@ -44,6 +44,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
private IBindable<WeakReference<ScoreInfo>> itemRemoved;
|
||||
|
||||
private IBindable<WeakReference<ScoreInfo>> itemAdded;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to apply the game's currently selected mods as a filter when retrieving scores.
|
||||
/// </summary>
|
||||
@ -85,6 +87,9 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
itemRemoved = scoreManager.ItemRemoved.GetBoundCopy();
|
||||
itemRemoved.BindValueChanged(onScoreRemoved);
|
||||
|
||||
itemAdded = scoreManager.ItemUpdated.GetBoundCopy();
|
||||
itemAdded.BindValueChanged(onScoreAdded);
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
@ -93,7 +98,21 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
TopScore = null;
|
||||
}
|
||||
|
||||
private void onScoreRemoved(ValueChangedEvent<WeakReference<ScoreInfo>> score) => Schedule(RefreshScores);
|
||||
private void onScoreRemoved(ValueChangedEvent<WeakReference<ScoreInfo>> score)
|
||||
{
|
||||
if (Scope != BeatmapLeaderboardScope.Local)
|
||||
return;
|
||||
|
||||
Scheduler.AddOnce(RefreshScores);
|
||||
}
|
||||
|
||||
private void onScoreAdded(ValueChangedEvent<WeakReference<ScoreInfo>> score)
|
||||
{
|
||||
if (Scope != BeatmapLeaderboardScope.Local)
|
||||
return;
|
||||
|
||||
Scheduler.AddOnce(RefreshScores);
|
||||
}
|
||||
|
||||
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user