Decouple APILegacyScoreInfo from ScoreInfo

This commit is contained in:
Dean Herbert
2019-12-03 15:28:10 +09:00
parent 8a6b2e681a
commit f0d49d0cdf
14 changed files with 254 additions and 227 deletions

View File

@ -21,6 +21,9 @@ namespace osu.Game.Screens.Select.Leaderboards
{
public Action<ScoreInfo> ScoreSelected;
[Resolved]
private RulesetStore rulesets { get; set; }
private BeatmapInfo beatmap;
public BeatmapInfo Beatmap
@ -172,7 +175,7 @@ namespace osu.Game.Screens.Select.Leaderboards
req.Success += r =>
{
scoresCallback?.Invoke(r.Scores);
scoresCallback?.Invoke(r.Scores.Select(s => s.CreateScoreInfo(rulesets)));
TopScore = r.UserScore;
};

View File

@ -3,6 +3,7 @@
using System;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -10,6 +11,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets;
using osu.Game.Scoring;
using osuTK;
@ -27,6 +29,9 @@ namespace osu.Game.Screens.Select.Leaderboards
protected override bool StartHidden => true;
[Resolved]
private RulesetStore rulesets { get; set; }
public UserTopScoreContainer()
{
RelativeSizeAxes = Axes.X;
@ -77,9 +82,11 @@ namespace osu.Game.Screens.Select.Leaderboards
if (newScore == null)
return;
LoadComponentAsync(new LeaderboardScore(newScore.Score, newScore.Position, false)
var scoreInfo = newScore.Score.CreateScoreInfo(rulesets);
LoadComponentAsync(new LeaderboardScore(scoreInfo, newScore.Position, false)
{
Action = () => ScoreSelected?.Invoke(newScore.Score)
Action = () => ScoreSelected?.Invoke(scoreInfo)
}, drawableScore =>
{
scoreContainer.Child = drawableScore;