1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 11:22:55 +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 ScrollContainer scrollContainer;
private FillFlowContainer<LeaderboardScore> scrollFlow; private FillFlowContainer<LeaderboardScore> scrollFlow;
private Score[] scores; private IEnumerable<Score> scores;
public Score[] Scores public IEnumerable<Score> Scores
{ {
get { return scores; } get { return scores; }
set set
{ {
if (value == scores) return;
scores = value; scores = value;
var scoreDisplays = new List<LeaderboardScore>(); scrollFlow.Clear();
for (int i = 0; i < value.Length; i++)
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); scrollContainer.ScrollTo(0f, false);
} }
} }