mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 18:53:51 +08:00
Make OsuSliderBar support both float and double values
This commit is contained in:
parent
33eaf96bcb
commit
ddc9edab54
@ -32,11 +32,18 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var bindableDouble = CurrentNumber as BindableNumber<double>;
|
var bindableDouble = CurrentNumber as BindableNumber<double>;
|
||||||
if (bindableDouble != null)
|
var bindableFloat = CurrentNumber as BindableNumber<float>;
|
||||||
|
var floatValue = bindableDouble?.Value ?? bindableFloat?.Value ?? null;
|
||||||
|
|
||||||
|
if (floatValue != null)
|
||||||
{
|
{
|
||||||
if (bindableDouble.MaxValue == 1 && (bindableDouble.MinValue == 0 || bindableDouble.MinValue == -1))
|
var floatMinValue = bindableDouble?.MinValue ?? bindableFloat?.MinValue ?? null;
|
||||||
return bindableDouble.Value.ToString(@"P0");
|
var floatMaxValue = bindableDouble?.MaxValue ?? bindableFloat?.MaxValue ?? null;
|
||||||
return bindableDouble.Value.ToString(@"n1");
|
|
||||||
|
if (floatMaxValue == 1 && (floatMinValue == 0 || floatMinValue == -1))
|
||||||
|
return floatValue.Value.ToString(@"P0");
|
||||||
|
|
||||||
|
return floatValue.Value.ToString(@"n1");
|
||||||
}
|
}
|
||||||
|
|
||||||
var bindableInt = CurrentNumber as BindableNumber<int>;
|
var bindableInt = CurrentNumber as BindableNumber<int>;
|
||||||
|
Loading…
Reference in New Issue
Block a user