From 33862fc0dbc3bca229f2cf719cd3271cf5d131ff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 4 Mar 2022 12:25:19 +0900 Subject: [PATCH] Centralise implementation of slider bars which display millisecond time values --- .../ManiaSettingsSubsection.cs | 5 ----- osu.Game/Graphics/UserInterface/TimeSlider.cs | 15 +++++++++++++++ .../Settings/Sections/Audio/OffsetSettings.cs | 7 +------ .../Sections/UserInterface/GeneralSettings.cs | 5 ----- 4 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/TimeSlider.cs diff --git a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs index ae3c279d98..bd3b8c3b10 100644 --- a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs +++ b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs @@ -45,10 +45,5 @@ namespace osu.Game.Rulesets.Mania } }; } - - private class TimeSlider : OsuSliderBar - { - protected override LocalisableString GetTooltipText(double value) => $"{value:N0} ms"; - } } } diff --git a/osu.Game/Graphics/UserInterface/TimeSlider.cs b/osu.Game/Graphics/UserInterface/TimeSlider.cs new file mode 100644 index 0000000000..e99345f147 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/TimeSlider.cs @@ -0,0 +1,15 @@ +// 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; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// A slider bar which displays a millisecond time value. + /// + public class TimeSlider : OsuSliderBar + { + protected override LocalisableString GetTooltipText(double value) => $"{value:N0} ms"; + } +} diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index 1aaee5b540..673252a99e 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { Children = new Drawable[] { - new SettingsSlider + new SettingsSlider { LabelText = AudioSettingsStrings.AudioOffset, Current = config.GetBindable(OsuSetting.AudioOffset), @@ -35,10 +35,5 @@ namespace osu.Game.Overlays.Settings.Sections.Audio } }; } - - private class OffsetSlider : OsuSliderBar - { - protected override LocalisableString GetTooltipText(double value) => value.ToString(@"0ms"); - } } } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs index c9d3b72add..59894cbcae 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/GeneralSettings.cs @@ -43,10 +43,5 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface }, }; } - - private class TimeSlider : OsuSliderBar - { - protected override LocalisableString GetTooltipText(double value) => $"{value:N0} ms"; - } } }