Merge branch 'master' into general-fixes

This commit is contained in:
Dean Herbert
2017-02-15 01:14:25 +09:00
committed by GitHub
7 changed files with 178 additions and 154 deletions

View File

@ -34,29 +34,32 @@ namespace osu.Game.Overlays.Options
set
{
if (bindable != null)
bindable.ValueChanged -= Bindable_ValueChanged;
bindable.ValueChanged -= bindable_ValueChanged;
bindable = value;
bindable.ValueChanged += Bindable_ValueChanged;
Bindable_ValueChanged(null, null);
bindable.ValueChanged += bindable_ValueChanged;
bindable_ValueChanged(null, null);
if (bindable?.Disabled ?? true)
Alpha = 0.3f;
}
}
private Bindable<T> bindable;
void Bindable_ValueChanged(object sender, EventArgs e)
void bindable_ValueChanged(object sender, EventArgs e)
{
dropdown.SelectedValue = bindable.Value;
}
void Dropdown_ValueChanged(object sender, EventArgs e)
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;
bindable.ValueChanged -= bindable_ValueChanged;
dropdown.ValueChanged -= dropdown_ValueChanged;
base.Dispose(isDisposing);
}
@ -101,7 +104,7 @@ namespace osu.Game.Overlays.Options
Items = this.Items,
}
};
dropdown.ValueChanged += Dropdown_ValueChanged;
dropdown.ValueChanged += dropdown_ValueChanged;
}
}
}

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -16,7 +17,7 @@ namespace osu.Game.Overlays.Options
{
private SliderBar<T> slider;
private SpriteText text;
public string LabelText
{
get { return text.Text; }
@ -26,11 +27,16 @@ namespace osu.Game.Overlays.Options
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
}
}
public BindableNumber<T> Bindable
{
get { return slider.Bindable; }
set { slider.Bindable = value; }
set
{
slider.Bindable = value;
if (value?.Disabled ?? true)
Alpha = 0.3f;
}
}
public OptionSlider()

View File

@ -24,6 +24,9 @@ namespace osu.Game.Overlays.Options
base.Text = bindable.Value;
bindable.ValueChanged += bindableValueChanged;
}
if (bindable?.Disabled ?? true)
Alpha = 0.3f;
}
}