From 295f8210253d8663cad9df30bc3e0bde88955a61 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Mar 2017 17:11:08 +0900 Subject: [PATCH] Add leaderboard to song select. --- osu.Game/Screens/Select/PlaySongSelect.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 53f3a3a596..97e64f44e2 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -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); }