2016-11-30 22:08:11 +08:00
|
|
|
|
using System;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Options
|
|
|
|
|
{
|
2016-12-02 06:31:21 +08:00
|
|
|
|
public class SliderOption<T> : FlowContainer where T : struct,
|
2016-12-02 05:14:28 +08:00
|
|
|
|
IComparable, IFormattable, IConvertible, IComparable<T>, IEquatable<T>
|
2016-11-30 22:08:11 +08:00
|
|
|
|
{
|
2016-12-02 05:14:28 +08:00
|
|
|
|
private SliderBar<T> slider;
|
2016-11-30 22:08:11 +08:00
|
|
|
|
private SpriteText text;
|
|
|
|
|
|
2016-12-02 06:31:21 +08:00
|
|
|
|
public string LabelText
|
2016-11-30 22:08:11 +08:00
|
|
|
|
{
|
|
|
|
|
get { return text.Text; }
|
2016-11-30 23:32:07 +08:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
text.Text = value;
|
|
|
|
|
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
|
|
|
|
|
}
|
2016-11-30 22:08:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 05:14:28 +08:00
|
|
|
|
public BindableNumber<T> Bindable
|
2016-11-30 22:08:11 +08:00
|
|
|
|
{
|
|
|
|
|
get { return slider.Bindable; }
|
|
|
|
|
set { slider.Bindable = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-02 06:31:21 +08:00
|
|
|
|
public SliderOption()
|
2016-11-30 22:08:11 +08:00
|
|
|
|
{
|
|
|
|
|
Direction = FlowDirection.VerticalOnly;
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2016-11-30 23:32:07 +08:00
|
|
|
|
text = new SpriteText { Alpha = 0 },
|
2016-12-02 05:14:28 +08:00
|
|
|
|
slider = new SliderBar<T>
|
2016-11-30 22:08:11 +08:00
|
|
|
|
{
|
|
|
|
|
Margin = new MarginPadding { Top = 5 },
|
|
|
|
|
Height = 10,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Color = Color4.White,
|
|
|
|
|
SelectionColor = new Color4(255, 102, 170, 255),
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|