internal protected virtual void TriggerOnChildAdded(Component sender, Component component) { if (OnChildAdded != null) { OnChildAdded.Invoke(new ComponentEventArgs(sender, component)); } }
public void AddChild(Hierarchy child) { if (!Children.Contains(child)) { Children.Add(child); OnChildrenUpdated(); if (OnChildAdded != null) { OnChildAdded.Invoke(child); } } }
//Thread issue with the queues. something else is dequeuing them some how. public void Update(float deltaTime) { if (Parent == null && UID != 0) { return; } OnUpdate(deltaTime); if (childrenChanged) { lock (childModification) { while (toBeRemoved.Count > 0) { GameObject obj = toBeRemoved.Dequeue(); children.Remove(obj); invokationQueue.Enqueue(obj.Destroyed); invokationQueue.Enqueue(() => { OnChildRemoved?.Invoke(this, obj); }); } while (toBeAdded.Count > 0) { GameObject obj = toBeAdded.Dequeue(); children.Add(obj); invokationQueue.Enqueue(obj.Added); invokationQueue.Enqueue(() => { OnChildAdded?.Invoke(this, obj); }); } childrenChanged = false; } } lock (childModification) while (invokationQueue.Count > 0) { invokationQueue.Dequeue()(); } //This lock was (possibily) causing deadlocks so i removed it, ill keep it commented for now though. //lock (childModification) { foreach (var child in children) { child.Update(deltaTime); } OnUpdateEvent?.Invoke(this); //} }
/// <summary> /// Adds a child to this node's hierarchy. Handles everything including removing /// the child reference from the previous parent if one existed. /// </summary> public virtual CogaNode AddChild(CogaNode child) { child.SetParent(this); Children.Add(child); OnChildAdded?.Invoke(this, child); SetDirty(); SetChildrenDirty(); if (IsRoot) { PropagateManager(this, Manager); } else if (Manager != null) { PropagateManager(this, Manager); } return(this); }
public void AddChild(REbase child) { OnChildAdded?.Invoke(this, new OnChildAddedEventArgs(child)); }
#pragma warning restore 67 public virtual IWindowUT AddChild(IWindowUT newChild) { Children.Add(newChild); OnChildAdded?.Invoke(this, newChild); return(this); }
protected virtual void InvokeChildAdded(AbstractFieldNode newchild) { OnChildAdded?.Invoke(this, newchild); }