2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-02-07 12:59:30 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-12-15 03:59:23 +08:00
|
|
|
|
|
2017-05-16 21:49:38 +08:00
|
|
|
|
using System;
|
2017-10-23 13:36:08 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2016-11-30 22:08:11 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-02-04 16:50:58 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2016-11-30 22:08:11 +08:00
|
|
|
|
|
2017-05-15 09:55:29 +08:00
|
|
|
|
namespace osu.Game.Overlays.Settings
|
2016-12-08 04:39:21 +08:00
|
|
|
|
{
|
2017-05-15 09:55:29 +08:00
|
|
|
|
public class SettingsSlider<T> : SettingsSlider<T, OsuSliderBar<T>>
|
2018-01-10 14:41:13 +08:00
|
|
|
|
where T : struct, IEquatable<T>, IComparable, IConvertible
|
2016-12-08 04:39:21 +08:00
|
|
|
|
{
|
2017-04-21 19:59:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-15 09:55:29 +08:00
|
|
|
|
public class SettingsSlider<T, U> : SettingsItem<T>
|
2018-01-10 14:41:13 +08:00
|
|
|
|
where T : struct, IEquatable<T>, IComparable, IConvertible
|
2018-01-05 13:37:32 +08:00
|
|
|
|
where U : OsuSliderBar<T>, new()
|
2017-04-21 19:59:04 +08:00
|
|
|
|
{
|
2017-07-13 14:02:45 +08:00
|
|
|
|
protected override Drawable CreateControl() => new U
|
2016-12-08 04:39:21 +08:00
|
|
|
|
{
|
2017-05-04 22:07:24 +08:00
|
|
|
|
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
|
|
|
|
RelativeSizeAxes = Axes.X
|
|
|
|
|
};
|
2017-10-23 13:36:08 +08:00
|
|
|
|
|
|
|
|
|
public float KeyboardStep;
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
var slider = Control as U;
|
|
|
|
|
if (slider != null)
|
|
|
|
|
slider.KeyboardStep = KeyboardStep;
|
|
|
|
|
}
|
2016-12-08 04:39:21 +08:00
|
|
|
|
}
|
2016-12-09 21:18:58 +08:00
|
|
|
|
}
|