diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index b14607f235..3d9f3aad79 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -99,6 +99,7 @@ namespace osu.Desktop.VisualTests.Tests AddToggleStep(@"auto", state => { auto = state; load(mode); }); + BasicSliderBar sliderBar; Add(new Container { Anchor = Anchor.TopRight, @@ -107,16 +108,17 @@ namespace osu.Desktop.VisualTests.Tests Children = new Drawable[] { new SpriteText { Text = "Playback Speed" }, - new BasicSliderBar + sliderBar = new BasicSliderBar { Width = 150, Height = 10, SelectionColor = Color4.Orange, - Current = playbackSpeed } } }); + sliderBar.Current.BindTo(playbackSpeed); + framedClock.ProcessFrame(); var clockAdjustContainer = new Container diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index d41da04b3e..b1b9ddbcda 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -44,6 +44,8 @@ namespace osu.Desktop.VisualTests.Tests kc.Add(new KeyCounterKeyboard(key)); }); + TestSliderBar sliderBar; + Add(new Container { Anchor = Anchor.TopRight, @@ -52,16 +54,17 @@ namespace osu.Desktop.VisualTests.Tests Children = new Drawable[] { new SpriteText { Text = "FadeTime" }, - new TestSliderBar + sliderBar =new TestSliderBar { Width = 150, Height = 10, SelectionColor = Color4.Orange, - Current = bindable } } }); + sliderBar.Current.BindTo(bindable); + Add(kc); } private class TestSliderBar : SliderBar where T : struct diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index a5a4fab3e1..82ede8f079 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -92,12 +92,6 @@ namespace osu.Game.Graphics.UserInterface } } - private readonly Bindable current = new Bindable(); - - public Bindable Current - { - get { return current; } - set { current.BindTo(value); } - } + public Bindable Current { get; } = new Bindable(); } } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 6dfbc931cf..d339388aa5 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface set { bindable = value; - Current = bindable; + Current.BindTo(bindable); if (value?.Disabled ?? true) Alpha = 0.3f; } @@ -69,13 +69,14 @@ namespace osu.Game.Graphics.UserInterface labelSpriteText = new OsuSpriteText(), nub = new Nub { - Current = Current, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 5 }, } }; + nub.Current.BindTo(Current); + Current.ValueChanged += newValue => { if (newValue) diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index 332c95328b..ee12ba9b05 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Options set { bindable = value; - dropdown.Current = bindable; + dropdown.Current.BindTo(bindable); if (value?.Disabled ?? true) Alpha = 0.3f; } diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 0b0a9b8b50..1c4b54a080 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Options set { bindable = value; - slider.Current = bindable; + slider.Current.BindTo(bindable); if (value?.Disabled ?? true) Alpha = 0.3f; } diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index c2c8e91016..b5ef39c8b2 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options set { bindable = value; - Current = bindable; + Current.BindTo(bindable); if (value?.Disabled ?? true) Alpha = 0.3f; }