Esempio n. 1
0
 internal protected virtual void TriggerOnChildAdded(Component sender, Component component)
 {
     if (OnChildAdded != null)
     {
         OnChildAdded.Invoke(new ComponentEventArgs(sender, component));
     }
 }
Esempio n. 2
0
 public void AddChild(Hierarchy child)
 {
     if (!Children.Contains(child))
     {
         Children.Add(child);
         OnChildrenUpdated();
         if (OnChildAdded != null)
         {
             OnChildAdded.Invoke(child);
         }
     }
 }
Esempio n. 3
0
        //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);
            //}
        }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
 public void AddChild(REbase child)
 {
     OnChildAdded?.Invoke(this, new OnChildAddedEventArgs(child));
 }
Esempio n. 6
0
#pragma warning restore 67

        public virtual IWindowUT AddChild(IWindowUT newChild)
        {
            Children.Add(newChild);
            OnChildAdded?.Invoke(this, newChild);
            return(this);
        }
Esempio n. 7
0
 protected virtual void InvokeChildAdded(AbstractFieldNode newchild)
 {
     OnChildAdded?.Invoke(this, newchild);
 }