1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:02:57 +08:00

Allow using SizeSlider on different value types

This commit is contained in:
Salman Ahmed 2022-02-16 03:25:03 +03:00
parent f7edf25d4c
commit 7654584e40
4 changed files with 8 additions and 6 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.UserInterface
private TestExpandingContainer container;
private SettingsToolboxGroup toolboxGroup;
private ExpandableSlider<float, SizeSlider> slider1;
private ExpandableSlider<float, SizeSlider<float>> slider1;
private ExpandableSlider<double> slider2;
[SetUp]
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Width = 1,
Children = new Drawable[]
{
slider1 = new ExpandableSlider<float, SizeSlider>
slider1 = new ExpandableSlider<float, SizeSlider<float>>
{
Current = new BindableFloat
{

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
Children = new Drawable[]
{
new SettingsSlider<float, SizeSlider>
new SettingsSlider<float, SizeSlider<float>>
{
LabelText = SkinSettingsStrings.GameplayCursorSize,
Current = config.GetBindable<float>(OsuSetting.GameplayCursorSize),

View File

@ -1,6 +1,7 @@
// 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 System;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface;
@ -9,8 +10,9 @@ namespace osu.Game.Overlays.Settings.Sections
/// <summary>
/// A slider intended to show a "size" multiplier number, where 1x is 1.0.
/// </summary>
internal class SizeSlider : OsuSliderBar<float>
internal class SizeSlider<T> : OsuSliderBar<T>
where T : struct, IEquatable<T>, IComparable<T>, IConvertible, IFormattable
{
public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x");
public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x", null);
}
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
LabelText = UserInterfaceStrings.CursorRotation,
Current = config.GetBindable<bool>(OsuSetting.CursorRotation)
},
new SettingsSlider<float, SizeSlider>
new SettingsSlider<float, SizeSlider<float>>
{
LabelText = UserInterfaceStrings.MenuCursorSize,
Current = config.GetBindable<float>(OsuSetting.MenuCursorSize),