Make SettingsItem conform to IHasCurrentValue

This commit is contained in:
Dean Herbert
2020-10-06 17:18:41 +09:00
parent 461fa22e74
commit 9d7880afda
33 changed files with 131 additions and 131 deletions

View File

@ -11,7 +11,7 @@ using osu.Game.Overlays.Settings;
namespace osu.Game.Screens.Edit.Timing
{
internal class SliderWithTextBoxInput<T> : CompositeDrawable, IHasCurrentValue<T>
public class SliderWithTextBoxInput<T> : CompositeDrawable, IHasCurrentValue<T>
where T : struct, IEquatable<T>, IComparable<T>, IConvertible
{
private readonly SettingsSlider<T> slider;
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Edit.Timing
try
{
slider.Bindable.Parse(t.Text);
slider.Current.Parse(t.Text);
}
catch
{
@ -71,8 +71,8 @@ namespace osu.Game.Screens.Edit.Timing
public Bindable<T> Current
{
get => slider.Bindable;
set => slider.Bindable = value;
get => slider.Current;
set => slider.Current = value;
}
}
}

View File

@ -36,14 +36,14 @@ namespace osu.Game.Screens.Edit.Timing
{
if (point.NewValue != null)
{
bpmSlider.Bindable = point.NewValue.BeatLengthBindable;
bpmSlider.Bindable.BindValueChanged(_ => ChangeHandler?.SaveState());
bpmSlider.Current = point.NewValue.BeatLengthBindable;
bpmSlider.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
bpmTextEntry.Bindable = point.NewValue.BeatLengthBindable;
// no need to hook change handler here as it's the same bindable as above
timeSignature.Bindable = point.NewValue.TimeSignatureBindable;
timeSignature.Bindable.BindValueChanged(_ => ChangeHandler?.SaveState());
timeSignature.Current = point.NewValue.TimeSignatureBindable;
timeSignature.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
}
}
@ -121,14 +121,14 @@ namespace osu.Game.Screens.Edit.Timing
beatLengthBindable.BindValueChanged(beatLength => updateCurrent(beatLengthToBpm(beatLength.NewValue)), true);
bpmBindable.BindValueChanged(bpm => beatLengthBindable.Value = beatLengthToBpm(bpm.NewValue));
base.Bindable = bpmBindable;
base.Current = bpmBindable;
TransferValueOnCommit = true;
}
public override Bindable<double> Bindable
public override Bindable<double> Current
{
get => base.Bindable;
get => base.Current;
set
{
// incoming will be beat length, not bpm