2017-02-07 12:59:30 +08: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-15 03:59:23 +08:00
|
|
|
|
|
2016-11-30 22:08:11 +08:00
|
|
|
|
using osu.Framework.Configuration;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2017-04-21 19:59:04 +08:00
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2017-01-31 17:53:52 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2017-02-04 16:50:58 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2016-11-30 22:08:11 +08:00
|
|
|
|
|
2016-12-08 04:39:21 +08:00
|
|
|
|
namespace osu.Game.Overlays.Options
|
|
|
|
|
{
|
2017-04-21 19:59:04 +08:00
|
|
|
|
public class OptionSlider<T> : OptionSlider<T, OsuSliderBar<T>> where T: struct
|
2016-12-08 04:39:21 +08:00
|
|
|
|
{
|
2017-04-21 19:59:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-24 23:10:00 +08:00
|
|
|
|
public class OptionSlider<T, U> : FillFlowContainer where T : struct where U : SliderBar<T>, new()
|
2017-04-21 19:59:04 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly SliderBar<T> slider;
|
2017-03-23 12:41:50 +08:00
|
|
|
|
private readonly SpriteText text;
|
2017-02-13 23:35:24 +08:00
|
|
|
|
|
2016-12-08 04:39:21 +08:00
|
|
|
|
public string LabelText
|
|
|
|
|
{
|
|
|
|
|
get { return text.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
text.Text = value;
|
|
|
|
|
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-13 23:35:24 +08:00
|
|
|
|
|
2017-04-10 15:22:36 +08:00
|
|
|
|
private Bindable<T> bindable;
|
|
|
|
|
|
2017-04-10 14:30:17 +08:00
|
|
|
|
public Bindable<T> Bindable
|
2016-12-08 04:39:21 +08:00
|
|
|
|
{
|
2017-02-13 23:35:24 +08:00
|
|
|
|
set
|
|
|
|
|
{
|
2017-04-10 15:22:36 +08:00
|
|
|
|
bindable = value;
|
2017-04-10 16:10:15 +08:00
|
|
|
|
slider.Current.BindTo(bindable);
|
2017-02-13 23:35:24 +08:00
|
|
|
|
}
|
2016-12-08 04:39:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-31 17:37:11 +08:00
|
|
|
|
public OptionSlider()
|
2016-12-08 04:39:21 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2017-02-04 16:50:58 +08:00
|
|
|
|
Padding = new MarginPadding { Right = 5 };
|
|
|
|
|
|
2016-12-08 04:39:21 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-02-04 16:50:58 +08:00
|
|
|
|
text = new OsuSpriteText
|
|
|
|
|
{
|
2017-01-31 17:37:11 +08:00
|
|
|
|
Alpha = 0,
|
|
|
|
|
},
|
2017-04-21 19:59:04 +08:00
|
|
|
|
slider = new U()
|
2016-12-08 04:39:21 +08:00
|
|
|
|
{
|
2017-02-04 19:57:08 +08:00
|
|
|
|
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
|
|
|
|
RelativeSizeAxes = Axes.X
|
2016-12-08 04:39:21 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-09 21:18:58 +08:00
|
|
|
|
}
|