【已解决】场景编辑器解析错误

  • 本帖最后由 qin3956 于 2013-8-19 14:41 编辑 *

用的最新版本0.3.1

一个很简单的场景,加载到程序当中,编译没错,F5运行出错了

卡在这了

if (widget->getContentSize().equals(CCSizeZero))
    {
        UIContainerWidget* rootWidget = dynamic_cast<UIContainerWidget*>(widget);
        rootWidget->setSize(CCSizeMake(fileDesignWidth, fileDesignHeight));
    }

我看了一下内存

widgetTree的type_没有值,allocated_没有值,comments_没有值

问题解决了,是我使用问题

我打开json文件

并没有找到“widgetTree”,我怀疑是不是场景编辑器在生成json时候漏掉了

我查看了例子中的json和最新场景编辑器生成的完全不同,里面参数都不一样

这是怎么回事啊?半成品吗?

我新建的场景编辑器导出的json

{
  "classname": "CCNode",
  "name": null,
  "canedit": true,
  "objecttag": 10000,
  "rotation": 0,
  "scalex": 1,
  "scaley": 1,
  "visible": 1,
  "x": 0,
  "y": 0,
  "zorder": 0,
  "gameobjects": ],
  "CanvasSize": {
    "_height": 320,
    "_width": 480
  },
  "Version": "0.3.1.0",
  "components": 
    {
      "__type": "ComSceneSurrogate:#EditorCommon.JsonModel.Component",
      "classname": "CCScene",
      "name": "CCScene",
      "scenename": "NewProject"
    },
    {
      "__type": "ComSimpleAudioSurrogate:#EditorCommon.JsonModel.Component",
      "classname": "CCBackgroundAudio",
      "name": "CCBackgroundAudio",
      "file": null,
      "fileData": {
        "path": "",
        "plistFile": null,
        "resourceType": 0
      },
      "loop": 0
    }
  ]
}

test中的CocoGUISample.json

{
    "version" : 1.0,
    "textures" : ],
    "designWidth" : 480.0,
    "designHeight" : 320.0,
    "widgetTree" :
    {
        "classname" : "Panel",
        "options" :
        {
            "width" : 480,
            "height" : 320
        },
        "children" :
        
        {
         "classname" : "ScrollView",
         "options" :
         {
         "x" : 330,
         "y" : 220,
         "width" : 150,
         "height" : 100,
         "backGroundScale9Enable" : true,
         "clipAble" : true,
         "touchAble" : true,
         "backGroundImage" : "scrollviewbg.png",
         "name" : "scrollview"
         },
         "children" :
         
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 260,
          "text" : "Anchor:"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 240,
          "text" : "Eddy"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 220,
          "text" : "Nutty"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 200,
          "text" : "Liam"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 180,
          "text" : "Guanqiang"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 160,
          "text" : "youyouyou"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 140,
          "text" : "jxh"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 120,
          "text" : "chengstory"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 100,
          "text" : "houlong"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 80,
          "text" : "pipu"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 60,
          "text" : "huangwei"
          },
          "children" : ]
          },
          {
          "classname" : "Label",
          "options" : {
          "x" : 75,
          "y" : 40,
          "text" : "xiexin"
          },
          "children" : ]
          },
          {
          "classname" : "TextButton",
          "options" : {
          "x" : 75,
          "y" : 20,
          "text" : "返回顶部",
          "normal" : "backtotopnormal.png",
          "pressed" : "backtotoppressed.png",
          "disabled" : "backtotoppressed.png",
          "touchAble" : true,
          "name" : "backtotopbutton"

求指导啊,我遇到这个问题一直误解啊。。

求指导啊,我遇到这个问题一直误解啊。。