Make leaderboard scores clickable.

This commit is contained in:
Dean Herbert 2017-04-11 14:01:47 +09:00
parent d51b37cb44
commit 7d32cc85c8
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
3 changed files with 7 additions and 1 deletions

View File

@ -23,6 +23,8 @@ namespace osu.Game.Screens.Select.Leaderboards
private readonly ScrollContainer scrollContainer; private readonly ScrollContainer scrollContainer;
private readonly FillFlowContainer<LeaderboardScore> scrollFlow; private readonly FillFlowContainer<LeaderboardScore> scrollFlow;
public Action<Score> ScoreSelected;
private IEnumerable<Score> scores; private IEnumerable<Score> scores;
public IEnumerable<Score> Scores public IEnumerable<Score> Scores
{ {
@ -52,6 +54,7 @@ namespace osu.Game.Screens.Select.Leaderboards
var ls = new LeaderboardScore(s, 1 + i) var ls = new LeaderboardScore(s, 1 + i)
{ {
AlwaysPresent = true, AlwaysPresent = true,
Action = () => ScoreSelected?.Invoke(s),
State = Visibility.Hidden, State = Visibility.Hidden,
}; };
scrollFlow.Add(ls); scrollFlow.Add(ls);

View File

@ -17,7 +17,7 @@ using osu.Game.Rulesets.Scoring;
namespace osu.Game.Screens.Select.Leaderboards namespace osu.Game.Screens.Select.Leaderboards
{ {
public class LeaderboardScore : Container, IStateful<Visibility> public class LeaderboardScore : ClickableContainer, IStateful<Visibility>
{ {
public static readonly float HEIGHT = 60; public static readonly float HEIGHT = 60;

View File

@ -12,6 +12,7 @@ using osu.Game.Graphics;
using osu.Game.Overlays.Mods; using osu.Game.Overlays.Mods;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
@ -35,6 +36,8 @@ namespace osu.Game.Screens.Select
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = 10, Right = 5 }, Padding = new MarginPadding { Top = 10, Right = 5 },
}); });
beatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s));
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]