本文整理汇总了C#中cocos2d.CCSprite.useBatchNode方法的典型用法代码示例。如果您正苦于以下问题:C# CCSprite.useBatchNode方法的具体用法?C# CCSprite.useBatchNode怎么用?C# CCSprite.useBatchNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocos2d.CCSprite
的用法示例。
在下文中一共展示了CCSprite.useBatchNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: insertChild
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);
}
}
}
}