Add back explicit binds.

This commit is contained in:
Dean Herbert 2017-04-10 17:10:15 +09:00
parent ba03a98992
commit 5af4259ab4
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
7 changed files with 16 additions and 16 deletions

View File

@ -99,6 +99,7 @@ namespace osu.Desktop.VisualTests.Tests
AddToggleStep(@"auto", state => { auto = state; load(mode); }); AddToggleStep(@"auto", state => { auto = state; load(mode); });
BasicSliderBar<double> sliderBar;
Add(new Container Add(new Container
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
@ -107,16 +108,17 @@ namespace osu.Desktop.VisualTests.Tests
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText { Text = "Playback Speed" }, new SpriteText { Text = "Playback Speed" },
new BasicSliderBar<double> sliderBar = new BasicSliderBar<double>
{ {
Width = 150, Width = 150,
Height = 10, Height = 10,
SelectionColor = Color4.Orange, SelectionColor = Color4.Orange,
Current = playbackSpeed
} }
} }
}); });
sliderBar.Current.BindTo(playbackSpeed);
framedClock.ProcessFrame(); framedClock.ProcessFrame();
var clockAdjustContainer = new Container var clockAdjustContainer = new Container

View File

@ -44,6 +44,8 @@ namespace osu.Desktop.VisualTests.Tests
kc.Add(new KeyCounterKeyboard(key)); kc.Add(new KeyCounterKeyboard(key));
}); });
TestSliderBar<int> sliderBar;
Add(new Container Add(new Container
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
@ -52,16 +54,17 @@ namespace osu.Desktop.VisualTests.Tests
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText { Text = "FadeTime" }, new SpriteText { Text = "FadeTime" },
new TestSliderBar<int> sliderBar =new TestSliderBar<int>
{ {
Width = 150, Width = 150,
Height = 10, Height = 10,
SelectionColor = Color4.Orange, SelectionColor = Color4.Orange,
Current = bindable
} }
} }
}); });
sliderBar.Current.BindTo(bindable);
Add(kc); Add(kc);
} }
private class TestSliderBar<T> : SliderBar<T> where T : struct private class TestSliderBar<T> : SliderBar<T> where T : struct

View File

@ -92,12 +92,6 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
private readonly Bindable<bool> current = new Bindable<bool>(); public Bindable<bool> Current { get; } = new Bindable<bool>();
public Bindable<bool> Current
{
get { return current; }
set { current.BindTo(value); }
}
} }
} }

View File

@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface
set set
{ {
bindable = value; bindable = value;
Current = bindable; Current.BindTo(bindable);
if (value?.Disabled ?? true) if (value?.Disabled ?? true)
Alpha = 0.3f; Alpha = 0.3f;
} }
@ -69,13 +69,14 @@ namespace osu.Game.Graphics.UserInterface
labelSpriteText = new OsuSpriteText(), labelSpriteText = new OsuSpriteText(),
nub = new Nub nub = new Nub
{ {
Current = Current,
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
Margin = new MarginPadding { Right = 5 }, Margin = new MarginPadding { Right = 5 },
} }
}; };
nub.Current.BindTo(Current);
Current.ValueChanged += newValue => Current.ValueChanged += newValue =>
{ {
if (newValue) if (newValue)

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Options
set set
{ {
bindable = value; bindable = value;
dropdown.Current = bindable; dropdown.Current.BindTo(bindable);
if (value?.Disabled ?? true) if (value?.Disabled ?? true)
Alpha = 0.3f; Alpha = 0.3f;
} }

View File

@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Options
set set
{ {
bindable = value; bindable = value;
slider.Current = bindable; slider.Current.BindTo(bindable);
if (value?.Disabled ?? true) if (value?.Disabled ?? true)
Alpha = 0.3f; Alpha = 0.3f;
} }

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options
set set
{ {
bindable = value; bindable = value;
Current = bindable; Current.BindTo(bindable);
if (value?.Disabled ?? true) if (value?.Disabled ?? true)
Alpha = 0.3f; Alpha = 0.3f;
} }