コード例 #1
0
ファイル: CCNode.cs プロジェクト: chengcong/cocos2d-xna
 public virtual void addChild(CCNode child, int zOrder, int tag)
 {
     if (child == null)
     {
         throw new ArgumentNullException("child", "Child can not be null.");
     }
     if (child.m_pParent == null)
     {
         this.insertChild(child, zOrder);
         child.m_nTag = tag;
         child.parent = this;
         if (this.m_bIsRunning)
         {
             child.onEnter();
             child.onEnterTransitionDidFinish();
         }
     }
 }
コード例 #2
0
ファイル: CCNode.cs プロジェクト: ChowZenki/cocos2d-x-for-xna
        /// <summary>
        /// Adds a child to the container with z order and tag
        /// If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
        /// @since v0.7.1
        /// </summary>
        public virtual void addChild(CCNode child, int zOrder, int tag)
        {
            Debug.Assert(child != null, "Argument must be non-null");
            Debug.Assert(child.m_pParent == null, "child already added. It can't be added again");

            insertChild(child, zOrder);

            child.m_nTag = tag;
            child.parent = this;

            if (m_bIsRunning)
            {
                child.onEnter();
                child.onEnterTransitionDidFinish();
            }
        }
コード例 #3
0
        /// <summary>
        /// Adds a child to the container with z order and tag
        /// If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
        /// @since v0.7.1
        /// </summary>
        public virtual void addChild(CCNode child, int zOrder, int tag)
        {
            if (child == null)
            {
                throw (new ArgumentNullException("child", "Child can not be null."));
            }
            if (child.m_pParent != null)
            {
                Debug.WriteLine("child in addChild is already added. Child tag=" + tag + ", parent=" + child.m_pParent.tag);
                return;
            }

            insertChild(child, zOrder);

            child.m_nTag = tag;
            child.parent = this;

            if (m_bIsRunning)
            {
                child.onEnter();
                child.onEnterTransitionDidFinish();
            }
        }