From f12b5a8954306c7cb94a50d0248cb1d8ab523ee7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 16:22:36 +0900 Subject: [PATCH] Unify disable logic. --- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 7 ++----- osu.Game/Overlays/Options/OptionDropdown.cs | 2 +- osu.Game/Overlays/Options/OptionSlider.cs | 6 ++++-- osu.Game/Overlays/Options/OptionTextBox.cs | 4 +--- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 5d4760fec6..6dfbc931cf 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -24,11 +24,8 @@ namespace osu.Game.Graphics.UserInterface set { bindable = value; - - if (bindable != null) - Current = bindable; - - if (bindable?.Disabled ?? true) + Current = bindable; + if (value?.Disabled ?? true) Alpha = 0.3f; } } diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index decf5896c2..332c95328b 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Options { bindable = value; dropdown.Current = bindable; - if (bindable.Disabled) + if (value?.Disabled ?? true) Alpha = 0.3f; } } diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 1cd9fdc60c..0b0a9b8b50 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -27,12 +27,14 @@ namespace osu.Game.Overlays.Options } } + private Bindable bindable; + public Bindable Bindable { - get { return slider.Current; } set { - slider.Current = value; + bindable = value; + slider.Current = 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 346c9f88f5..c2c8e91016 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -15,10 +15,8 @@ namespace osu.Game.Overlays.Options set { bindable = value; - Current = bindable; - - if (bindable?.Disabled ?? true) + if (value?.Disabled ?? true) Alpha = 0.3f; } }