mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add support for localisation where it was missing
This commit is contained in:
@ -1,11 +1,10 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
@ -25,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// <param name="text">The text to display.</param>
|
||||
/// <param name="changeStateFunc">A function that mutates a state to another state after this <see cref="StatefulMenuItem"/> is pressed.</param>
|
||||
/// <param name="type">The type of action which this <see cref="StatefulMenuItem"/> performs.</param>
|
||||
protected StatefulMenuItem(string text, Func<object, object> changeStateFunc, MenuItemType type = MenuItemType.Standard)
|
||||
protected StatefulMenuItem(LocalisableString text, Func<object, object> changeStateFunc, MenuItemType type = MenuItemType.Standard)
|
||||
: this(text, changeStateFunc, type, null)
|
||||
{
|
||||
}
|
||||
@ -37,7 +36,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// <param name="changeStateFunc">A function that mutates a state to another state after this <see cref="StatefulMenuItem"/> is pressed.</param>
|
||||
/// <param name="type">The type of action which this <see cref="StatefulMenuItem"/> performs.</param>
|
||||
/// <param name="action">A delegate to be invoked when this <see cref="StatefulMenuItem"/> is pressed.</param>
|
||||
protected StatefulMenuItem(string text, Func<object, object> changeStateFunc, MenuItemType type, Action<object> action)
|
||||
protected StatefulMenuItem(LocalisableString text, Func<object, object>? changeStateFunc, MenuItemType type, Action<object>? action)
|
||||
: base(text, type)
|
||||
{
|
||||
Action.Value = () =>
|
||||
@ -69,7 +68,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// <param name="text">The text to display.</param>
|
||||
/// <param name="changeStateFunc">A function that mutates a state to another state after this <see cref="StatefulMenuItem"/> is pressed.</param>
|
||||
/// <param name="type">The type of action which this <see cref="StatefulMenuItem"/> performs.</param>
|
||||
protected StatefulMenuItem(string text, Func<T, T> changeStateFunc, MenuItemType type = MenuItemType.Standard)
|
||||
protected StatefulMenuItem(LocalisableString text, Func<T, T>? changeStateFunc, MenuItemType type = MenuItemType.Standard)
|
||||
: this(text, changeStateFunc, type, null)
|
||||
{
|
||||
}
|
||||
@ -81,7 +80,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// <param name="changeStateFunc">A function that mutates a state to another state after this <see cref="StatefulMenuItem"/> is pressed.</param>
|
||||
/// <param name="type">The type of action which this <see cref="StatefulMenuItem"/> performs.</param>
|
||||
/// <param name="action">A delegate to be invoked when this <see cref="StatefulMenuItem"/> is pressed.</param>
|
||||
protected StatefulMenuItem(string text, Func<T, T> changeStateFunc, MenuItemType type, Action<T> action)
|
||||
protected StatefulMenuItem(LocalisableString text, Func<T, T>? changeStateFunc, MenuItemType type, Action<T>? action)
|
||||
: base(text, o => changeStateFunc?.Invoke((T)o) ?? o, type, o => action?.Invoke((T)o))
|
||||
{
|
||||
base.State.BindValueChanged(state =>
|
||||
|
Reference in New Issue
Block a user