diff --git a/osu.Game/Overlays/Options/OptionDropDown.cs b/osu.Game/Overlays/Options/OptionDropDown.cs index 690d3d21a5..9c9cd17b12 100644 --- a/osu.Game/Overlays/Options/OptionDropDown.cs +++ b/osu.Game/Overlays/Options/OptionDropDown.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; +using System.Collections.Generic; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System.Collections.Generic; namespace osu.Game.Overlays.Options { @@ -33,12 +32,8 @@ namespace osu.Game.Overlays.Options get { return bindable; } set { - if (bindable != null) - bindable.ValueChanged -= bindable_ValueChanged; bindable = value; - bindable.ValueChanged += bindable_ValueChanged; - bindable_ValueChanged(null, null); - + dropdown.SelectedValue.BindTo(bindable); if (bindable.Disabled) Alpha = 0.3f; } @@ -46,23 +41,6 @@ namespace osu.Game.Overlays.Options private Bindable bindable; - private void bindable_ValueChanged(object sender, EventArgs e) - { - dropdown.SelectedValue = bindable.Value; - } - - private void dropdown_ValueChanged(object sender, EventArgs e) - { - bindable.Value = dropdown.SelectedValue; - } - - protected override void Dispose(bool isDisposing) - { - bindable.ValueChanged -= bindable_ValueChanged; - dropdown.ValueChanged -= dropdown_ValueChanged; - base.Dispose(isDisposing); - } - private IEnumerable> items; public IEnumerable> Items { @@ -73,15 +51,8 @@ namespace osu.Game.Overlays.Options set { items = value; - if(dropdown != null) - { + if (dropdown != null) dropdown.Items = value; - - // We need to refresh the dropdown because our items changed, - // thus its selected value may be outdated. - if (bindable != null) - dropdown.SelectedValue = bindable.Value; - } } } @@ -104,7 +75,6 @@ namespace osu.Game.Overlays.Options Items = Items, } }; - dropdown.ValueChanged += dropdown_ValueChanged; } } }