1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 14:53:21 +08:00

Change most ruleset-accessible string types to Localisable strings

This commit is contained in:
naoei 2022-08-10 15:51:11 -04:00
parent 1721a91168
commit 8cb2e11766
6 changed files with 15 additions and 9 deletions

View File

@ -3,6 +3,7 @@
using System;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
namespace osu.Game.Rulesets.Mods
{
@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Mods
/// <summary>
/// The user readable description of this mod.
/// </summary>
string Description { get; }
LocalisableString Description { get; }
/// <summary>
/// The type of this mod.

View File

@ -9,6 +9,7 @@ using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Rulesets.UI;
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Mods
public virtual ModType Type => ModType.Fun;
[JsonIgnore]
public abstract string Description { get; }
public abstract LocalisableString Description { get; }
/// <summary>
/// The tooltip to display for this mod when used in a <see cref="ModIcon"/>.

View File

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

View File

@ -3,6 +3,7 @@
#nullable disable
using osu.Framework.Localisation;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Scoring
@ -30,9 +31,9 @@ namespace osu.Game.Scoring
/// <summary>
/// A custom display name for the result type. May be provided by rulesets to give better clarity.
/// </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;
Count = count;

View File

@ -8,6 +8,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
@ -31,7 +32,7 @@ namespace osu.Game.Screens.Play
protected const float TRANSITION_TIME = 500;
protected abstract string Message { get; }
protected abstract LocalisableString Message { get; }
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;

View File

@ -7,6 +7,7 @@ using System;
using JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
namespace osu.Game.Screens.Ranking.Statistics
{
@ -18,7 +19,7 @@ namespace osu.Game.Screens.Ranking.Statistics
/// <summary>
/// The name of this item.
/// </summary>
public readonly string Name;
public readonly LocalisableString Name;
/// <summary>
/// A function returning the <see cref="Drawable"/> content to be displayed.
@ -48,7 +49,7 @@ namespace osu.Game.Screens.Ranking.Statistics
/// <param name="createContent">A function returning the <see cref="Drawable"/> content to be displayed.</param>
/// <param name="requiresHitEvents">Whether this item requires hit events. If true, <see cref="CreateContent"/> will not be called if no hit events are available.</param>
/// <param name="dimension">The <see cref="Dimension"/> of this item. This can be thought of as the column dimension of an encompassing <see cref="GridContainer"/>.</param>
public StatisticItem([NotNull] string name, [NotNull] Func<Drawable> createContent, bool requiresHitEvents = false, [CanBeNull] Dimension dimension = null)
public StatisticItem(LocalisableString name, [NotNull] Func<Drawable> createContent, bool requiresHitEvents = false, [CanBeNull] Dimension dimension = null)
{
Name = name;
RequiresHitEvents = requiresHitEvents;