void SendEvent(AttachObjectListEventType eventType, AttachObject obj = null, int oldIndexInCategory = -1) { if (OnChanged == null) { return; } AttachObjectListEventInfo eventInfo = new AttachObjectListEventInfo(eventType, this, obj, oldIndexInCategory); OnChanged.Invoke(eventInfo); }
// fixme - this seems to cause weird issues // ~Attachment() { // ClingyComponent.instance.attachments.RemoveAt(ClingyComponent.instance.attachments.IndexOfValue(this)); // } void HandleObjectsListEvent(AttachObjectListEventInfo info) { if (info.eventType == AttachObjectListEventType.ObjectAdded) { HandleObjectAdded(info.obj); } else if (info.eventType == AttachObjectListEventType.ObjectWillBeRemoved) { HandleObjectWillBeRemoved(info.obj); } else if (info.eventType == AttachObjectListEventType.ObjectRemoved) { HandleObjectWasRemoved(info.obj, info.oldIndexInCategory); } }