1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 23:23:04 +08:00

Add leaderboard to song select.

This commit is contained in:
Dean Herbert 2017-03-15 17:11:08 +09:00
parent 4f95378f27
commit 295f821025
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49

View File

@ -8,9 +8,11 @@ using osu.Framework.Graphics.Primitives;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Mods;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select.Leaderboards;
namespace osu.Game.Screens.Select
{
@ -18,6 +20,7 @@ namespace osu.Game.Screens.Select
{
private OsuScreen player;
private ModSelectOverlay modSelect;
private Leaderboard leaderboard;
public PlaySongSelect()
{
@ -28,6 +31,11 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.BottomCentre,
Margin = new MarginPadding { Bottom = 50 }
});
LeftContent.Add(leaderboard = new Leaderboard
{
RelativeSizeAxes = Axes.Both,
});
}
[BackgroundDependencyLoader]
@ -47,6 +55,18 @@ namespace osu.Game.Screens.Select
protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
{
beatmap?.Mods.BindTo(modSelect.SelectedMods);
leaderboard.Scores = null;
if (beatmap != null)
{
var getScores = new GetScoresRequest(beatmap.BeatmapInfo);
getScores.Success += res =>
{
leaderboard.Scores = res.Scores;
};
Game.API.Queue(getScores);
}
base.OnBeatmapChanged(beatmap);
}