1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Merge pull request #14391 from Game4all/localise-beatmap-set-overlay

Localise beatmap set overlay
This commit is contained in:
Dan Balasescu 2021-08-23 14:14:07 +09:00 committed by GitHub
commit 29f6ea7ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 143 additions and 68 deletions

View File

@ -39,6 +39,16 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString Height => new TranslatableString(getKey(@"height"), @"Height");
/// <summary>
/// "Downloading..."
/// </summary>
public static LocalisableString Downloading => new TranslatableString(getKey(@"downloading"), @"Downloading...");
/// <summary>
/// "Importing..."
/// </summary>
public static LocalisableString Importing => new TranslatableString(getKey(@"importing"), @"Importing...");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

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,26 @@ namespace osu.Game.Overlays.BeatmapSet
Direction = FillDirection.Horizontal,
Children = new[]
{
length = new Statistic(BeatmapStatisticsIconType.Length, "Length") { Width = 0.25f },
bpm = new Statistic(BeatmapStatisticsIconType.Bpm, "BPM") { Width = 0.25f },
circleCount = new Statistic(BeatmapStatisticsIconType.Circles, "Circle Count") { Width = 0.25f },
sliderCount = new Statistic(BeatmapStatisticsIconType.Sliders, "Slider Count") { Width = 0.25f },
length = new Statistic(BeatmapStatisticsIconType.Length)
{
Width = 0.25f,
TooltipText = default,
},
bpm = new Statistic(BeatmapStatisticsIconType.Bpm)
{
Width = 0.25f,
TooltipText = BeatmapsetsStrings.ShowStatsBpm
},
circleCount = new Statistic(BeatmapStatisticsIconType.Circles)
{
Width = 0.25f,
TooltipText = BeatmapsetsStrings.ShowStatsCountCircles
},
sliderCount = new Statistic(BeatmapStatisticsIconType.Sliders)
{
Width = 0.25f,
TooltipText = BeatmapsetsStrings.ShowStatsCountSliders
},
},
};
}
@ -96,7 +115,7 @@ namespace osu.Game.Overlays.BeatmapSet
{
private readonly OsuSpriteText value;
public LocalisableString TooltipText { get; }
public LocalisableString TooltipText { get; set; }
public LocalisableString Value
{
@ -104,9 +123,8 @@ namespace osu.Game.Overlays.BeatmapSet
set => this.value.Text = value;
}
public Statistic(BeatmapStatisticsIconType icon, string name)
public Statistic(BeatmapStatisticsIconType icon)
{
TooltipText = name;
RelativeSizeAxes = Axes.X;
Height = 24f;

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");
}
}

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Notifications;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users;
using osuTK;
@ -35,7 +36,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{
if (!Enabled.Value) return string.Empty;
return (favourited.Value ? "Unfavourite" : "Favourite") + " this beatmapset";
return favourited.Value ? BeatmapsetsStrings.ShowDetailsUnfavourite : BeatmapsetsStrings.ShowDetailsFavourite;
}
}

View File

@ -15,6 +15,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Online;
using osu.Game.Online.API;
using osu.Game.Overlays.BeatmapListing.Panels;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
@ -27,7 +28,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
private readonly bool noVideo;
public LocalisableString TooltipText => button.Enabled.Value ? "download this beatmap" : "login to download";
public LocalisableString TooltipText => BeatmapsetsStrings.ShowDetailsDownloadDefault;
private readonly IBindable<User> localUser = new Bindable<User>();
@ -113,7 +114,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{
new OsuSpriteText
{
Text = "Downloading...",
Text = Localisation.CommonStrings.Downloading,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
},
};
@ -124,7 +125,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{
new OsuSpriteText
{
Text = "Importing...",
Text = Localisation.CommonStrings.Importing,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
},
};
@ -139,7 +140,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{
new OsuSpriteText
{
Text = "Download",
Text = BeatmapsetsStrings.ShowDetailsDownloadDefault,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
},
new OsuSpriteText
@ -158,12 +159,12 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
private void enabledChanged(ValueChangedEvent<bool> e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
private string getVideoSuffixText()
private LocalisableString getVideoSuffixText()
{
if (!BeatmapSet.Value.OnlineInfo.HasVideo)
return string.Empty;
return noVideo ? "without Video" : "with Video";
return noVideo ? BeatmapsetsStrings.ShowDetailsDownloadNoVideo : BeatmapsetsStrings.ShowDetailsDownloadVideo;
}
}
}

View File

@ -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 osu.Framework.Extensions;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -46,7 +47,7 @@ namespace osu.Game.Overlays.BeatmapSet
AutoSizeAxes = Axes.Y,
Child = new OsuSpriteText
{
Text = this.type.ToString(),
Text = this.type.GetLocalisableDescription(),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14),
},
},

View File

@ -1,14 +1,26 @@
// 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 osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.BeatmapSet
{
public enum MetadataType
{
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoTags))]
Tags,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoSource))]
Source,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoDescription))]
Description,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoGenre))]
Genre,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoLanguage))]
Language
}
}

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Select.Leaderboards;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
@ -30,15 +31,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
switch (scope)
{
default:
text.Text = @"No scores have been set yet. Maybe you can be the first!";
text.Text = BeatmapsetsStrings.ShowScoreboardNoScoresGlobal;
break;
case BeatmapLeaderboardScope.Friend:
text.Text = @"None of your friends have set a score on this map yet.";
text.Text = BeatmapsetsStrings.ShowScoreboardNoScoresFriend;
break;
case BeatmapLeaderboardScope.Country:
text.Text = @"No one from your country has set a score on this map yet.";
text.Text = BeatmapsetsStrings.ShowScoreboardNoScoresCountry;
break;
}
}

View File

@ -20,6 +20,7 @@ using osuTK;
using osuTK.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
@ -93,13 +94,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
var columns = new List<TableColumn>
{
new TableColumn("rank", Anchor.CentreRight, new Dimension(GridSizeMode.AutoSize)),
new TableColumn(BeatmapsetsStrings.ShowScoreboardHeadersRank, Anchor.CentreRight, new Dimension(GridSizeMode.AutoSize)),
new TableColumn("", Anchor.Centre, new Dimension(GridSizeMode.Absolute, 70)), // grade
new TableColumn("score", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)),
new TableColumn("accuracy", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, minSize: 60, maxSize: 70)),
new TableColumn(BeatmapsetsStrings.ShowScoreboardHeadersScore, Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)),
new TableColumn(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy, Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, minSize: 60, maxSize: 70)),
new TableColumn("", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, 25)), // flag
new TableColumn("player", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 125)),
new TableColumn("max combo", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 120))
new TableColumn(BeatmapsetsStrings.ShowScoreboardHeadersPlayer, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 125)),
new TableColumn(BeatmapsetsStrings.ShowScoreboardHeadersCombo, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 120))
};
// All statistics across all scores, unordered.
@ -124,9 +125,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
if (showPerformancePoints)
columns.Add(new TableColumn("pp", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, 30)));
columns.Add(new TableColumn(BeatmapsetsStrings.ShowScoreboardHeaderspp, Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, 30)));
columns.Add(new TableColumn("mods", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)));
columns.Add(new TableColumn(BeatmapsetsStrings.ShowScoreboardHeadersMods, Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)));
return columns.ToArray();
}
@ -140,7 +141,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
new OsuSpriteText
{
Text = $"#{index + 1}",
Text = (index + 1).ToLocalisableString(@"\##"),
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
},
new UpdateableRank(score.Rank)
@ -168,7 +169,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
username,
new OsuSpriteText
{
Text = $@"{score.MaxCombo:N0}x",
Text = score.MaxCombo.ToLocalisableString(@"0\x"),
Font = OsuFont.GetFont(size: text_size),
Colour = score.MaxCombo == score.Beatmap?.MaxCombo ? highAccuracyColour : Color4.White
}
@ -183,7 +184,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
content.Add(new OsuSpriteText
{
Text = stat.MaxCount == null ? $"{stat.Count}" : $"{stat.Count}/{stat.MaxCount}",
Text = stat.MaxCount == null ? stat.Count.ToLocalisableString(@"N0") : (LocalisableString)$"{stat.Count}/{stat.MaxCount}",
Font = OsuFont.GetFont(size: text_size),
Colour = stat.Count == 0 ? Color4.Gray : Color4.White
});
@ -193,7 +194,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
content.Add(new OsuSpriteText
{
Text = $@"{score.PP:N0}",
Text = score.PP.ToLocalisableString(@"N0"),
Font = OsuFont.GetFont(size: text_size)
});
}

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -13,6 +14,7 @@ using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
@ -61,9 +63,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Spacing = new Vector2(margin, 0),
Children = new Drawable[]
{
totalScoreColumn = new TextColumn("total score", largeFont, top_columns_min_width),
accuracyColumn = new TextColumn("accuracy", largeFont, top_columns_min_width),
maxComboColumn = new TextColumn("max combo", largeFont, top_columns_min_width)
totalScoreColumn = new TextColumn(BeatmapsetsStrings.ShowScoreboardHeadersScoreTotal, largeFont, top_columns_min_width),
accuracyColumn = new TextColumn(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy, largeFont, top_columns_min_width),
maxComboColumn = new TextColumn(BeatmapsetsStrings.ShowScoreboardHeadersCombo, largeFont, top_columns_min_width)
}
},
new FillFlowContainer
@ -81,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Direction = FillDirection.Horizontal,
Spacing = new Vector2(margin, 0),
},
ppColumn = new TextColumn("pp", smallFont, bottom_columns_min_width),
ppColumn = new TextColumn(BeatmapsetsStrings.ShowScoreboardHeaderspp, smallFont, bottom_columns_min_width),
modsColumn = new ModsInfoColumn(),
}
},
@ -111,10 +113,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
score = value;
accuracyColumn.Text = value.DisplayAccuracy;
maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
maxComboColumn.Text = value.MaxCombo.ToLocalisableString(@"0\x");
ppColumn.Alpha = value.Beatmap?.Status.GrantsPerformancePoints() == true ? 1 : 0;
ppColumn.Text = $@"{value.PP:N0}";
ppColumn.Text = value.PP.ToLocalisableString(@"N0");
statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn);
modsColumn.Mods = value.Mods;
@ -126,7 +128,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private TextColumn createStatisticsColumn(HitResultDisplayStatistic stat) => new TextColumn(stat.DisplayName, smallFont, bottom_columns_min_width)
{
Text = stat.MaxCount == null ? $"{stat.Count}" : $"{stat.Count}/{stat.MaxCount}"
Text = stat.MaxCount == null ? stat.Count.ToLocalisableString(@"N0") : (LocalisableString)$"{stat.Count}/{stat.MaxCount}"
};
private class InfoColumn : CompositeDrawable
@ -134,7 +136,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private readonly Box separator;
private readonly OsuSpriteText text;
public InfoColumn(string title, Drawable content, float? minWidth = null)
public InfoColumn(LocalisableString title, Drawable content, float? minWidth = null)
{
AutoSizeAxes = Axes.Both;
Margin = new MarginPadding { Vertical = 5 };
@ -194,12 +196,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
private readonly SpriteText text;
public TextColumn(string title, FontUsage font, float? minWidth = null)
public TextColumn(LocalisableString title, FontUsage font, float? minWidth = null)
: this(title, new OsuSpriteText { Font = font }, minWidth)
{
}
private TextColumn(string title, SpriteText text, float? minWidth = null)
private TextColumn(LocalisableString title, SpriteText text, float? minWidth = null)
: base(title, text, minWidth)
{
this.text = text;
@ -233,7 +235,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
private ModsInfoColumn(FillFlowContainer modsContainer)
: base("mods", modsContainer)
: base(BeatmapsetsStrings.ShowScoreboardHeadersMods, modsContainer)
{
this.modsContainer = modsContainer;
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@ -126,7 +127,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
public int? ScorePosition
{
set => rankText.Text = value == null ? "-" : $"#{value}";
set => rankText.Text = value == null ? (LocalisableString)"-" : value.ToLocalisableString(@"\##");
}
/// <summary>

View File

@ -4,10 +4,12 @@
using osu.Framework.Allocation;
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.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Screens.Select.Details;
namespace osu.Game.Overlays.BeatmapSet
@ -42,7 +44,7 @@ namespace osu.Game.Overlays.BeatmapSet
int playCount = beatmap?.OnlineInfo?.PlayCount ?? 0;
var rate = playCount != 0 ? (float)passCount / playCount : 0;
successPercent.Text = rate.ToString("0.#%");
successPercent.Text = rate.ToLocalisableString(@"0.#%");
successRate.Length = rate;
percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic);
@ -64,7 +66,7 @@ namespace osu.Game.Overlays.BeatmapSet
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Success Rate",
Text = BeatmapsetsStrings.ShowInfoSuccessRate,
Font = OsuFont.GetFont(size: 12)
},
successRate = new Bar
@ -89,7 +91,7 @@ namespace osu.Game.Overlays.BeatmapSet
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Points of Failure",
Text = BeatmapsetsStrings.ShowInfoPointsOfFailure,
Font = OsuFont.GetFont(size: 12),
Margin = new MarginPadding { Vertical = 20 },
},

View File

@ -9,6 +9,8 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Screens.Select.Details
{
@ -35,8 +37,8 @@ namespace osu.Game.Screens.Select.Details
if (metrics == null)
{
negativeRatings.Text = "0";
positiveRatings.Text = "0";
negativeRatings.Text = 0.ToLocalisableString(@"N0");
positiveRatings.Text = 0.ToLocalisableString(@"N0");
ratingsBar.Length = 0;
graph.Values = new float[rating_range];
}
@ -47,8 +49,8 @@ namespace osu.Game.Screens.Select.Details
var negativeCount = ratings.Take(rating_range / 2).Sum();
var totalCount = ratings.Sum();
negativeRatings.Text = negativeCount.ToString();
positiveRatings.Text = (totalCount - negativeCount).ToString();
negativeRatings.Text = negativeCount.ToLocalisableString(@"N0");
positiveRatings.Text = (totalCount - negativeCount).ToLocalisableString(@"N0");
ratingsBar.Length = totalCount == 0 ? 0 : (float)negativeCount / totalCount;
graph.Values = ratings.Take(rating_range).Select(r => (float)r);
}
@ -70,7 +72,7 @@ namespace osu.Game.Screens.Select.Details
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "User Rating",
Text = BeatmapsetsStrings.ShowStatsUserRating,
Font = OsuFont.GetFont(size: 12),
Margin = new MarginPadding { Bottom = 5 },
},
@ -88,14 +90,14 @@ namespace osu.Game.Screens.Select.Details
{
negativeRatings = new OsuSpriteText
{
Text = "0",
Text = 0.ToLocalisableString(@"N0"),
Font = OsuFont.GetFont(size: 12)
},
positiveRatings = new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Text = @"0",
Text = 0.ToLocalisableString(@"N0"),
Font = OsuFont.GetFont(size: 12)
},
},
@ -104,7 +106,7 @@ namespace osu.Game.Screens.Select.Details
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Rating Spread",
Text = BeatmapsetsStrings.ShowStatsRatingSpread,
Font = OsuFont.GetFont(size: 12),
Margin = new MarginPadding { Bottom = 5 },
},

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using System.ComponentModel;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Screens.Select.Leaderboards
{
@ -10,13 +12,13 @@ namespace osu.Game.Screens.Select.Leaderboards
[Description("Local Ranking")]
Local,
[Description("Country Ranking")]
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowScoreboardCountry))]
Country,
[Description("Global Ranking")]
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowScoreboardGlobal))]
Global,
[Description("Friend Ranking")]
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowScoreboardFriend))]
Friend,
}
}