1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 10:43:04 +08:00

Add and wire up all sliderbar-based options

This commit is contained in:
Drew DeVault 2016-12-01 16:14:28 -05:00
parent 3aefa4d6a5
commit 92cf841589
6 changed files with 28 additions and 38 deletions

View File

@ -19,14 +19,11 @@ namespace osu.Game.Overlays.Options.Audio
{
Children = new Drawable[]
{
// TODO: bindable int crap
/*
new OptionsSlider
new OptionsSlider<int>
{
Label = "Universal Offset",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.Offset)
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.Offset)
},
*/
new OsuButton
{
RelativeSizeAxes = Axes.X,

View File

@ -20,9 +20,9 @@ namespace osu.Game.Overlays.Options.Audio
{
Children = new Drawable[]
{
new OptionsSlider { Label = "Master", Bindable = audio.Volume },
new OptionsSlider { Label = "Effect", Bindable = audio.VolumeSample },
new OptionsSlider { Label = "Music", Bindable = audio.VolumeTrack },
new OptionsSlider<double> { Label = "Master", Bindable = audio.Volume },
new OptionsSlider<double> { Label = "Effect", Bindable = audio.VolumeSample },
new OptionsSlider<double> { Label = "Music", Bindable = audio.VolumeTrack },
new CheckBoxOption
{
LabelText = "Ignore beatmap hitsounds",

View File

@ -20,17 +20,14 @@ namespace osu.Game.Overlays.Options.Gameplay
{
Children = new Drawable[]
{
// TODO: bindable int stuff
/*
new OptionsSlider
new OptionsSlider<int>
{
Label = "Background dim",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DimLevel)
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.DimLevel)
},
*/
new SpriteText { Text = "Progress display: TODO dropdown" },
new SpriteText { Text = "Score meter type: TODO dropdown" },
new OptionsSlider
new OptionsSlider<double>
{
Label = "Score meter size",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.ScoreMeterScale)

View File

@ -15,37 +15,35 @@ namespace osu.Game.Overlays.Options.Gameplay
{
protected override string Header => "Song Select";
//private BindableInt starMinimum, starMaximum;
//private StarCounter counterMin, counterMax;
private BindableInt starMinimum, starMaximum;
private StarCounter counterMin, counterMax;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
// TODO: Deal with bindable ints
/*
starMinimum = config.GetBindable<int>(OsuConfig.DisplayStarsMinimum);
starMaximum = config.GetBindable<int>(OsuConfig.DisplayStarsMaximum);
starMinimum = (BindableInt)config.GetBindable<int>(OsuConfig.DisplayStarsMinimum);
starMaximum = (BindableInt)config.GetBindable<int>(OsuConfig.DisplayStarsMaximum);
Children = new Drawable[]
{
new OptionsSlider { Label = "Display beatmaps from", Bindable = starMinimum },
new OptionsSlider<int> { Label = "Display beatmaps from", Bindable = starMinimum },
counterMin = new StarCounter { Count = starMinimum.Value },
new OptionsSlider { Label = "up to", Bindable = starMaximum },
new OptionsSlider<int> { Label = "up to", Bindable = starMaximum },
counterMax = new StarCounter { Count = starMaximum.Value },
};
starMinimum.ValueChanged += starValueChanged;
starMaximum.ValueChanged += starValueChanged;*/
starMaximum.ValueChanged += starValueChanged;
}
private void starValueChanged(object sender, EventArgs e)
{
//counterMin.Count = starMinimum.Value;
//counterMax.Count = starMaximum.Value;
counterMin.Count = starMinimum.Value;
counterMax.Count = starMaximum.Value;
}
protected override void Dispose(bool isDisposing)
{
//starMinimum.ValueChanged -= starValueChanged;
//starMaximum.ValueChanged -= starValueChanged;
starMinimum.ValueChanged -= starValueChanged;
starMaximum.ValueChanged -= starValueChanged;
base.Dispose(isDisposing);
}
}

View File

@ -31,19 +31,16 @@ namespace osu.Game.Overlays.Options.Graphics
LabelText = "Letterboxing",
Bindable = config.GetBindable<bool>(OsuConfig.Letterboxing),
},
// TODO: deal with bindable ints
/*
new OptionsSlider
new OptionsSlider<int>
{
Label = "Horizontal position",
Bindable = config.GetBindable<int>(OsuConfig.LetterboxPositionX)
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.LetterboxPositionX)
},
new OptionsSlider
new OptionsSlider<int>
{
Label = "Vertical position",
Bindable = config.GetBindable<int>(OsuConfig.LetterboxPositionY)
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.LetterboxPositionY)
},
*/
};
}
}

View File

@ -9,9 +9,10 @@ using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class OptionsSlider : FlowContainer
public class OptionsSlider<T> : FlowContainer where T : struct,
IComparable, IFormattable, IConvertible, IComparable<T>, IEquatable<T>
{
private SliderBar slider;
private SliderBar<T> slider;
private SpriteText text;
public string Label
@ -24,7 +25,7 @@ namespace osu.Game.Overlays.Options
}
}
public BindableDouble Bindable
public BindableNumber<T> Bindable
{
get { return slider.Bindable; }
set { slider.Bindable = value; }
@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Options
Children = new Drawable[]
{
text = new SpriteText { Alpha = 0 },
slider = new SliderBar
slider = new SliderBar<T>
{
Margin = new MarginPadding { Top = 5 },
Height = 10,