Localise hit result name

This commit is contained in:
naoei 2022-08-14 14:54:02 -04:00
parent 18ce784ae0
commit 45e9eda9e7
8 changed files with 21 additions and 13 deletions

View File

@ -23,6 +23,7 @@ using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using System; using System;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Catch.Edit; using osu.Game.Rulesets.Catch.Edit;
using osu.Game.Rulesets.Catch.Skinning.Legacy; using osu.Game.Rulesets.Catch.Skinning.Legacy;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
@ -162,7 +163,7 @@ namespace osu.Game.Rulesets.Catch
}; };
} }
public override string GetDisplayNameForHitResult(HitResult result) public override LocalisableString GetDisplayNameForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -15,6 +15,7 @@ using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Replays.Types; using osu.Game.Rulesets.Replays.Types;
@ -356,7 +357,7 @@ namespace osu.Game.Rulesets.Mania
}; };
} }
public override string GetDisplayNameForHitResult(HitResult result) public override LocalisableString GetDisplayNameForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -32,6 +32,7 @@ using osu.Game.Skinning;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Osu.Edit.Setup; using osu.Game.Rulesets.Osu.Edit.Setup;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Skinning.Legacy; using osu.Game.Rulesets.Osu.Skinning.Legacy;
@ -253,7 +254,7 @@ namespace osu.Game.Rulesets.Osu
}; };
} }
public override string GetDisplayNameForHitResult(HitResult result) public override LocalisableString GetDisplayNameForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -25,6 +25,7 @@ using osu.Game.Scoring;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Taiko.Edit; using osu.Game.Rulesets.Taiko.Edit;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
@ -192,7 +193,7 @@ namespace osu.Game.Rulesets.Taiko
}; };
} }
public override string GetDisplayNameForHitResult(HitResult result) public override LocalisableString GetDisplayNameForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -10,6 +10,8 @@ using osuTK;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
@ -126,7 +128,7 @@ namespace osu.Game.Online.Leaderboards
private class HitResultCell : CompositeDrawable private class HitResultCell : CompositeDrawable
{ {
private readonly string displayName; private readonly LocalisableString displayName;
private readonly HitResult result; private readonly HitResult result;
private readonly int count; private readonly int count;
@ -134,7 +136,7 @@ namespace osu.Game.Online.Leaderboards
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
displayName = stat.DisplayName; displayName = stat.DisplayName.ToUpper();
result = stat.Result; result = stat.Result;
count = stat.Count; count = stat.Count;
} }
@ -153,7 +155,7 @@ namespace osu.Game.Online.Leaderboards
new OsuSpriteText new OsuSpriteText
{ {
Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold), Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold),
Text = displayName.ToUpperInvariant(), Text = displayName.ToUpper(),
Colour = colours.ForHitResult(result), Colour = colours.ForHitResult(result),
}, },
new OsuSpriteText new OsuSpriteText

View File

@ -59,7 +59,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
/// <summary> /// <summary>
/// The statistics that appear in the table, in order of appearance. /// The statistics that appear in the table, in order of appearance.
/// </summary> /// </summary>
private readonly List<(HitResult result, string displayName)> statisticResultTypes = new List<(HitResult, string)>(); private readonly List<(HitResult result, LocalisableString displayName)> statisticResultTypes = new List<(HitResult, LocalisableString)>();
private bool showPerformancePoints; private bool showPerformancePoints;
@ -114,7 +114,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
if (result.IsBonus()) if (result.IsBonus())
continue; continue;
string displayName = ruleset.GetDisplayNameForHitResult(result); var displayName = ruleset.GetDisplayNameForHitResult(result);
columns.Add(new TableColumn(displayName, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 35, maxSize: 60))); columns.Add(new TableColumn(displayName, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 35, maxSize: 60)));
statisticResultTypes.Add((result, displayName)); statisticResultTypes.Add((result, displayName));

View File

@ -28,6 +28,7 @@ using osu.Game.Users;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Localisation;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.Rulesets.Filter; using osu.Game.Rulesets.Filter;
@ -313,7 +314,7 @@ namespace osu.Game.Rulesets
/// <returns> /// <returns>
/// All valid <see cref="HitResult"/>s along with a display-friendly name. /// All valid <see cref="HitResult"/>s along with a display-friendly name.
/// </returns> /// </returns>
public IEnumerable<(HitResult result, string displayName)> GetHitResults() public IEnumerable<(HitResult result, LocalisableString displayName)> GetHitResults()
{ {
var validResults = GetValidHitResults(); var validResults = GetValidHitResults();
@ -351,7 +352,7 @@ namespace osu.Game.Rulesets
/// </summary> /// </summary>
/// <param name="result">The result type to get the name for.</param> /// <param name="result">The result type to get the name for.</param>
/// <returns>The display name.</returns> /// <returns>The display name.</returns>
public virtual string GetDisplayNameForHitResult(HitResult result) => result.GetDescription(); public virtual LocalisableString GetDisplayNameForHitResult(HitResult result) => result.GetLocalisableDescription();
/// <summary> /// <summary>
/// Creates ruleset-specific beatmap filter criteria to be used on the song select screen. /// Creates ruleset-specific beatmap filter criteria to be used on the song select screen.

View File

@ -3,6 +3,7 @@
#nullable disable #nullable disable
using osu.Framework.Localisation;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
namespace osu.Game.Scoring namespace osu.Game.Scoring
@ -30,9 +31,9 @@ namespace osu.Game.Scoring
/// <summary> /// <summary>
/// A custom display name for the result type. May be provided by rulesets to give better clarity. /// A custom display name for the result type. May be provided by rulesets to give better clarity.
/// </summary> /// </summary>
public string DisplayName { get; } public LocalisableString DisplayName { get; }
public HitResultDisplayStatistic(HitResult result, int count, int? maxCount, string displayName) public HitResultDisplayStatistic(HitResult result, int count, int? maxCount, LocalisableString displayName)
{ {
Result = result; Result = result;
Count = count; Count = count;