Centralise implementation of slider bars which display millisecond time values

This commit is contained in:
Dean Herbert 2022-03-04 12:25:19 +09:00
parent 7854a0a913
commit 33862fc0db
4 changed files with 16 additions and 16 deletions

View File

@ -45,10 +45,5 @@ namespace osu.Game.Rulesets.Mania
}
};
}
private class TimeSlider : OsuSliderBar<double>
{
protected override LocalisableString GetTooltipText(double value) => $"{value:N0} ms";
}
}
}

View File

@ -0,0 +1,15 @@
// 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.
using osu.Framework.Localisation;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// A slider bar which displays a millisecond time value.
/// </summary>
public class TimeSlider : OsuSliderBar<double>
{
protected override LocalisableString GetTooltipText(double value) => $"{value:N0} ms";
}
}

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{
Children = new Drawable[]
{
new SettingsSlider<double, OffsetSlider>
new SettingsSlider<double, TimeSlider>
{
LabelText = AudioSettingsStrings.AudioOffset,
Current = config.GetBindable<double>(OsuSetting.AudioOffset),
@ -35,10 +35,5 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
}
};
}
private class OffsetSlider : OsuSliderBar<double>
{
protected override LocalisableString GetTooltipText(double value) => value.ToString(@"0ms");
}
}
}

View File

@ -43,10 +43,5 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
},
};
}
private class TimeSlider : OsuSliderBar<double>
{
protected override LocalisableString GetTooltipText(double value) => $"{value:N0} ms";
}
}
}