Localise basic stats.

This commit is contained in:
Lucas A 2021-08-08 10:25:51 +02:00
parent fc48696718
commit bf0d4b6ef1

View File

@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
using osu.Game.Extensions;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
using osuTK;
namespace osu.Game.Overlays.BeatmapSet
@ -53,7 +54,7 @@ namespace osu.Game.Overlays.BeatmapSet
private void updateDisplay()
{
bpm.Value = BeatmapSet?.OnlineInfo?.BPM.ToString(@"0.##") ?? "-";
bpm.Value = BeatmapSet?.OnlineInfo?.BPM.ToLocalisableString(@"0.##") ?? (LocalisableString)"-";
if (beatmap == null)
{
@ -63,9 +64,11 @@ namespace osu.Game.Overlays.BeatmapSet
}
else
{
length.TooltipText = BeatmapsetsStrings.ShowStatsTotalLength(TimeSpan.FromMilliseconds(beatmap.Length).ToFormattedDuration());
length.Value = TimeSpan.FromMilliseconds(beatmap.Length).ToFormattedDuration();
circleCount.Value = beatmap.OnlineInfo.CircleCount.ToString();
sliderCount.Value = beatmap.OnlineInfo.SliderCount.ToString();
circleCount.Value = beatmap.OnlineInfo.CircleCount.ToLocalisableString("N0");
sliderCount.Value = beatmap.OnlineInfo.SliderCount.ToLocalisableString("N0");
}
}
@ -78,10 +81,10 @@ namespace osu.Game.Overlays.BeatmapSet
Direction = FillDirection.Horizontal,
Children = new[]
{
length = new Statistic(FontAwesome.Regular.Clock, "Length") { Width = 0.25f },
bpm = new Statistic(FontAwesome.Regular.Circle, "BPM") { Width = 0.25f },
circleCount = new Statistic(FontAwesome.Regular.Circle, "Circle Count") { Width = 0.25f },
sliderCount = new Statistic(FontAwesome.Regular.Circle, "Slider Count") { Width = 0.25f },
length = new Statistic(FontAwesome.Regular.Clock, BeatmapsetsStrings.ShowStatsTotalLength(string.Empty)) { Width = 0.25f },
bpm = new Statistic(FontAwesome.Regular.Circle, BeatmapsetsStrings.ShowStatsBpm) { Width = 0.25f },
circleCount = new Statistic(FontAwesome.Regular.Circle, BeatmapsetsStrings.ShowStatsCountCircles) { Width = 0.25f },
sliderCount = new Statistic(FontAwesome.Regular.Circle, BeatmapsetsStrings.ShowStatsCountSliders) { Width = 0.25f },
},
};
}
@ -96,7 +99,7 @@ namespace osu.Game.Overlays.BeatmapSet
{
private readonly OsuSpriteText value;
public LocalisableString TooltipText { get; }
public LocalisableString TooltipText { get; set; }
public LocalisableString Value
{
@ -104,7 +107,7 @@ namespace osu.Game.Overlays.BeatmapSet
set => this.value.Text = value;
}
public Statistic(IconUsage icon, string name)
public Statistic(IconUsage icon, LocalisableString name)
{
TooltipText = name;
RelativeSizeAxes = Axes.X;