Update with framework-side bindable list changes

This commit is contained in:
smoogipoo
2020-02-17 15:06:14 +09:00
parent 6fd5667ff4
commit 958c891d15
15 changed files with 127 additions and 77 deletions

View File

@ -125,8 +125,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
samplesBindable = HitObject.SamplesBindable.GetBoundCopy();
samplesBindable.ItemsAdded += _ => loadSamples();
samplesBindable.ItemsRemoved += _ => loadSamples();
samplesBindable.CollectionChanged += (_, __) => loadSamples();
updateState(ArmedState.Idle, true);
onDefaultsApplied();

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Bindables;
@ -47,18 +48,20 @@ namespace osu.Game.Rulesets.Objects
{
ExpectedDistance.ValueChanged += _ => invalidate();
ControlPoints.ItemsAdded += items =>
ControlPoints.CollectionChanged += (_, args) =>
{
foreach (var c in items)
c.Changed += invalidate;
switch (args.Action)
{
case NotifyCollectionChangedAction.Add:
foreach (var c in args.NewItems.Cast<PathControlPoint>())
c.Changed += invalidate;
break;
invalidate();
};
ControlPoints.ItemsRemoved += items =>
{
foreach (var c in items)
c.Changed -= invalidate;
case NotifyCollectionChangedAction.Remove:
foreach (var c in args.NewItems.Cast<PathControlPoint>())
c.Changed -= invalidate;
break;
}
invalidate();
};