mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 21:42:55 +08:00
Scores should be enumerable.
This commit is contained in:
parent
e3e19a156c
commit
c1f56c7c0e
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user