mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Update UI control access in line with framework changes.
This commit is contained in:
@ -23,16 +23,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
set
|
||||
{
|
||||
if (bindable != null)
|
||||
bindable.ValueChanged -= bindableValueChanged;
|
||||
bindable = value;
|
||||
|
||||
if (bindable != null)
|
||||
{
|
||||
bool state = State == CheckboxState.Checked;
|
||||
if (state != bindable.Value)
|
||||
State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked;
|
||||
bindable.ValueChanged += bindableValueChanged;
|
||||
}
|
||||
Current = bindable;
|
||||
|
||||
if (bindable?.Disabled ?? true)
|
||||
Alpha = 0.3f;
|
||||
@ -78,23 +72,20 @@ namespace osu.Game.Graphics.UserInterface
|
||||
labelSpriteText = new OsuSpriteText(),
|
||||
nub = new Nub
|
||||
{
|
||||
Current = Current,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding { Right = 5 },
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void bindableValueChanged(bool isChecked)
|
||||
{
|
||||
State = isChecked ? CheckboxState.Checked : CheckboxState.Unchecked;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
if (bindable != null)
|
||||
bindable.ValueChanged -= bindableValueChanged;
|
||||
base.Dispose(isDisposing);
|
||||
Current.ValueChanged += newValue =>
|
||||
{
|
||||
if (newValue)
|
||||
sampleChecked?.Play();
|
||||
else
|
||||
sampleUnchecked?.Play();
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
@ -117,23 +108,5 @@ namespace osu.Game.Graphics.UserInterface
|
||||
sampleChecked = audio.Sample.Get(@"Checkbox/check-on");
|
||||
sampleUnchecked = audio.Sample.Get(@"Checkbox/check-off");
|
||||
}
|
||||
|
||||
protected override void OnChecked()
|
||||
{
|
||||
sampleChecked?.Play();
|
||||
nub.State = CheckboxState.Checked;
|
||||
|
||||
if (bindable != null)
|
||||
bindable.Value = true;
|
||||
}
|
||||
|
||||
protected override void OnUnchecked()
|
||||
{
|
||||
sampleUnchecked?.Play();
|
||||
nub.State = CheckboxState.Unchecked;
|
||||
|
||||
if (bindable != null)
|
||||
bindable.Value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user