mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Merge
This commit is contained in:
commit
27ab8e2e86
@ -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,6 +124,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
flag.Width = 30;
|
||||
flag.RelativeSizeAxes = Axes.Y;
|
||||
|
||||
const float rank_width = 30;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
@ -138,7 +140,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = @"Exo2.0-MediumItalic",
|
||||
TextSize = 22,
|
||||
Text = Index.ToString(),
|
||||
Text = Rank.ToString(),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -58,20 +58,21 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
beatmap?.Mods.BindTo(modSelect.SelectedMods);
|
||||
|
||||
updateLeaderboard(beatmap);
|
||||
|
||||
base.OnBeatmapChanged(beatmap);
|
||||
}
|
||||
|
||||
private void updateLeaderboard(WorkingBeatmap beatmap)
|
||||
{
|
||||
leaderboard.Scores = null;
|
||||
getScoresRequest?.Cancel();
|
||||
|
||||
if (beatmap != null)
|
||||
{
|
||||
getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo);
|
||||
getScoresRequest.Success += res =>
|
||||
{
|
||||
leaderboard.Scores = res.Scores;
|
||||
};
|
||||
Game.API.Queue(getScoresRequest);
|
||||
}
|
||||
if (beatmap?.BeatmapInfo == null) return;
|
||||
|
||||
base.OnBeatmapChanged(beatmap);
|
||||
getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo);
|
||||
getScoresRequest.Success += r => leaderboard.Scores = r.Scores;
|
||||
Game.API.Queue(getScoresRequest);
|
||||
}
|
||||
|
||||
protected override void OnResuming(Screen last)
|
||||
|
Loading…
Reference in New Issue
Block a user