diff --git a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs index 2f34987e8ebd..743d53fce5be 100644 --- a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs +++ b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs @@ -70,6 +70,26 @@ public static class SkinnableComponentStrings public static LocalisableString CollapseDuringGameplayDescription => new TranslatableString(getKey(@"if_enabled_the_leaderboard_will"), @"If enabled, the leaderboard will become more compact during active gameplay."); + /// + /// "Wireframe opacity" + /// + public static LocalisableString WireframeOpacity => new TranslatableString(getKey(@"wireframe_opacity"), @"Wireframe opacity"); + + /// + /// "Controls the opacity of the wireframes behind the digits." + /// + public static LocalisableString WireframeOpacityDescription => new TranslatableString(getKey(@"wireframe_opacity_description"), @"Controls the opacity of the wireframes behind the digits."); + + /// + /// "Inverted shear" + /// + public static LocalisableString InvertedShear => new TranslatableString(getKey(@"inverted_shear"), @"Inverted shear"); + + /// + /// "Bar height" + /// + public static LocalisableString BarHeight => new TranslatableString(getKey(@"bar_height"), @"Bar height"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Localisation/SkinComponents/SkinnableModDisplayStrings.cs b/osu.Game/Localisation/SkinComponents/SkinnableModDisplayStrings.cs index 22f9fe6d023f..063bdae4bd0d 100644 --- a/osu.Game/Localisation/SkinComponents/SkinnableModDisplayStrings.cs +++ b/osu.Game/Localisation/SkinComponents/SkinnableModDisplayStrings.cs @@ -7,7 +7,7 @@ namespace osu.Game.Localisation.SkinComponents { public static class SkinnableModDisplayStrings { - private const string prefix = @"osu.Game.Resources.Localisation.SkinnableModDisplay"; + private const string prefix = @"osu.Game.Resources.Localisation.SkinComponents.SkinnableModDisplay"; /// /// "Show extended information" diff --git a/osu.Game/Localisation/SkinEditorStrings.cs b/osu.Game/Localisation/SkinEditorStrings.cs index a8b3a5a3bc07..8a3639fb469d 100644 --- a/osu.Game/Localisation/SkinEditorStrings.cs +++ b/osu.Game/Localisation/SkinEditorStrings.cs @@ -34,6 +34,21 @@ public static class SkinEditorStrings /// public static LocalisableString Gameplay => new TranslatableString(getKey(@"gameplay"), @"Gameplay"); + /// + /// "HUD" + /// + public static LocalisableString MainHUDComponents => new TranslatableString(getKey(@"main_hud_components"), @"HUD"); + + /// + /// "Playfield" + /// + public static LocalisableString Playfield => new TranslatableString(getKey(@"playfield"), @"Playfield"); + + /// + /// "{0} ("{1}" only)" + /// + public static LocalisableString WorkingLayerOfRuleset(LocalisableString layerName, string rulesetName) => new TranslatableString(getKey(@"working_layer_of_ruleset"), @"{0} (""{1}"" only)", layerName, rulesetName); + /// /// "Settings ({0})" /// diff --git a/osu.Game/Overlays/SkinEditor/SkinEditor.cs b/osu.Game/Overlays/SkinEditor/SkinEditor.cs index 193d570a21f3..576ff3611393 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditor.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditor.cs @@ -11,6 +11,7 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; @@ -404,7 +405,7 @@ private void targetChanged(ValueChangedEvent ta { Children = new Drawable[] { - new SettingsDropdown + new GlobalSkinnableContainerLookupDropdown { Items = availableTargets.Select(t => t.Lookup).Distinct(), Current = selectedTarget, @@ -785,6 +786,32 @@ public RevertConfirmDialog(Action revert) } } + public partial class GlobalSkinnableContainerLookupDropdown : SettingsDropdown + { + protected override OsuDropdown CreateDropdown() => new DropdownControl(); + + protected new partial class DropdownControl : OsuDropdown + { + public DropdownControl() + { + RelativeSizeAxes = Axes.X; + } + + protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = 200); + + protected override LocalisableString GenerateItemText(GlobalSkinnableContainerLookup? item) + { + if (item == null) + return base.GenerateItemText(item); + + if (item.Ruleset == null) + return item.Lookup.GetLocalisableDescription(); + + return SkinEditorStrings.WorkingLayerOfRuleset(item.Lookup.GetLocalisableDescription(), item.Ruleset.Name); + } + } + } + #region Delegation of IEditorChangeHandler public event Action? OnStateChange; diff --git a/osu.Game/Screens/Play/HUD/ArgonAccuracyCounter.cs b/osu.Game/Screens/Play/HUD/ArgonAccuracyCounter.cs index c4cf52c2541e..bb46cd9f86d3 100644 --- a/osu.Game/Screens/Play/HUD/ArgonAccuracyCounter.cs +++ b/osu.Game/Screens/Play/HUD/ArgonAccuracyCounter.cs @@ -19,7 +19,7 @@ public partial class ArgonAccuracyCounter : GameplayAccuracyCounter, ISerialisab { protected override double RollingDuration => 250; - [SettingSource("Wireframe opacity", "Controls the opacity of the wireframes behind the digits.")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.WireframeOpacity), nameof(SkinnableComponentStrings.WireframeOpacityDescription))] public BindableFloat WireframeOpacity { get; } = new BindableFloat(0.25f) { Precision = 0.01f, diff --git a/osu.Game/Screens/Play/HUD/ArgonComboCounter.cs b/osu.Game/Screens/Play/HUD/ArgonComboCounter.cs index 22d65601cd73..ccaaff43ec6e 100644 --- a/osu.Game/Screens/Play/HUD/ArgonComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ArgonComboCounter.cs @@ -25,7 +25,7 @@ public partial class ArgonComboCounter : ComboCounter protected virtual bool DisplayXSymbol => true; - [SettingSource("Wireframe opacity", "Controls the opacity of the wireframes behind the digits.")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.WireframeOpacity), nameof(SkinnableComponentStrings.WireframeOpacityDescription))] public BindableFloat WireframeOpacity { get; } = new BindableFloat(0.25f) { Precision = 0.01f, diff --git a/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs b/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs index 44f021f93ec6..052db8f91865 100644 --- a/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ArgonHealthDisplay.cs @@ -26,7 +26,7 @@ public partial class ArgonHealthDisplay : HealthDisplay, ISerialisableDrawable { public bool UsesFixedAnchor { get; set; } - [SettingSource("Bar height")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.BarHeight))] public BindableFloat BarHeight { get; } = new BindableFloat(20) { MinValue = 0, diff --git a/osu.Game/Screens/Play/HUD/ArgonPerformancePointsCounter.cs b/osu.Game/Screens/Play/HUD/ArgonPerformancePointsCounter.cs index 8e9360920c44..fd59a0e03088 100644 --- a/osu.Game/Screens/Play/HUD/ArgonPerformancePointsCounter.cs +++ b/osu.Game/Screens/Play/HUD/ArgonPerformancePointsCounter.cs @@ -21,7 +21,7 @@ public partial class ArgonPerformancePointsCounter : PerformancePointsCounter, I private const float alpha_when_invalid = 0.3f; - [SettingSource("Wireframe opacity", "Controls the opacity of the wireframes behind the digits.")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.WireframeOpacity), nameof(SkinnableComponentStrings.WireframeOpacityDescription))] public BindableFloat WireframeOpacity { get; } = new BindableFloat(0.25f) { Precision = 0.01f, diff --git a/osu.Game/Screens/Play/HUD/ArgonScoreCounter.cs b/osu.Game/Screens/Play/HUD/ArgonScoreCounter.cs index f000a5977ca3..9578b583636e 100644 --- a/osu.Game/Screens/Play/HUD/ArgonScoreCounter.cs +++ b/osu.Game/Screens/Play/HUD/ArgonScoreCounter.cs @@ -20,7 +20,7 @@ public partial class ArgonScoreCounter : GameplayScoreCounter, ISerialisableDraw protected override double RollingDuration => 250; - [SettingSource("Wireframe opacity", "Controls the opacity of the wireframes behind the digits.")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.WireframeOpacity), nameof(SkinnableComponentStrings.WireframeOpacityDescription))] public BindableFloat WireframeOpacity { get; } = new BindableFloat(0.25f) { Precision = 0.01f, diff --git a/osu.Game/Screens/Play/HUD/ArgonUnstableRateCounter.cs b/osu.Game/Screens/Play/HUD/ArgonUnstableRateCounter.cs index d6e6bc21119e..9b981eafe68d 100644 --- a/osu.Game/Screens/Play/HUD/ArgonUnstableRateCounter.cs +++ b/osu.Game/Screens/Play/HUD/ArgonUnstableRateCounter.cs @@ -19,7 +19,7 @@ public partial class ArgonUnstableRateCounter : UnstableRateCounter, ISerialisab private const float alpha_when_invalid = 0.3f; - [SettingSource("Wireframe opacity", "Controls the opacity of the wireframes behind the digits.")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.WireframeOpacity), nameof(SkinnableComponentStrings.WireframeOpacityDescription))] public BindableFloat WireframeOpacity { get; } = new BindableFloat(0.25f) { Precision = 0.01f, diff --git a/osu.Game/Screens/Play/HUD/ArgonWedgePiece.cs b/osu.Game/Screens/Play/HUD/ArgonWedgePiece.cs index 810100532b6e..9b0c2fa66e2b 100644 --- a/osu.Game/Screens/Play/HUD/ArgonWedgePiece.cs +++ b/osu.Game/Screens/Play/HUD/ArgonWedgePiece.cs @@ -19,7 +19,7 @@ public partial class ArgonWedgePiece : CompositeDrawable, ISerialisableDrawable { public bool UsesFixedAnchor { get; set; } - [SettingSource("Inverted shear")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.InvertedShear))] public BindableBool InvertShear { get; } = new BindableBool(); [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.Colour))] diff --git a/osu.Game/Skinning/Components/ArgonJudgementCounterDisplay.cs b/osu.Game/Skinning/Components/ArgonJudgementCounterDisplay.cs index 99c88fad8a99..5f1d1abdc19e 100644 --- a/osu.Game/Skinning/Components/ArgonJudgementCounterDisplay.cs +++ b/osu.Game/Skinning/Components/ArgonJudgementCounterDisplay.cs @@ -23,7 +23,7 @@ public partial class ArgonJudgementCounterDisplay : CompositeDrawable, ISerialis [Resolved] private JudgementCountController judgementCountController { get; set; } = null!; - [SettingSource("Wireframe opacity", "Controls the opacity of the wireframes behind the digits.")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.WireframeOpacity), nameof(SkinnableComponentStrings.WireframeOpacityDescription))] public BindableFloat WireframeOpacity { get; } = new BindableFloat(0.25f) { Precision = 0.01f, diff --git a/osu.Game/Skinning/GlobalSkinnableContainerLookup.cs b/osu.Game/Skinning/GlobalSkinnableContainerLookup.cs index 6d78981f0a67..419a0afeda66 100644 --- a/osu.Game/Skinning/GlobalSkinnableContainerLookup.cs +++ b/osu.Game/Skinning/GlobalSkinnableContainerLookup.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Extensions; using osu.Game.Rulesets; namespace osu.Game.Skinning @@ -29,13 +28,6 @@ public GlobalSkinnableContainerLookup(GlobalSkinnableContainers lookup, RulesetI Ruleset = ruleset; } - public override string ToString() - { - if (Ruleset == null) return Lookup.GetDescription(); - - return $"{Lookup.GetDescription()} (\"{Ruleset.Name}\" only)"; - } - public bool Equals(GlobalSkinnableContainerLookup? other) { if (ReferenceEquals(null, other)) return false; diff --git a/osu.Game/Skinning/GlobalSkinnableContainers.cs b/osu.Game/Skinning/GlobalSkinnableContainers.cs index 02f915895f37..4095cc0721a5 100644 --- a/osu.Game/Skinning/GlobalSkinnableContainers.cs +++ b/osu.Game/Skinning/GlobalSkinnableContainers.cs @@ -1,7 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.ComponentModel; +using osu.Framework.Localisation; +using osu.Game.Localisation; namespace osu.Game.Skinning { @@ -10,13 +11,13 @@ namespace osu.Game.Skinning /// public enum GlobalSkinnableContainers { - [Description("HUD")] + [LocalisableDescription(typeof(SkinEditorStrings), nameof(SkinEditorStrings.MainHUDComponents))] MainHUDComponents, - [Description("Song select")] + [LocalisableDescription(typeof(SkinEditorStrings), nameof(SkinEditorStrings.SongSelect))] SongSelect, - [Description("Playfield")] + [LocalisableDescription(typeof(SkinEditorStrings), nameof(SkinEditorStrings.Playfield))] Playfield } }