Пример #1
0
        public void reparentSprite(float dt)
        {
            CCNode p1 = getChildByTag((int)kTags.kTagNode);
            CCNode p2 = getChildByTag((int)kTags.kTagSpriteBatchNode);

            List <CCNode> retArray = new List <CCNode>(250);

            if (m_usingSpriteBatchNode)
            {
                CC_SWAP(p1, p2);
            }


            ////----UXLOG("New parent is: %x", p2);

            CCNode        node;
            List <CCNode> children = p1.children;

            foreach (var item in children)
            {
                if (item == null)
                {
                    break;
                }
                retArray.Add(item);
            }

            int i = 0;

            p1.removeAllChildrenWithCleanup(false);

            foreach (var item in retArray)
            {
                if (item == null)
                {
                    break;
                }
                p2.addChild(item, i, i);
                i++;
            }
            m_usingSpriteBatchNode = !m_usingSpriteBatchNode;
        }