mirror of
https://github.com/ppy/osu
synced 2024-12-15 03:16:17 +00:00
Simplify control point group binding/update logic
This commit is contained in:
parent
2087e9799a
commit
a40c2ea5ee
@ -63,7 +63,7 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
private OsuButton deleteButton;
|
private OsuButton deleteButton;
|
||||||
private ControlPointTable table;
|
private ControlPointTable table;
|
||||||
|
|
||||||
private IBindableList<ControlPointGroup> controlGroups;
|
private BindableList<ControlPointGroup> controlGroups;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorClock clock { get; set; }
|
private EditorClock clock { get; set; }
|
||||||
@ -128,12 +128,14 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
|
|
||||||
selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
|
selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
|
||||||
|
|
||||||
controlGroups = Beatmap.Value.Beatmap.ControlPointInfo.Groups.GetBoundCopy();
|
// todo: remove cast after https://github.com/ppy/osu-framework/pull/3906 is merged
|
||||||
controlGroups.CollectionChanged += (sender, args) => createContent();
|
controlGroups = (BindableList<ControlPointGroup>)Beatmap.Value.Beatmap.ControlPointInfo.Groups.GetBoundCopy();
|
||||||
createContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createContent() => table.ControlGroups = controlGroups;
|
controlGroups.BindCollectionChanged((sender, args) =>
|
||||||
|
{
|
||||||
|
table.ControlGroups = controlGroups;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
private void delete()
|
private void delete()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user