Index -> Rank + some formatting.

This commit is contained in:
Dean Herbert 2017-03-16 13:15:06 +09:00
parent 8e5d83b857
commit ff37d2da03
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
2 changed files with 28 additions and 26 deletions

View File

@ -37,16 +37,16 @@ namespace osu.Game.Screens.Select.Leaderboards
scrollFlow.Clear(); scrollFlow.Clear();
i = 0; 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, AlwaysPresent = true,
State = Visibility.Hidden, State = Visibility.Hidden,
}; };
scrollFlow.Add(ls); scrollFlow.Add(ls);
ls.Delay((i - 1) * 50, true); ls.Delay(i++ * 50, true);
ls.Show(); 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() public Leaderboard()
{ {
Children = new Drawable[] 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)));
}
}
} }
} }

View File

@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select.Leaderboards
private Container flagBadgeContainer; private Container flagBadgeContainer;
private FillFlowContainer<ScoreModIcon> modsContainer; private FillFlowContainer<ScoreModIcon> modsContainer;
public readonly int Index; public readonly int Rank;
public readonly Score Score; public readonly Score Score;
private Visibility state; private Visibility state;
@ -112,10 +112,10 @@ namespace osu.Game.Screens.Select.Leaderboards
base.OnHoverLost(state); base.OnHoverLost(state);
} }
public LeaderboardScore(Score score, int i) public LeaderboardScore(Score score, int rank)
{ {
Score = score; Score = score;
Index = i; Rank = rank;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = height; Height = height;
@ -124,12 +124,14 @@ namespace osu.Game.Screens.Select.Leaderboards
flag.Width = 30; flag.Width = 30;
flag.RelativeSizeAxes = Axes.Y; flag.RelativeSizeAxes = Axes.Y;
const float rank_width = 30;
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Container
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = 40, Width = rank_width,
Children = new[] Children = new[]
{ {
new OsuSpriteText new OsuSpriteText
@ -138,14 +140,14 @@ namespace osu.Game.Screens.Select.Leaderboards
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Font = @"Exo2.0-MediumItalic", Font = @"Exo2.0-MediumItalic",
TextSize = 22, TextSize = 22,
Text = Index.ToString(), Text = Rank.ToString(),
}, },
}, },
}, },
content = new Container content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 40, }, Padding = new MarginPadding { Left = rank_width, },
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Container