Ejemplo n.º 1
0
        private static void Merge()
        {
            var nodes = m_pNodes.Elements;

            for (int i = 0, count = m_pNodes.Count; i < count - 1; ++i)
            {
                if (nodes[i].y == nodes[i + 1].y)
                {
                    nodes[i].z += nodes[i + 1].z;
                    m_pNodes.RemoveAt(i + 1);
                    --count;
                    --i;
                }
            }
        }
Ejemplo n.º 2
0
        public void RemoveSpriteFromAtlas(CCSprite pobSprite)
        {
            // remove from TextureAtlas
            m_pobTextureAtlas.RemoveQuadAtIndex(pobSprite.AtlasIndex);

            // Cleanup sprite. It might be reused (issue #569)
            pobSprite.BatchNode = null;

            int uIndex = m_pobDescendants.IndexOf(pobSprite);

            if (uIndex >= 0)
            {
                m_pobDescendants.RemoveAt(uIndex);

                // update all sprites beyond this one
                int        count    = m_pobDescendants.count;
                CCSprite[] elements = m_pobDescendants.Elements;

                for (; uIndex < count; ++uIndex)
                {
                    elements[uIndex].AtlasIndex--;
                }
            }

            // remove children recursively
            CCRawList <CCNode> pChildren = pobSprite.Children;

            if (pChildren != null && pChildren.count > 0)
            {
                CCNode[] elements = pChildren.Elements;
                for (int i = 0, count = pChildren.count; i < count; i++)
                {
                    RemoveSpriteFromAtlas((CCSprite)elements[i]);
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// removes a quad at a given index number.
 /// The capacity remains the same, but the total number of quads to be drawn is reduced in 1
 /// @since v0.7.2
 /// </summary>
 public void RemoveQuadAtIndex(int index)
 {
     Debug.Assert(index < m_pQuads.count, "removeQuadAtIndex: Invalid index");
     m_pQuads.RemoveAt(index);
     Dirty = true;
 }