悉野小楼

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

列出cocos2dx运行场景所有节点信息

复制代码
#include <typeinfo.h>

static int showAllChildNodeInfo(Node *rootNode, int layer)
{
    int count = 1;
    Size size = rootNode->getContentSize();
    CCLOG("%s layer[%d], visible[%s], name[%s], tag[%i], posX[%f], posY[%f], width[%d], height[%d], zOrder[%d]", 
        typeid(*rootNode).name(), layer, rootNode->isVisible() ? "true" : "false", rootNode->getName().c_str(),
        rootNode->getTag(), rootNode->getPositionX(), rootNode->getPositionY(), size.width, size.height, rootNode->getZOrder());
    for(auto child : rootNode->getChildren())
    {
        count += showAllChildNodeInfo(child, layer + 1);
    }
    return count;
}
//调用
int totalCount = showAllChildNodeInfo(Director::sharedDirector()->getRunningScene(), 0);
CCLOG("total node count:%d", totalCount);
复制代码

输出截取部分如下:


class SceneWorld layer[0], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1083441152], z-order[0]
class cocos2d::Camera layer[1], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[0], z-order[0]
class cocos2d::Node layer[1], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[0], z-order[0]
class MyMapNode layer[2], visible[true], name[], tag[-1], posX[-7730.000000], posY[-4740.000000], width[0], height[1087357440], z-order[0]
class MyTileNode layer[3], visible[false], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1083179008], z-order[0]
class MyTileNode layer[3], visible[false], name[], tag[-1], posX[3072.000000], posY[0.000000], width[0], height[1083179008], z-order[0]
class MYNormalButton layer[4], visible[true], name[ChatCopyBtn], tag[-1], posX[473.000000], posY[81.000000], width[0], height[1078689792], z-order[0]
class MYEditBox layer[4], visible[true], name[LuaEditUI], tag[-1], posX[297.000000], posY[23.000000], width[0], height[1081589760], z-order[0]
class cocos2d::Label layer[5], visible[false], name[], tag[-1], posX[5.000000], posY[35.000000], width[0], height[0], z-order[0]
class cocos2d::Label layer[5], visible[true], name[], tag[-1], posX[5.000000], posY[35.000000], width[0], height[1080262656], z-order[0]
class MYEditBox layer[4], visible[false], name[LuaEditUI], tag[-1], posX[390.000000], posY[23.000000], width[0], height[1080705024], z-order[0]
class cocos2d::Label layer[5], visible[false], name[], tag[-1], posX[5.000000], posY[35.000000], width[0], height[0], z-order[0]
class cocos2d::Label layer[5], visible[false], name[], tag[-1], posX[5.000000], posY[35.000000], width[0], height[1080262656], z-order[0]
class MYNormalButton layer[4], visible[true], name[SendBtn], tag[-1], posX[550.000000], posY[22.000000], width[0], height[1079427072], z-order[0]
class TouchText layer[4], visible[false], name[LinePlayerName], tag[-1], posX[97.000000], posY[9.000000], width[0], height[1080475648], z-order[0]
class MYLabel layer[5], visible[true], name[], tag[10], posX[0.000000], posY[0.000000], width[0], height[1080475648], z-order[0]
class cocos2d::Label layer[6], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1080475648], z-order[0]
class cocos2d::DrawNode layer[6], visible[true], name[], tag[10], posX[0.000000], posY[-2.000000], width[0], height[0], z-order[0]
class MYNormalCheckBox layer[4], visible[true], name[OpenChannelBtn], tag[-1], posX[50.000000], posY[23.000000], width[0], height[1079492608], z-order[0]
class MYMenu layer[3], visible[false], name[MenuHandle], tag[-1], posX[18.000000], posY[63.000000], width[0], height[1079492608], z-order[0]
class MYLuaScale9Sprite layer[4], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1079492608], z-order[0]
class MYNormalButton layer[5], visible[true], name[], tag[1], posX[47.000000], posY[242.000000], width[0], height[1079492608], z-order[0]
class CTouchFinger layer[1], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1083441152], z-order[0]
class MYAnimNode layer[2], visible[false], name[], tag[-1], posX[-1000.000000], posY[-1000.000000], width[0], height[1080033280], z-order[0]
class MYUISprite layer[2], visible[false], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[0], z-order[0]
class DownloadProgressUI layer[1], visible[false], name[], tag[99999], posX[640.000000], posY[250.000000], width[0], height[0], z-order[0]
class MYUISprite layer[2], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1081139200], z-order[0]
class MYNormalProgressTimer layer[2], visible[true], name[], tag[-1], posX[19.000000], posY[1.000000], width[0], height[1080573952], z-order[0]
class cocos2d::Label layer[2], visible[true], name[], tag[-1], posX[0.000000], posY[-20.000000], width[0], height[1078034432], z-order[0]
class RideIngProgressUI layer[1], visible[false], name[], tag[99999], posX[640.000000], posY[250.000000], width[0], height[0], z-order[0]
class MYUISprite layer[2], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1081139200], z-order[0]
class MYNormalProgressTimer layer[2], visible[true], name[], tag[-1], posX[19.000000], posY[1.000000], width[0], height[1080573952], z-order[0]
class UseItemProgressUI layer[1], visible[false], name[], tag[99999], posX[640.000000], posY[300.000000], width[0], height[0], z-order[0]
class MYUISprite layer[2], visible[true], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1081139200], z-order[0]
class MYNormalProgressTimer layer[2], visible[true], name[], tag[-1], posX[19.000000], posY[1.000000], width[0], height[1080573952], z-order[0]
class cocos2d::Label layer[2], visible[true], name[], tag[-1], posX[0.000000], posY[-20.000000], width[0], height[1078034432], z-order[0]
class NodeHelper layer[1], visible[false], name[], tag[-1], posX[0.000000], posY[0.000000], width[0], height[1083441152], z-order[0]
class cocos2d::Label layer[2], visible[true], name[], tag[-1], posX[10.000000], posY[600.000000], width[0], height[1079410688], z-order[0]

total node count:2462

posted on   悉野  阅读(90)  评论(0编辑  收藏  举报

编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
历史上的今天:
2020-10-22 win10系统瞬间黑屏问题
2012-10-22 C#修改电脑时间
点击右上角即可分享
微信分享提示