A game about forced loneliness, made by TACStudios
1using System; 2 3namespace Unity.VisualScripting 4{ 5 public sealed class MergedGraphElementCollection : MergedKeyedCollection<Guid, IGraphElement>, INotifyCollectionChanged<IGraphElement> 6 { 7 public event Action<IGraphElement> ItemAdded; 8 9 public event Action<IGraphElement> ItemRemoved; 10 11 public event Action CollectionChanged; 12 13 public override void Include<TSubItem>(IKeyedCollection<Guid, TSubItem> collection) 14 { 15 base.Include(collection); 16 17 var graphElementCollection = collection as IGraphElementCollection<TSubItem>; 18 19 if (graphElementCollection != null) 20 { 21 graphElementCollection.ItemAdded += (element) => ItemAdded?.Invoke(element); 22 graphElementCollection.ItemRemoved += (element) => ItemRemoved?.Invoke(element); 23 graphElementCollection.CollectionChanged += () => CollectionChanged?.Invoke(); 24 } 25 } 26 } 27}