cc-inspector-chrome/CocosCreatorInspector/数据结构设计思路.md
许彦峰 e7adf25ccf init
2019-03-15 10:08:39 +08:00

1.0 KiB

注入脚本收集的数据结构

节点树数据结构

{
  "scene": {
    "type":"1",// 类型
    "uuid": "scene-uuid",
    "name": "scene-name",
    "children": [
       {
        "uuid": "node-uuid",
        "name": "node-name",
        "type": "cc_Node",
        "x": 960.48,
        "y": 540,
        "zIndex": 0,
        "width": 1920.96,
        "height": 1080,
        "active": true,
        "color": "#ffffff",
        "opacity": 255,
        "rotation": 0,
        "rotationX": 0,
        "rotationY": 0,
        "anchorX": 0.5,
        "anchorY": 0.5,
        "scaleX": 1,
        "scaleY": 1,
        "skewX": 0,
        "skewY": 0,
        "childrenCount": 5,
        "children": []
      },
      {
        "uuid":"..."
      }
     ]
  }
}

缓存游戏真实的内存结构,window.inspectorGameMemoryStorage

{
  "node-uuid":"node-memory"
}

在遍历节点树的同时,会存储游戏实际的内存数据到inspectorGameMemoryStorage

获取某个节点信息

  window.getNodeInfo