1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 03:07:51 +08:00
osu-lazer/osu.Game/Overlays/Options/SliderOption.cs

53 lines
1.5 KiB
C#
Raw Normal View History

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,
IComparable, IFormattable, IConvertible, IComparable<T>, IEquatable<T>
{
private SliderBar<T> slider;
private SpriteText text;
2016-12-02 06:31:21 +08:00
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; }
}
2016-12-02 06:31:21 +08:00
public SliderOption()
{
Direction = FlowDirection.VerticalOnly;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
text = new SpriteText { Alpha = 0 },
slider = new SliderBar<T>
{
Margin = new MarginPadding { Top = 5 },
Height = 10,
RelativeSizeAxes = Axes.X,
Color = Color4.White,
SelectionColor = new Color4(255, 102, 170, 255),
}
};
}
}
}