mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Refactor BeatmapMetadataContainer
and usages to use interface types
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
@ -245,30 +246,42 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
|
||||
private class ScoreBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||
{
|
||||
public ScoreBeatmapMetadataContainer(BeatmapInfo beatmapInfo)
|
||||
public ScoreBeatmapMetadataContainer(IBeatmapInfo beatmapInfo)
|
||||
: base(beatmapInfo)
|
||||
{
|
||||
}
|
||||
|
||||
protected override Drawable[] CreateText(BeatmapInfo beatmapInfo) => new Drawable[]
|
||||
protected override Drawable[] CreateText(IBeatmapInfo beatmapInfo)
|
||||
{
|
||||
new OsuSpriteText
|
||||
var metadata = beatmapInfo.Metadata;
|
||||
|
||||
Debug.Assert(metadata != null);
|
||||
|
||||
return new Drawable[]
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Text = new RomanisableString(
|
||||
$"{beatmapInfo.Metadata.TitleUnicode ?? beatmapInfo.Metadata.Title} ",
|
||||
$"{beatmapInfo.Metadata.Title ?? beatmapInfo.Metadata.TitleUnicode} "),
|
||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Text = "by " + new RomanisableString(beatmapInfo.Metadata.ArtistUnicode, beatmapInfo.Metadata.Artist),
|
||||
Font = OsuFont.GetFont(size: 12, italics: true)
|
||||
},
|
||||
};
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Text = new RomanisableString(metadata.TitleUnicode, metadata.Title),
|
||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Text = " by ",
|
||||
Font = OsuFont.GetFont(size: 12, italics: true)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Text = new RomanisableString(metadata.ArtistUnicode, metadata.Artist),
|
||||
Font = OsuFont.GetFont(size: 12, italics: true)
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user