mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
I guess this works...
This commit is contained in:
@ -10,8 +10,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -25,20 +23,16 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private readonly Box leftBox;
|
private readonly Box leftBox;
|
||||||
private readonly Box rightBox;
|
private readonly Box rightBox;
|
||||||
|
|
||||||
public Func<T, string> TooltipTextFunc { get; set; }
|
public virtual string TooltipText
|
||||||
|
|
||||||
public string TooltipText
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (TooltipTextFunc != null) return TooltipTextFunc(Current);
|
|
||||||
|
|
||||||
var bindableDouble = CurrentNumber as BindableNumber<double>;
|
var bindableDouble = CurrentNumber as BindableNumber<double>;
|
||||||
if (bindableDouble != null)
|
if (bindableDouble != null)
|
||||||
{
|
{
|
||||||
if (bindableDouble.MaxValue == 1 && (bindableDouble.MinValue == 0 || bindableDouble.MinValue == -1))
|
if (bindableDouble.MaxValue == 1 && (bindableDouble.MinValue == 0 || bindableDouble.MinValue == -1))
|
||||||
return bindableDouble.Value.ToString(@"P0");
|
return bindableDouble.Value.ToString(@"P0");
|
||||||
return bindableDouble.Value.ToString(@"n1", CultureInfo.InvariantCulture);
|
return bindableDouble.Value.ToString(@"n1");
|
||||||
}
|
}
|
||||||
|
|
||||||
var bindableInt = CurrentNumber as BindableNumber<int>;
|
var bindableInt = CurrentNumber as BindableNumber<int>;
|
||||||
|
@ -6,15 +6,19 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
public class OptionSlider<T> : FillFlowContainer where T : struct
|
public class OptionSlider<T> : OptionSlider<T, OsuSliderBar<T>> where T: struct
|
||||||
{
|
{
|
||||||
private readonly OsuSliderBar<T> slider;
|
}
|
||||||
|
|
||||||
|
public class OptionSlider<T,U> : FillFlowContainer where T : struct where U : SliderBar<T>, new()
|
||||||
|
{
|
||||||
|
private readonly SliderBar<T> slider;
|
||||||
private readonly SpriteText text;
|
private readonly SpriteText text;
|
||||||
|
|
||||||
public string LabelText
|
public string LabelText
|
||||||
@ -38,18 +42,6 @@ namespace osu.Game.Overlays.Options
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Func<T,string> TooltipText
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return slider.TooltipTextFunc;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
slider.TooltipTextFunc = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OptionSlider()
|
public OptionSlider()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -62,7 +54,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
},
|
},
|
||||||
slider = new OsuSliderBar<T>
|
slider = new U()
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||||
RelativeSizeAxes = Axes.X
|
RelativeSizeAxes = Axes.X
|
||||||
|
@ -18,11 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OptionSlider<double>
|
new OptionSlider<double,OffsetSlider>
|
||||||
{
|
{
|
||||||
LabelText = "Audio Offset",
|
LabelText = "Audio Offset",
|
||||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.AudioOffset)
|
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.AudioOffset)
|
||||||
TooltipText = value => value.ToString(@"0ms")
|
|
||||||
},
|
},
|
||||||
new OsuButton
|
new OsuButton
|
||||||
{
|
{
|
||||||
@ -31,5 +30,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class OffsetSlider : OsuSliderBar<double>
|
||||||
|
{
|
||||||
|
public override string TooltipText => Current.Value.ToString(@"0ms");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using System.Globalization;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.Gameplay
|
namespace osu.Game.Overlays.Options.Sections.Gameplay
|
||||||
{
|
{
|
||||||
@ -18,20 +18,23 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OptionSlider<double>
|
new OptionSlider<double,StarSlider>
|
||||||
{
|
{
|
||||||
LabelText = "Display beatmaps from",
|
LabelText = "Display beatmaps from",
|
||||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMinimum),
|
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMinimum)
|
||||||
TooltipText = value => value.ToString(@"0.## stars", CultureInfo.InvariantCulture)
|
|
||||||
},
|
},
|
||||||
new OptionSlider<double>
|
new OptionSlider<double,StarSlider>
|
||||||
{
|
{
|
||||||
LabelText = "up to",
|
LabelText = "up to",
|
||||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMaximum),
|
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMaximum)
|
||||||
TooltipText = value => value.ToString(@"0.## stars", CultureInfo.InvariantCulture)
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class StarSlider : OsuSliderBar<double>
|
||||||
|
{
|
||||||
|
public override string TooltipText => Current.Value.ToString(@"0.## stars");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Globalization;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -19,11 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Input
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OptionSlider<double>
|
new OptionSlider<double,SensitivitySlider>
|
||||||
{
|
{
|
||||||
LabelText = "Sensitivity",
|
LabelText = "Sensitivity",
|
||||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MouseSpeed),
|
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MouseSpeed)
|
||||||
TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture)
|
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OsuCheckbox
|
||||||
{
|
{
|
||||||
@ -57,5 +55,10 @@ namespace osu.Game.Overlays.Options.Sections.Input
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SensitivitySlider : OsuSliderBar<double>
|
||||||
|
{
|
||||||
|
public override string TooltipText => Current.Value.ToString(@"0.##x");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using System.Globalization;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections
|
namespace osu.Game.Overlays.Options.Sections
|
||||||
{
|
{
|
||||||
@ -60,17 +59,15 @@ namespace osu.Game.Overlays.Options.Sections
|
|||||||
LabelText = "Always use skin cursor",
|
LabelText = "Always use skin cursor",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
|
Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
|
||||||
},
|
},
|
||||||
new OptionSlider<double>
|
new OptionSlider<double,SizeSlider>
|
||||||
{
|
{
|
||||||
LabelText = "Menu cursor size",
|
LabelText = "Menu cursor size",
|
||||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MenuCursorSize),
|
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MenuCursorSize)
|
||||||
TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture)
|
|
||||||
},
|
},
|
||||||
new OptionSlider<double>
|
new OptionSlider<double,SizeSlider>
|
||||||
{
|
{
|
||||||
LabelText = "Gameplay cursor size",
|
LabelText = "Gameplay cursor size",
|
||||||
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.GameplayCursorSize),
|
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.GameplayCursorSize)
|
||||||
TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture)
|
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OsuCheckbox
|
||||||
{
|
{
|
||||||
@ -79,5 +76,10 @@ namespace osu.Game.Overlays.Options.Sections
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SizeSlider : OsuSliderBar<double>
|
||||||
|
{
|
||||||
|
public override string TooltipText => Current.Value.ToString(@"0.##x");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user