2017-02-07 04:59:30 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-12-14 19:59:23 +00:00
|
|
|
|
|
2016-11-30 14:08:11 +00:00
|
|
|
|
using osu.Framework.Configuration;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2017-01-31 09:53:52 +00:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2017-02-04 08:50:58 +00:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2016-11-30 14:08:11 +00:00
|
|
|
|
|
2016-12-07 20:39:21 +00:00
|
|
|
|
namespace osu.Game.Overlays.Options
|
|
|
|
|
{
|
2017-01-31 09:37:11 +00:00
|
|
|
|
public class OptionSlider<T> : FlowContainer where T : struct
|
2016-12-07 20:39:21 +00:00
|
|
|
|
{
|
|
|
|
|
private SliderBar<T> slider;
|
|
|
|
|
private SpriteText text;
|
2017-02-13 15:35:24 +00:00
|
|
|
|
|
2016-12-07 20:39:21 +00:00
|
|
|
|
public string LabelText
|
|
|
|
|
{
|
|
|
|
|
get { return text.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
text.Text = value;
|
|
|
|
|
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-13 15:35:24 +00:00
|
|
|
|
|
2016-12-07 20:39:21 +00:00
|
|
|
|
public BindableNumber<T> Bindable
|
|
|
|
|
{
|
|
|
|
|
get { return slider.Bindable; }
|
2017-02-13 15:35:24 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
slider.Bindable = value;
|
|
|
|
|
if (value?.Disabled ?? true)
|
|
|
|
|
Alpha = 0.3f;
|
|
|
|
|
}
|
2016-12-07 20:39:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-31 09:37:11 +00:00
|
|
|
|
public OptionSlider()
|
2016-12-07 20:39:21 +00:00
|
|
|
|
{
|
2017-02-27 15:55:55 +00:00
|
|
|
|
FlowStrategy = FlowStrategies.CreateFillFlow();
|
2016-12-07 20:39:21 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2017-02-04 08:50:58 +00:00
|
|
|
|
Padding = new MarginPadding { Right = 5 };
|
|
|
|
|
|
2016-12-07 20:39:21 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-02-04 08:50:58 +00:00
|
|
|
|
text = new OsuSpriteText
|
|
|
|
|
{
|
2017-01-31 09:37:11 +00:00
|
|
|
|
Alpha = 0,
|
|
|
|
|
},
|
2016-12-07 20:39:21 +00:00
|
|
|
|
slider = new OsuSliderBar<T>
|
|
|
|
|
{
|
2017-02-04 11:57:08 +00:00
|
|
|
|
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
|
|
|
|
RelativeSizeAxes = Axes.X
|
2016-12-07 20:39:21 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-09 13:18:58 +00:00
|
|
|
|
}
|