Exemple #1
0
 internal protected virtual void TriggerOnChildAdded(Component sender, Component component)
 {
     if (OnChildAdded != null)
     {
         OnChildAdded.Invoke(new ComponentEventArgs(sender, component));
     }
 }
Exemple #2
0
 public void AddChild(Hierarchy child)
 {
     if (!Children.Contains(child))
     {
         Children.Add(child);
         OnChildrenUpdated();
         if (OnChildAdded != null)
         {
             OnChildAdded.Invoke(child);
         }
     }
 }
Exemple #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);
            //}
        }
Exemple #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);
        }
Exemple #5
0
        async Task AddChild()
        {
            await OnChildAdded.InvokeAsync(_child);

            _child = new CategoryDescriptorModel();
        }
Exemple #6
0
 public void AddChild(REbase child)
 {
     OnChildAdded?.Invoke(this, new OnChildAddedEventArgs(child));
 }
Exemple #7
0
#pragma warning restore 67

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