mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 05:52:54 +08:00
Index -> Rank + some formatting.
This commit is contained in:
parent
8e5d83b857
commit
ff37d2da03
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
private Container flagBadgeContainer;
|
||||
private FillFlowContainer<ScoreModIcon> 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
|
||||
|
Loading…
Reference in New Issue
Block a user