Change DrawableProfileScore to use APIScoreInfo

This commit is contained in:
Dean Herbert
2021-10-29 15:14:52 +09:00
parent 17a83f701a
commit 31403daa20
5 changed files with 65 additions and 62 deletions

View File

@ -12,9 +12,11 @@ using osu.Framework.Localisation;
using osu.Game.Beatmaps;
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.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Utils;
using osuTK;
namespace osu.Game.Overlays.Profile.Sections.Ranks
@ -26,7 +28,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
private const float performance_background_shear = 0.45f;
protected readonly ScoreInfo Score;
protected readonly APIScoreInfo Score;
[Resolved]
private OsuColour colours { get; set; }
@ -34,7 +36,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
public DrawableProfileScore(ScoreInfo score)
public DrawableProfileScore(APIScoreInfo score)
{
Score = score;
@ -43,7 +45,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
}
[BackgroundDependencyLoader]
private void load()
private void load(RulesetStore rulesets)
{
AddInternal(new ProfileItemContainer
{
@ -79,7 +81,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Spacing = new Vector2(0, 2),
Children = new Drawable[]
{
new ScoreBeatmapMetadataContainer(Score.BeatmapInfo),
new ScoreBeatmapMetadataContainer(Score.Beatmap),
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
@ -89,7 +91,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
new OsuSpriteText
{
Text = $"{Score.BeatmapInfo.Version}",
Text = $"{Score.Beatmap.DifficultyName}",
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
Colour = colours.Yellow
},
@ -129,7 +131,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Origin = Anchor.CentreRight,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(2),
Children = Score.Mods.Select(mod => new ModIcon(mod)
Children = Score.Mods.Select(mod => new ModIcon(rulesets.GetRuleset(Score.RulesetID).CreateInstance().CreateModFromAcronym(mod.Acronym))
{
Scale = new Vector2(0.35f)
}).ToList(),
@ -198,7 +200,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
RelativeSizeAxes = Axes.Y,
Child = new OsuSpriteText
{
Text = Score.DisplayAccuracy,
Text = Score.Accuracy.FormatAccuracy(),
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
Colour = colours.Yellow,
Anchor = Anchor.CentreLeft,