osu/osu.Game/Overlays/Options/OptionSlider.cs

58 lines
1.7 KiB
C#
Raw Normal View History

2016-12-14 19:59:23 +00:00
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
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;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
2016-12-07 20:39:21 +00:00
namespace osu.Game.Overlays.Options
{
public class OptionSlider<T> : FlowContainer where T : struct
2016-12-07 20:39:21 +00:00
{
private SliderBar<T> slider;
private SpriteText text;
public string LabelText
{
get { return text.Text; }
set
{
text.Text = value;
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
}
}
public BindableNumber<T> Bindable
{
get { return slider.Bindable; }
set { slider.Bindable = value; }
}
public OptionSlider()
2016-12-07 20:39:21 +00:00
{
Direction = FlowDirection.VerticalOnly;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = 5 };
2016-12-07 20:39:21 +00:00
Children = new Drawable[]
{
text = new OsuSpriteText
{
Alpha = 0,
},
2016-12-07 20:39:21 +00:00
slider = new OsuSliderBar<T>
{
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
}