Update UI control access in line with framework changes.

This commit is contained in:
Dean Herbert
2017-04-10 14:31:08 +09:00
parent d2a889d2bb
commit bb4a909de5
11 changed files with 58 additions and 127 deletions

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
@ -15,38 +14,13 @@ namespace osu.Game.Overlays.Options
{
set
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
bindable = value;
if (bindable != null)
{
Text = bindable.Value;
bindable.ValueChanged += bindableValueChanged;
}
Current = bindable;
if (bindable?.Disabled ?? true)
Alpha = 0.3f;
}
}
public OptionTextBox()
{
OnChange += onChange;
}
private void onChange(TextBox sender, bool newText)
{
if (bindable != null)
bindable.Value = Text;
}
private void bindableValueChanged(string newValue) => Text = newValue;
protected override void Dispose(bool isDisposing)
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
base.Dispose(isDisposing);
}
}
}