示例#1
0
        public void insertChild(CCSprite pobSprite, int uIndex)
        {
            pobSprite.useBatchNode(this);
            pobSprite.atlasIndex = uIndex;
            pobSprite.dirty      = true;

            if (m_pobTextureAtlas.TotalQuads == m_pobTextureAtlas.Capacity)
            {
                increaseAtlasCapacity();
            }

            ccV3F_C4B_T2F_Quad quad = pobSprite.quad;

            m_pobTextureAtlas.insertQuad(quad, uIndex);
            m_pobDescendants.Insert(uIndex, pobSprite);

            // update indices
            uint i = 0;

            if (m_pobDescendants != null && m_pobDescendants.Count > 0)
            {
                for (int j = 0; j < m_pobDescendants.Count; j++)
                {
                    CCObject pObject = m_pobDescendants[j];
                    CCSprite pChild  = pObject as CCSprite;

                    if (pChild != null)
                    {
                        if (i > uIndex)
                        {
                            pChild.atlasIndex = pChild.atlasIndex + 1;
                        }

                        ++i;
                    }
                }
            }

            // add children recursively
            List <Node> pChildren = pobSprite.Children;

            if (pChildren != null && pChildren.Count > 0)
            {
                for (int j = 0; j < pChildren.Count; j++)
                {
                    CCObject pObject = pChildren[j];
                    CCSprite pChild  = pObject as CCSprite;

                    if (pChild != null)
                    {
                        uIndex = atlasIndexForChild(pChild, pChild.ZOrder);
                        insertChild(pChild, uIndex);
                    }
                }
            }
        }
示例#2
0
        protected void addQuadFromSprite(CCSprite sprite, int index)
        {
            while ((index >= this.m_pobTextureAtlas.Capacity) || (this.m_pobTextureAtlas.Capacity == this.m_pobTextureAtlas.TotalQuads))
            {
                this.increaseAtlasCapacity();
            }
            sprite.useBatchNode(this);
            sprite.atlasIndex = index;
            ccV3F_C4B_T2F_Quad quad = sprite.quad;

            this.m_pobTextureAtlas.insertQuad(quad, index);
            sprite.dirty = true;
            sprite.updateTransform();
        }
示例#3
0
        public void insertChild(CCSprite pobSprite, int uIndex)
        {
            pobSprite.useBatchNode(this);
            pobSprite.atlasIndex = uIndex;
            pobSprite.dirty      = true;
            if (this.m_pobTextureAtlas.TotalQuads == this.m_pobTextureAtlas.Capacity)
            {
                this.increaseAtlasCapacity();
            }
            ccV3F_C4B_T2F_Quad quad = pobSprite.quad;

            this.m_pobTextureAtlas.insertQuad(quad, uIndex);
            this.m_pobDescendants.Insert(uIndex, pobSprite);
            uint num = 0;

            if ((this.m_pobDescendants != null) && (this.m_pobDescendants.Count > 0))
            {
                for (int i = 0; i < this.m_pobDescendants.Count; i++)
                {
                    CCObject obj2   = this.m_pobDescendants[i];
                    CCSprite sprite = obj2 as CCSprite;
                    if (sprite != null)
                    {
                        if (num > uIndex)
                        {
                            sprite.atlasIndex++;
                        }
                        num++;
                    }
                }
            }
            List <CCNode> children = pobSprite.children;

            if ((children != null) && (children.Count > 0))
            {
                for (int j = 0; j < children.Count; j++)
                {
                    CCObject obj3    = children[j];
                    CCSprite sprite2 = obj3 as CCSprite;
                    if (sprite2 != null)
                    {
                        uIndex = this.atlasIndexForChild(sprite2, sprite2.zOrder);
                        this.insertChild(sprite2, uIndex);
                    }
                }
            }
        }
        public void insertChild(CCSprite pobSprite, int uIndex)
        {
            pobSprite.useBatchNode(this);
            pobSprite.atlasIndex = uIndex;
            pobSprite.dirty = true;

            if (m_pobTextureAtlas.TotalQuads == m_pobTextureAtlas.Capacity)
            {
                increaseAtlasCapacity();
            }

            ccV3F_C4B_T2F_Quad quad = pobSprite.quad;
            m_pobTextureAtlas.insertQuad(quad, uIndex);
            m_pobDescendants.Insert(uIndex, pobSprite);

            // update indices
            uint i = 0;

            if (m_pobDescendants != null && m_pobDescendants.Count > 0)
            {
                for (int j = 0; j < m_pobDescendants.Count; j++)
                {
                    CCObject pObject = m_pobDescendants[j];
                    CCSprite pChild = pObject as CCSprite;

                    if (pChild != null)
                    {
                        if (i > uIndex)
                        {
                            pChild.atlasIndex = pChild.atlasIndex + 1;
                        }

                        ++i;
                    }
                }
            }

            // add children recursively
            List<CCNode> pChildren = pobSprite.children;

            if (pChildren != null && pChildren.Count > 0)
            {
                for (int j = 0; j < pChildren.Count; j++)
                {
                    CCObject pObject = pChildren[j];
                    CCSprite pChild = pObject as CCSprite;

                    if (pChild != null)
                    {
                        uIndex = atlasIndexForChild(pChild, pChild.zOrder);
                        insertChild(pChild, uIndex);
                    }
                }
            }
        }