From ff37d2da038043d7ecc68286c7f655bc057e373e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 13:15:06 +0900 Subject: [PATCH] Index -> Rank + some formatting. --- .../Select/Leaderboards/Leaderboard.cs | 40 +++++++++---------- .../Select/Leaderboards/LeaderboardScore.cs | 14 ++++--- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 3efd7f4099..b94f9df70c 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -37,16 +37,16 @@ namespace osu.Game.Screens.Select.Leaderboards scrollFlow.Clear(); i = 0; - foreach(var s in scores) + foreach (var s in scores) { - var ls = new LeaderboardScore(s, 1 + i++) + var ls = new LeaderboardScore(s, 1 + i) { AlwaysPresent = true, State = Visibility.Hidden, }; scrollFlow.Add(ls); - ls.Delay((i - 1) * 50, true); + ls.Delay(i++ * 50, true); ls.Show(); } @@ -54,23 +54,6 @@ namespace osu.Game.Screens.Select.Leaderboards } } - protected override void Update() - { - base.Update(); - - var fadeStart = scrollContainer.DrawHeight - 10; - fadeStart += scrollContainer.IsScrolledToEnd() ? 70 : 0; - - foreach (var s in scrollFlow.Children) - { - var topY = scrollContainer.ScrollContent.DrawPosition.Y + s.DrawPosition.Y; - var bottomY = topY + 70; - - s.ColourInfo = ColourInfo.GradientVertical(Color4.White.Opacity(System.Math.Min((fadeStart - topY) / 70, 1)), - Color4.White.Opacity(System.Math.Min((fadeStart - bottomY) / 70, 1))); - } - } - public Leaderboard() { Children = new Drawable[] @@ -92,5 +75,22 @@ namespace osu.Game.Screens.Select.Leaderboards }, }; } + + protected override void Update() + { + base.Update(); + + var fadeStart = scrollContainer.DrawHeight - 10; + fadeStart += scrollContainer.IsScrolledToEnd() ? 70 : 0; + + foreach (var s in scrollFlow.Children) + { + var topY = scrollContainer.ScrollContent.DrawPosition.Y + s.DrawPosition.Y; + var bottomY = topY + 70; + + s.ColourInfo = ColourInfo.GradientVertical(Color4.White.Opacity(System.Math.Min((fadeStart - topY) / 70, 1)), + Color4.White.Opacity(System.Math.Min((fadeStart - bottomY) / 70, 1))); + } + } } } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 1c745ff7cb..0a5b29058d 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select.Leaderboards private Container flagBadgeContainer; private FillFlowContainer modsContainer; - public readonly int Index; + public readonly int Rank; public readonly Score Score; private Visibility state; @@ -112,10 +112,10 @@ namespace osu.Game.Screens.Select.Leaderboards base.OnHoverLost(state); } - public LeaderboardScore(Score score, int i) + public LeaderboardScore(Score score, int rank) { Score = score; - Index = i; + Rank = rank; RelativeSizeAxes = Axes.X; Height = height; @@ -124,12 +124,14 @@ namespace osu.Game.Screens.Select.Leaderboards flag.Width = 30; flag.RelativeSizeAxes = Axes.Y; + const float rank_width = 30; + Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Y, - Width = 40, + Width = rank_width, Children = new[] { new OsuSpriteText @@ -138,14 +140,14 @@ namespace osu.Game.Screens.Select.Leaderboards Origin = Anchor.CentreLeft, Font = @"Exo2.0-MediumItalic", TextSize = 22, - Text = Index.ToString(), + Text = Rank.ToString(), }, }, }, content = new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 40, }, + Padding = new MarginPadding { Left = rank_width, }, Children = new Drawable[] { new Container