public void removeSpriteFromAtlas(CCSprite pobSprite) { this.m_pobTextureAtlas.removeQuadAtIndex(pobSprite.atlasIndex); pobSprite.useSelfRender(); uint index = (uint)this.m_pobDescendants.IndexOf(pobSprite); if (index != uint.MaxValue) { this.m_pobDescendants.RemoveAt((int)index); int count = this.m_pobDescendants.Count; while (index < count) { CCSprite sprite = this.m_pobDescendants[(int)index]; sprite.atlasIndex--; index++; } } List <CCNode> children = pobSprite.children; if ((children != null) && (children.Count > 0)) { CCObject obj2 = null; for (int i = 0; i < children.Count; i++) { obj2 = children[i]; CCSprite sprite2 = obj2 as CCSprite; if (sprite2 != null) { this.removeSpriteFromAtlas(sprite2); } } } }
public void removeSpriteFromAtlas(CCSprite pobSprite) { // remove from TextureAtlas m_pobTextureAtlas.removeQuadAtIndex(pobSprite.atlasIndex); // Cleanup sprite. It might be reused (issue #569) pobSprite.useSelfRender(); uint uIndex = (uint)m_pobDescendants.IndexOf(pobSprite); if (uIndex != 0xffffffff) { m_pobDescendants.RemoveAt((int)uIndex); // update all sprites beyond this one int count = m_pobDescendants.Count; for (; uIndex < count; ++uIndex) { CCSprite s = (m_pobDescendants[(int)uIndex]) as CCSprite; s.atlasIndex = s.atlasIndex - 1; } } // remove children recursively List <Node> pChildren = pobSprite.Children; if (pChildren != null && pChildren.Count > 0) { CCObject pObject = null; for (int i = 0; i < pChildren.Count; i++) { pObject = pChildren[i]; CCSprite pChild = pObject as CCSprite; if (pChild != null) { removeSpriteFromAtlas(pChild); } } } }
public void removeSpriteFromAtlas(CCSprite pobSprite) { // remove from TextureAtlas m_pobTextureAtlas.removeQuadAtIndex(pobSprite.atlasIndex); // Cleanup sprite. It might be reused (issue #569) pobSprite.useSelfRender(); uint uIndex = (uint)m_pobDescendants.IndexOf(pobSprite); if (uIndex != 0xffffffff) { m_pobDescendants.RemoveAt((int)uIndex); // update all sprites beyond this one int count = m_pobDescendants.Count; for (; uIndex < count; ++uIndex) { CCSprite s = (m_pobDescendants[(int)uIndex]) as CCSprite; s.atlasIndex = s.atlasIndex - 1; } } // remove children recursively List<CCNode> pChildren = pobSprite.children; if (pChildren != null && pChildren.Count > 0) { CCObject pObject = null; for (int i = 0; i < pChildren.Count; i++) { pObject = pChildren[i]; CCSprite pChild = pObject as CCSprite; if (pChild != null) { removeSpriteFromAtlas(pChild); } } } }