mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:23:20 +08:00
Fix potentially missing metadata on local score display
This commit is contained in:
parent
24b944fc8e
commit
27cc68152d
@ -8,6 +8,7 @@ using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -45,8 +46,16 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(BeatmapManager beatmaps)
|
||||
{
|
||||
var metadata = score.Beatmap.Metadata;
|
||||
|
||||
if (metadata == null)
|
||||
{
|
||||
var beatmap = beatmaps.QueryBeatmap(b => b.ID == score.BeatmapInfoID);
|
||||
metadata = beatmap.Metadata ?? beatmap.BeatmapSet.Metadata;
|
||||
}
|
||||
|
||||
var topStatistics = new List<StatisticDisplay>
|
||||
{
|
||||
new AccuracyStatistic(score.Accuracy),
|
||||
@ -81,14 +90,14 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = new LocalisedString((score.Beatmap.Metadata.Title, score.Beatmap.Metadata.TitleUnicode)),
|
||||
Text = new LocalisedString((metadata.Title, metadata.TitleUnicode)),
|
||||
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = new LocalisedString((score.Beatmap.Metadata.Artist, score.Beatmap.Metadata.ArtistUnicode)),
|
||||
Text = new LocalisedString((metadata.Artist, metadata.ArtistUnicode)),
|
||||
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold)
|
||||
},
|
||||
new Container
|
||||
|
Loading…
Reference in New Issue
Block a user