From d146da95466e5251f37376da8fbbf07701e6c1d2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Sep 2023 16:43:06 +0900 Subject: [PATCH] Fix rate adjust mods not showing "x" prefix on customisation slider's tooltip --- .../Settings/MultiplierSettingsSlider.cs | 24 +++++++++++++++++++ osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 3 ++- osu.Game/Rulesets/Mods/ModDoubleTime.cs | 3 ++- osu.Game/Rulesets/Mods/ModHalfTime.cs | 3 ++- osu.Game/Rulesets/Mods/ModTimeRamp.cs | 5 ++-- 5 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 osu.Game/Overlays/Settings/MultiplierSettingsSlider.cs diff --git a/osu.Game/Overlays/Settings/MultiplierSettingsSlider.cs b/osu.Game/Overlays/Settings/MultiplierSettingsSlider.cs new file mode 100644 index 0000000000..bd5b8f92b6 --- /dev/null +++ b/osu.Game/Overlays/Settings/MultiplierSettingsSlider.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Settings +{ + public partial class MultiplierSettingsSlider : SettingsSlider + { + public MultiplierSettingsSlider() + { + KeyboardStep = 0.01f; + } + + /// + /// A slider bar which adds a "x" to the end of the tooltip string. + /// + public partial class MultiplierRoundedSliderBar : RoundedSliderBar + { + public override LocalisableString TooltipText => $"{base.TooltipText}x"; + } + } +} diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index e7127abcf0..f62ba21827 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -10,6 +10,7 @@ using osu.Framework.Localisation; using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; @@ -35,7 +36,7 @@ namespace osu.Game.Rulesets.Mods public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp), typeof(ModAutoplay) }; - [SettingSource("Initial rate", "The starting speed of the track")] + [SettingSource("Initial rate", "The starting speed of the track", SettingControlType = typeof(MultiplierSettingsSlider))] public BindableNumber InitialRate { get; } = new BindableDouble(1) { MinValue = 0.5, diff --git a/osu.Game/Rulesets/Mods/ModDoubleTime.cs b/osu.Game/Rulesets/Mods/ModDoubleTime.cs index 733610c040..27e594edfe 100644 --- a/osu.Game/Rulesets/Mods/ModDoubleTime.cs +++ b/osu.Game/Rulesets/Mods/ModDoubleTime.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics; +using osu.Game.Overlays.Settings; namespace osu.Game.Rulesets.Mods { @@ -17,7 +18,7 @@ namespace osu.Game.Rulesets.Mods public override ModType Type => ModType.DifficultyIncrease; public override LocalisableString Description => "Zoooooooooom..."; - [SettingSource("Speed increase", "The actual increase to apply")] + [SettingSource("Speed increase", "The actual increase to apply", SettingControlType = typeof(MultiplierSettingsSlider))] public override BindableNumber SpeedChange { get; } = new BindableDouble(1.5) { MinValue = 1.01, diff --git a/osu.Game/Rulesets/Mods/ModHalfTime.cs b/osu.Game/Rulesets/Mods/ModHalfTime.cs index 06c7750035..7415c94cd8 100644 --- a/osu.Game/Rulesets/Mods/ModHalfTime.cs +++ b/osu.Game/Rulesets/Mods/ModHalfTime.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Graphics; +using osu.Game.Overlays.Settings; namespace osu.Game.Rulesets.Mods { @@ -17,7 +18,7 @@ namespace osu.Game.Rulesets.Mods public override ModType Type => ModType.DifficultyReduction; public override LocalisableString Description => "Less zoom..."; - [SettingSource("Speed decrease", "The actual decrease to apply")] + [SettingSource("Speed decrease", "The actual decrease to apply", SettingControlType = typeof(MultiplierSettingsSlider))] public override BindableNumber SpeedChange { get; } = new BindableDouble(0.75) { MinValue = 0.5, diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs index 7285315c3b..54ee0cd3bf 100644 --- a/osu.Game/Rulesets/Mods/ModTimeRamp.cs +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -7,6 +7,7 @@ using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Overlays.Settings; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mods @@ -20,10 +21,10 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 0.5; - [SettingSource("Initial rate", "The starting speed of the track")] + [SettingSource("Initial rate", "The starting speed of the track", SettingControlType = typeof(MultiplierSettingsSlider))] public abstract BindableNumber InitialRate { get; } - [SettingSource("Final rate", "The final speed to ramp to")] + [SettingSource("Final rate", "The final speed to ramp to", SettingControlType = typeof(MultiplierSettingsSlider))] public abstract BindableNumber FinalRate { get; } [SettingSource("Adjust pitch", "Should pitch be adjusted with speed")]