1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:32:55 +08:00

Simplify text initialization

This commit is contained in:
Joseph Madamba 2023-09-04 12:59:21 -07:00
parent e70510ef19
commit 82fb9dc2ef
No known key found for this signature in database
GPG Key ID: 8B746C7BDDF0BD76

View File

@ -212,9 +212,6 @@ namespace osu.Game.Screens.Select
private StarRatingDisplay starRatingDisplay = null!; private StarRatingDisplay starRatingDisplay = null!;
private ILocalisedBindableString titleBinding = null!;
private ILocalisedBindableString artistBinding = null!;
private readonly WorkingBeatmap working; private readonly WorkingBeatmap working;
public IBindable<double> DisplayedStars => starRatingDisplay.DisplayedStars; public IBindable<double> DisplayedStars => starRatingDisplay.DisplayedStars;
@ -238,14 +235,11 @@ namespace osu.Game.Screens.Select
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LocalisationManager localisation) private void load()
{ {
var beatmapInfo = working.BeatmapInfo; var beatmapInfo = working.BeatmapInfo;
var metadata = working.Metadata; var metadata = working.Metadata;
titleBinding = localisation.GetLocalisedBindableString(new RomanisableString(metadata.TitleUnicode, metadata.Title));
artistBinding = localisation.GetLocalisedBindableString(new RomanisableString(metadata.ArtistUnicode, metadata.Artist));
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
@ -292,7 +286,7 @@ namespace osu.Game.Screens.Select
TitleLabel = new TruncatingSpriteText TitleLabel = new TruncatingSpriteText
{ {
Shadow = true, Shadow = true,
Current = { BindTarget = titleBinding }, Text = new RomanisableString(metadata.TitleUnicode, metadata.Title),
Font = OsuFont.TorusAlternate.With(size: 40, weight: FontWeight.SemiBold), Font = OsuFont.TorusAlternate.With(size: 40, weight: FontWeight.SemiBold),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}, },
@ -300,7 +294,7 @@ namespace osu.Game.Screens.Select
{ {
// TODO : figma design has a diffused shadow, instead of the solid one present here, not possible currently as far as i'm aware. // TODO : figma design has a diffused shadow, instead of the solid one present here, not possible currently as far as i'm aware.
Shadow = true, Shadow = true,
Current = { BindTarget = artistBinding }, Text = new RomanisableString(metadata.ArtistUnicode, metadata.Artist),
// Not sure if this should be semi bold or medium // Not sure if this should be semi bold or medium
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold), Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,