Simplify control point group binding/update logic

This commit is contained in:
Dean Herbert 2020-09-30 16:02:22 +09:00
parent 2087e9799a
commit a40c2ea5ee

View File

@ -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()
{ {