Localise beatmap picker.

This commit is contained in:
Lucas A
2021-08-06 22:50:57 +02:00
parent a9c99f149a
commit 7bbc917f75

View File

@ -11,11 +11,13 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
using osuTK;
@ -26,7 +28,8 @@ namespace osu.Game.Overlays.BeatmapSet
private const float tile_icon_padding = 7;
private const float tile_spacing = 2;
private readonly OsuSpriteText version, starRating;
private readonly OsuSpriteText version, starRating, starRatingText;
private readonly FillFlowContainer starRatingContainer;
private readonly Statistic plays, favourites;
public readonly DifficultiesContainer Difficulties;
@ -68,14 +71,14 @@ namespace osu.Game.Overlays.BeatmapSet
OnLostHover = () =>
{
showBeatmap(Beatmap.Value);
starRating.FadeOut(100);
starRatingContainer.FadeOut(100);
},
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(5f),
Children = new[]
Children = new Drawable[]
{
version = new OsuSpriteText
{
@ -83,14 +86,31 @@ namespace osu.Game.Overlays.BeatmapSet
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: 17, weight: FontWeight.Bold)
},
starRating = new OsuSpriteText
starRatingContainer = new FillFlowContainer
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Bold),
Text = "Star Difficulty",
Alpha = 0,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(2f, 0),
Margin = new MarginPadding { Bottom = 1 },
Children = new[]
{
starRatingText = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Bold),
Text = BeatmapsetsStrings.ShowStatsStars,
},
starRating = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Bold),
Text = string.Empty,
},
}
},
},
},
@ -124,6 +144,7 @@ namespace osu.Game.Overlays.BeatmapSet
private void load(OsuColour colours)
{
starRating.Colour = colours.Yellow;
starRatingText.Colour = colours.Yellow;
updateDisplay();
}
@ -149,14 +170,14 @@ namespace osu.Game.Overlays.BeatmapSet
OnHovered = beatmap =>
{
showBeatmap(beatmap);
starRating.Text = beatmap.StarDifficulty.ToString("Star Difficulty 0.##");
starRating.FadeIn(100);
starRating.Text = beatmap.StarDifficulty.ToLocalisableString(@"0.##");
starRatingContainer.FadeIn(100);
},
OnClicked = beatmap => { Beatmap.Value = beatmap; },
});
}
starRating.FadeOut(100);
starRatingContainer.FadeOut(100);
Beatmap.Value = Difficulties.FirstOrDefault()?.Beatmap;
plays.Value = BeatmapSet?.OnlineInfo.PlayCount ?? 0;
favourites.Value = BeatmapSet?.OnlineInfo.FavouriteCount ?? 0;
@ -300,7 +321,7 @@ namespace osu.Game.Overlays.BeatmapSet
set
{
this.value = value;
text.Text = Value.ToString(@"N0");
text.Text = Value.ToLocalisableString(@"N0");
}
}