From 92cf8415897a0d59f655f364649ce3eb13dec462 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 16:14:28 -0500 Subject: [PATCH] Add and wire up all sliderbar-based options --- .../Options/Audio/OffsetAdjustmentOptions.cs | 7 ++---- .../Overlays/Options/Audio/VolumeOptions.cs | 6 ++--- .../Gameplay/GeneralGameplayOptions.cs | 9 +++---- .../Gameplay/SongSelectGameplayOptions.cs | 24 +++++++++---------- .../Options/Graphics/LayoutOptions.cs | 11 ++++----- osu.Game/Overlays/Options/OptionsSlider.cs | 9 +++---- 6 files changed, 28 insertions(+), 38 deletions(-) diff --git a/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs index 4d9598fabe..edb22f2ed4 100644 --- a/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs +++ b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs @@ -19,14 +19,11 @@ namespace osu.Game.Overlays.Options.Audio { Children = new Drawable[] { - // TODO: bindable int crap - /* - new OptionsSlider + new OptionsSlider { Label = "Universal Offset", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.Offset) + Bindable = (BindableInt)config.GetBindable(OsuConfig.Offset) }, - */ new OsuButton { RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs index f7d2614a96..f5c209da22 100644 --- a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs +++ b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs @@ -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 { Label = "Master", Bindable = audio.Volume }, + new OptionsSlider { Label = "Effect", Bindable = audio.VolumeSample }, + new OptionsSlider { Label = "Music", Bindable = audio.VolumeTrack }, new CheckBoxOption { LabelText = "Ignore beatmap hitsounds", diff --git a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index 81143c6127..1fc06afa2a 100644 --- a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -20,17 +20,14 @@ namespace osu.Game.Overlays.Options.Gameplay { Children = new Drawable[] { - // TODO: bindable int stuff - /* - new OptionsSlider + new OptionsSlider { Label = "Background dim", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DimLevel) + Bindable = (BindableInt)config.GetBindable(OsuConfig.DimLevel) }, - */ new SpriteText { Text = "Progress display: TODO dropdown" }, new SpriteText { Text = "Score meter type: TODO dropdown" }, - new OptionsSlider + new OptionsSlider { Label = "Score meter size", Bindable = (BindableDouble)config.GetBindable(OsuConfig.ScoreMeterScale) diff --git a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs index c4591976e3..638d12fd4a 100644 --- a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs @@ -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(OsuConfig.DisplayStarsMinimum); - starMaximum = config.GetBindable(OsuConfig.DisplayStarsMaximum); + starMinimum = (BindableInt)config.GetBindable(OsuConfig.DisplayStarsMinimum); + starMaximum = (BindableInt)config.GetBindable(OsuConfig.DisplayStarsMaximum); Children = new Drawable[] { - new OptionsSlider { Label = "Display beatmaps from", Bindable = starMinimum }, + new OptionsSlider { Label = "Display beatmaps from", Bindable = starMinimum }, counterMin = new StarCounter { Count = starMinimum.Value }, - new OptionsSlider { Label = "up to", Bindable = starMaximum }, + new OptionsSlider { 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); } } diff --git a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs index d4243a24b1..cd98eacd10 100644 --- a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs @@ -31,19 +31,16 @@ namespace osu.Game.Overlays.Options.Graphics LabelText = "Letterboxing", Bindable = config.GetBindable(OsuConfig.Letterboxing), }, - // TODO: deal with bindable ints - /* - new OptionsSlider + new OptionsSlider { Label = "Horizontal position", - Bindable = config.GetBindable(OsuConfig.LetterboxPositionX) + Bindable = (BindableInt)config.GetBindable(OsuConfig.LetterboxPositionX) }, - new OptionsSlider + new OptionsSlider { Label = "Vertical position", - Bindable = config.GetBindable(OsuConfig.LetterboxPositionY) + Bindable = (BindableInt)config.GetBindable(OsuConfig.LetterboxPositionY) }, - */ }; } } diff --git a/osu.Game/Overlays/Options/OptionsSlider.cs b/osu.Game/Overlays/Options/OptionsSlider.cs index 9f6e4e1552..5f335974be 100644 --- a/osu.Game/Overlays/Options/OptionsSlider.cs +++ b/osu.Game/Overlays/Options/OptionsSlider.cs @@ -9,9 +9,10 @@ using osu.Framework.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class OptionsSlider : FlowContainer + public class OptionsSlider : FlowContainer where T : struct, + IComparable, IFormattable, IConvertible, IComparable, IEquatable { - private SliderBar slider; + private SliderBar slider; private SpriteText text; public string Label @@ -24,7 +25,7 @@ namespace osu.Game.Overlays.Options } } - public BindableDouble Bindable + public BindableNumber 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 { Margin = new MarginPadding { Top = 5 }, Height = 10,