Esempio n. 1
0
 /// <summary>
 /// Inserts the child node.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="node">The node.</param>
 /// <returns></returns>
 public bool InsertChildNode(int index, SceneNode node)
 {
     if (node == null || node.IsAttached || itemHashSet.ContainsKey(node.GUID))
     {
         return(false);
     }
     itemHashSet.Add(node.GUID, node);
     ItemsInternal.Insert(index, node);
     node.Parent = this;
     if (IsAttached)
     {
         node.Attach(EffectsManager);
         InvalidateSceneGraph();
     }
     ChildNodeAdded?.Invoke(this, new OnChildNodeChangedArgs(node, Operation.Add));
     return(true);
 }
Esempio n. 2
0
 /// <summary>
 /// Adds the child node.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentException">SceneNode already attach to a different node</exception>
 public bool AddChildNode(SceneNode node)
 {
     if (node != null && !itemHashSet.ContainsKey(node.GUID))
     {
         itemHashSet.Add(node.GUID, node);
         ItemsInternal.Add(node);
         if (node.Parent != NullSceneNode.NullNode && node.Parent != this)
         {
             throw new ArgumentException("SceneNode already attach to a different node");
         }
         node.Parent = this;
         if (IsAttached)
         {
             node.Attach(EffectsManager);
             InvalidateSceneGraph();
         }
         ChildNodeAdded?.Invoke(this, new OnChildNodeChangedArgs(node, Operation.Add));
         return(true);
     }
     else
     {
         return(false);
     }
 }