mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 08:02:54 +08:00
Merge pull request #616 from peppy/has-bindable-value
Update SliderBar to use IHasCurrentValue.
This commit is contained in:
commit
4aadd3a8f8
@ -1 +1 @@
|
||||
Subproject commit bbfd0fc7a8f5293a0f853f51040b40808abbb459
|
||||
Subproject commit 1490f003273d7aab6589e489f6e4b02d204c9f27
|
@ -99,6 +99,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
AddToggleStep(@"auto", state => { auto = state; load(mode); });
|
||||
|
||||
BasicSliderBar<double> sliderBar;
|
||||
Add(new Container
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -107,16 +108,17 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "Playback Speed" },
|
||||
new BasicSliderBar<double>
|
||||
sliderBar = new BasicSliderBar<double>
|
||||
{
|
||||
Width = 150,
|
||||
Height = 10,
|
||||
SelectionColor = Color4.Orange,
|
||||
Value = playbackSpeed
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sliderBar.Current.BindTo(playbackSpeed);
|
||||
|
||||
framedClock.ProcessFrame();
|
||||
|
||||
var clockAdjustContainer = new Container
|
||||
|
@ -44,6 +44,8 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
kc.Add(new KeyCounterKeyboard(key));
|
||||
});
|
||||
|
||||
TestSliderBar<int> sliderBar;
|
||||
|
||||
Add(new Container
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -52,16 +54,17 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "FadeTime" },
|
||||
new TestSliderBar<int>
|
||||
sliderBar =new TestSliderBar<int>
|
||||
{
|
||||
Width = 150,
|
||||
Height = 10,
|
||||
SelectionColor = Color4.Orange,
|
||||
Value = bindable
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sliderBar.Current.BindTo(bindable);
|
||||
|
||||
Add(kc);
|
||||
}
|
||||
private class TestSliderBar<T> : SliderBar<T> where T : struct
|
||||
|
@ -46,6 +46,7 @@ namespace osu.Game.Configuration
|
||||
Set(OsuConfig.AutomaticDownload, true).Disabled = true;
|
||||
Set(OsuConfig.AutomaticDownloadNoVideo, false).Disabled = true;
|
||||
Set(OsuConfig.BlockNonFriendPM, false).Disabled = true;
|
||||
Set(OsuConfig.Bloom, false).Disabled = true;
|
||||
Set(OsuConfig.BloomSoftening, false).Disabled = true;
|
||||
Set(OsuConfig.BossKeyFirstActivation, true).Disabled = true;
|
||||
Set(OsuConfig.ChatAudibleHighlight, true).Disabled = true;
|
||||
|
@ -92,12 +92,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Bindable<bool> current = new Bindable<bool>();
|
||||
|
||||
public Bindable<bool> Current
|
||||
{
|
||||
get { return current; }
|
||||
set { current.BindTo(value); }
|
||||
}
|
||||
public Bindable<bool> Current { get; } = new Bindable<bool>();
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
set
|
||||
{
|
||||
bindable = value;
|
||||
|
||||
if (bindable != null)
|
||||
Current = bindable;
|
||||
|
||||
if (bindable?.Disabled ?? true)
|
||||
Current.BindTo(bindable);
|
||||
if (value?.Disabled ?? true)
|
||||
Alpha = 0.3f;
|
||||
}
|
||||
}
|
||||
@ -72,13 +69,14 @@ namespace osu.Game.Graphics.UserInterface
|
||||
labelSpriteText = new OsuSpriteText(),
|
||||
nub = new Nub
|
||||
{
|
||||
Current = Current,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding { Right = 5 },
|
||||
}
|
||||
};
|
||||
|
||||
nub.Current.BindTo(Current);
|
||||
|
||||
Current.ValueChanged += newValue =>
|
||||
{
|
||||
if (newValue)
|
||||
|
@ -33,8 +33,8 @@ namespace osu.Game.Overlays.Options
|
||||
set
|
||||
{
|
||||
bindable = value;
|
||||
dropdown.Current = bindable;
|
||||
if (bindable.Disabled)
|
||||
dropdown.Current.BindTo(bindable);
|
||||
if (value?.Disabled ?? true)
|
||||
Alpha = 0.3f;
|
||||
}
|
||||
}
|
||||
|
@ -27,12 +27,14 @@ namespace osu.Game.Overlays.Options
|
||||
}
|
||||
}
|
||||
|
||||
public BindableNumber<T> Bindable
|
||||
private Bindable<T> bindable;
|
||||
|
||||
public Bindable<T> Bindable
|
||||
{
|
||||
get { return slider.Value; }
|
||||
set
|
||||
{
|
||||
slider.Value = value;
|
||||
bindable = value;
|
||||
slider.Current.BindTo(bindable);
|
||||
if (value?.Disabled ?? true)
|
||||
Alpha = 0.3f;
|
||||
}
|
||||
|
@ -15,10 +15,8 @@ namespace osu.Game.Overlays.Options
|
||||
set
|
||||
{
|
||||
bindable = value;
|
||||
|
||||
Current = bindable;
|
||||
|
||||
if (bindable?.Disabled ?? true)
|
||||
Current.BindTo(bindable);
|
||||
if (value?.Disabled ?? true)
|
||||
Alpha = 0.3f;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user