1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 05:42:54 +08:00

Scores should be enumerable.

This commit is contained in:
Dean Herbert 2017-03-15 14:38:38 +09:00
parent e3e19a156c
commit c1f56c7c0e
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49

View File

@ -14,22 +14,26 @@ namespace osu.Game.Screens.Select.Leaderboards
private ScrollContainer scrollContainer;
private FillFlowContainer<LeaderboardScore> scrollFlow;
private Score[] scores;
public Score[] Scores
private IEnumerable<Score> scores;
public IEnumerable<Score> Scores
{
get { return scores; }
set
{
if (value == scores) return;
scores = value;
var scoreDisplays = new List<LeaderboardScore>();
for (int i = 0; i < value.Length; i++)
scrollFlow.Clear();
if (scores == null)
return;
int i = 0;
foreach(var s in scores)
{
scoreDisplays.Add(new LeaderboardScore(value[i], i + 1));
scrollFlow.Add(new LeaderboardScore(s, i + 1));
i++;
}
scrollFlow.Children = scoreDisplays;
scrollContainer.ScrollTo(0f, false);
}
}