// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Game.Modes; namespace osu.Game.Screens.Select.Leaderboards { public class Leaderboard : Container { private ScrollContainer scrollContainer; private FillFlowContainer scrollFlow; private IEnumerable scores; public IEnumerable Scores { get { return scores; } set { scores = value; int i = 0; if (scores == null) { foreach (var c in scrollFlow.Children) c.FadeOut(150 + i++ * 10); return; } scrollFlow.Clear(); i = 0; foreach(var s in scores) { scrollFlow.Add(new LeaderboardScore(s, 1 + i++) { AlwaysPresent = true }); } scrollContainer.ScrollTo(0f, false); } } public Leaderboard() { Children = new Drawable[] { scrollContainer = new ScrollContainer { RelativeSizeAxes = Axes.Both, ScrollDraggerVisible = false, Children = new Drawable[] { scrollFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, 5f), Padding = new MarginPadding(5), }, }, }, }; } } }