mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
Move section update code to abstract method to avoid incorrect BindValue usage
This commit is contained in:
parent
322a1f0a86
commit
ebfb5d050d
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
@ -20,11 +21,9 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
protected override void OnControlPointChanged(ValueChangedEvent<DifficultyControlPoint> point)
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ControlPoint.BindValueChanged(point => { multiplier.Text = $"Multiplier: {point.NewValue?.SpeedMultiplier:0.##}x"; });
|
||||
multiplier.Text = $"Multiplier: {point.NewValue?.SpeedMultiplier:0.##}x";
|
||||
}
|
||||
|
||||
protected override DifficultyControlPoint CreatePoint()
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
@ -22,15 +23,10 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ControlPoint.BindValueChanged(point =>
|
||||
protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint> point)
|
||||
{
|
||||
kiai.Text = $"Kiai: {(point.NewValue?.KiaiMode == true ? "on" : "off")}";
|
||||
omitBarLine.Text = $"Skip Bar Line: {(point.NewValue?.OmitFirstBarLine == true ? "on" : "off")}";
|
||||
});
|
||||
}
|
||||
|
||||
protected override EffectControlPoint CreatePoint()
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
@ -22,15 +23,10 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ControlPoint.BindValueChanged(point =>
|
||||
protected override void OnControlPointChanged(ValueChangedEvent<SampleControlPoint> point)
|
||||
{
|
||||
bank.Text = $"Bank: {point.NewValue?.SampleBank}";
|
||||
volume.Text = $"Volume: {point.NewValue?.SampleVolume}%";
|
||||
});
|
||||
}
|
||||
|
||||
protected override SampleControlPoint CreatePoint()
|
||||
|
@ -119,8 +119,12 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
ControlPoint.Value = points.NewValue?.ControlPoints.OfType<T>().FirstOrDefault();
|
||||
checkbox.Current.Value = ControlPoint.Value != null;
|
||||
}, true);
|
||||
|
||||
ControlPoint.BindValueChanged(OnControlPointChanged, true);
|
||||
}
|
||||
|
||||
protected abstract void OnControlPointChanged(ValueChangedEvent<T> point);
|
||||
|
||||
protected abstract T CreatePoint();
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
@ -22,15 +23,10 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ControlPoint.BindValueChanged(point =>
|
||||
protected override void OnControlPointChanged(ValueChangedEvent<TimingControlPoint> point)
|
||||
{
|
||||
bpm.Text = $"BPM: {point.NewValue?.BPM:0.##}";
|
||||
timeSignature.Text = $"Signature: {point.NewValue?.TimeSignature}";
|
||||
});
|
||||
}
|
||||
|
||||
protected override TimingControlPoint CreatePoint()
|
||||
|
Loading…
Reference in New Issue
Block a user