const auto& arrayNode = node->getChildren(); int i = 0; for (auto& child : arrayNode) { Node* pNode = dynamic_cast<Node*>(child); if (pNode) { pNode->setZOrder(++i); } }
2.X
CCObject *temp;
CCArray *nodeArray = rootNode->getChildren();
CCARRAY_FOREACH(nodeArray, temp)
{
temp->setZOrder(++i);
}
LUA
local function seach_child(parente)
local childCount = parente:getChildrenCount()
if childCount < 1 then
node_list[parente:getName()] = parente
else
for i = 1, childCount do
dump(parente)
node_list[parente:getName()] = parente
seach_child(parente:getChildren()[i])
end
end
end
for k , v in next ,children do
if #v:getChildren() < 1 then
node_list[v:getName()] = v
else
seach_child(v)
end
end
return node_list