cocos 获取所有子节点 -lua
2016-07-11 13:28
369 查看
function UiTools:getAllChild(parent)
local node_list = {}
local children = parent:getChildren()
end
local node_list = {}
local children = parent:getChildren()
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
end
相关文章推荐
- Cocos Creator常见问题汇总
- Cocos Studio制作多分辨率UI布局
- Cocos Studio 学习指引
- cocos2d-js脚本自动生成工具配置
- cocos3.12 mac下android环境配置问题
- BabeLua配置
- cocos lua 客户端项目规范
- cocos 2d-x 3.0 正式版环境搭建
- cocos2d-x 3.2 rc0 编译错误解决
- cocos2d-x 3.2 rc0 编译错误解决
- haspremultipliedalpha报错
- cocos 2d test-cpp 学习笔记之AppDelegate.cpp 代码分析
- cocos 2d 简单动画实现
- cocos2dx
- Cocos2dx3.3版本下配置cocostudio(原创)
- 永远的HelloWorld
- cocos2d-3.x 学习杂记
- cocos2dx 3.7添加手机震动
- 拉伸菜单与返回菜单
- cocos2dx游戏任务系统开发