版主,问下,为什么cocostudio导出的json文件加载到程序中,有4个按钮,另外3个是其中一个复制的,结果显示的时候只显示第一个按钮 其他三个都不显示!这怎回事啊!望赐教!但之前有显示成功的,也是复制的!很奇怪!斑竹…
您好,能否提供截图说明呢?
代码何在?
看看坐标对不,看看有没addChild
/**
* 加载json文件
*/
_uiLayer = BaseLayer::create();
addChild(_uiLayer);
_widget = dynamic_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("land/land.ExportJson"));
_uiLayer->addChild(_widget);
{
“classname”: null,
“name”: null,
“animation”: {
“classname”: null,
“name”: “AnimationManager”,
“actionlist”: ]
},
“dataScale”: 1,
“designHeight”: 960,
“designWidth”: 640,
“textures”: ],
“version”: “1.3.0.0”,
“widgetTree”: {
“classname”: “Panel”,
“name”: null,
“children”:
{
“classname”: “ImageView”,
“name”: null,
“children”:
{
“classname”: “Button”,
“name”: null,
“children”:
{
“classname”: “Label”,
“name”: null,
“children”: ],
“options”: {
“__type”: “LabelSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Label”,
“name”: “Label_realm name_3”,
“ZOrder”: 0,
“actiontag”: 53,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “Label”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 59,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.0151515156,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 0.334507048,
“sizePercentY”: 0.2979798,
“sizeType”: 0,
“tag”: 28,
“touchAble”: false,
“useMergedTexture”: false,
“visible”: false,
“width”: 285,
“x”: 0,
“y”: 3,
“areaHeight”: 0,
“areaWidth”: 0,
“fontFile”: null,
“fontName”: “微软雅黑”,
“fontSize”: 46,
“hAlignment”: 0,
“text”: “九天星辰 4区”,
“touchScaleEnable”: false,
“vAlignment”: 0
}
}
],
“options”: {
“__type”: “ButtonSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Button”,
“name”: “Button_realm_3”,
“ZOrder”: 0,
“actiontag”: 51,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “Button”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 198,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.571302831,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 1,
“sizePercentY”: 0.174295768,
“sizeType”: 0,
“tag”: 26,
“touchAble”: true,
“useMergedTexture”: false,
“visible”: true,
“width”: 852,
“x”: 0,
“y”: 649,
“capInsetsHeight”: 1,
“capInsetsWidth”: 1,
“capInsetsX”: 0,
“capInsetsY”: 0,
“disabled”: null,
“disabledData”: {
“path”: null,
“plistFile”: null,
“resourceType”: 0
},
“fontName”: “微软雅黑”,
“fontSize”: 14,
“fontType”: 0,
“normal”: null,
“normalData”: {
“path”: “界面0-3.png”,
“plistFile”: “”,
“resourceType”: 0
},
“pressed”: null,
“pressedData”: {
“path”: “界面0-4.png”,
“plistFile”: “”,
“resourceType”: 0
},
“scale9Enable”: false,
“scale9Height”: 198,
“scale9Width”: 852,
“text”: “”,
“textColorB”: 255,
“textColorG”: 255,
“textColorR”: 255
}
},
{
“classname”: “ImageView”,
“name”: null,
“children”: ],
“options”: {
“__type”: “ImageViewSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “ImageView”,
“name”: “ImageView_point”,
“ZOrder”: 0,
“actiontag”: 54,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “ImageView”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 66,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.0343309864,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 1,
“sizePercentY”: 0.0580985919,
“sizeType”: 0,
“tag”: 29,
“touchAble”: false,
“useMergedTexture”: false,
“visible”: true,
“width”: 852,
“x”: 0,
“y”: 39,
“capInsetsHeight”: 1,
“capInsetsWidth”: 1,
“capInsetsX”: 0,
“capInsetsY”: 0,
“fileName”: null,
“fileNameData”: {
“path”: “界面0-5.png”,
“plistFile”: “”,
“resourceType”: 0
},
“scale9Enable”: false,
“scale9Height”: 66,
“scale9Width”: 852
}
},
{
“classname”: “Button”,
“name”: null,
“children”:
{
“classname”: “Label”,
“name”: null,
“children”: ],
“options”: {
“__type”: “LabelSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Label”,
“name”: “Label_role1”,
“ZOrder”: 0,
“actiontag”: 129,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “Label”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 59,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.0151515156,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 0.334507048,
“sizePercentY”: 0.2979798,
“sizeType”: 0,
“tag”: 86,
“touchAble”: false,
“useMergedTexture”: false,
“visible”: true,
“width”: 285,
“x”: 0,
“y”: 3,
“areaHeight”: 0,
“areaWidth”: 0,
“fontFile”: null,
“fontName”: “微软雅黑”,
“fontSize”: 46,
“hAlignment”: 0,
“text”: “九天星辰 1区”,
“touchScaleEnable”: false,
“vAlignment”: 0
}
}
],
“options”: {
“__type”: “ButtonSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Button”,
“name”: “Button_realm_default”,
“ZOrder”: 0,
“actiontag”: 128,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “Button”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 198,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.152288735,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 1,
“sizePercentY”: 0.174295768,
“sizeType”: 0,
“tag”: 85,
“touchAble”: true,
“useMergedTexture”: false,
“visible”: true,
“width”: 852,
“x”: 0,
“y”: 173,
“capInsetsHeight”: 1,
“capInsetsWidth”: 1,
“capInsetsX”: 0,
“capInsetsY”: 0,
“disabled”: null,
“disabledData”: {
“path”: null,
“plistFile”: null,
“resourceType”: 0
},
“fontName”: “微软雅黑”,
“fontSize”: 14,
“fontType”: 0,
“normal”: null,
“normalData”: {
“path”: “界面0-3.png”,
“plistFile”: “”,
“resourceType”: 0
},
“pressed”: null,
“pressedData”: {
“path”: “界面0-4.png”,
“plistFile”: “”,
“resourceType”: 0
},
“scale9Enable”: false,
“scale9Height”: 198,
“scale9Width”: 852,
“text”: “”,
“textColorB”: 255,
“textColorG”: 255,
“textColorR”: 255
}
},
{
“classname”: “Button”,
“name”: null,
“children”:
{
“classname”: “Label”,
“name”: null,
“children”: ],
“options”: {
“__type”: “LabelSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Label”,
“name”: “Label_realm name_1”,
“ZOrder”: 0,
“actiontag”: 131,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “Label”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 59,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.0151515156,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 0.334507048,
“sizePercentY”: 0.2979798,
“sizeType”: 0,
“tag”: 88,
“touchAble”: false,
“useMergedTexture”: false,
“visible”: true,
“width”: 285,
“x”: 0,
“y”: 3,
“areaHeight”: 0,
“areaWidth”: 0,
“fontFile”: null,
“fontName”: “微软雅黑”,
“fontSize”: 46,
“hAlignment”: 0,
“text”: “九天星辰 2区”,
“touchScaleEnable”: false,
“vAlignment”: 0
}
}
],
“options”: {
“__type”: “ButtonSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Button”,
“name”: “Button_realm_1”,
“ZOrder”: 0,
“actiontag”: 130,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “Button”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 198,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.292253524,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 1,
“sizePercentY”: 0.174295768,
“sizeType”: 0,
“tag”: 87,
“touchAble”: true,
“useMergedTexture”: false,
“visible”: true,
“width”: 852,
“x”: 0,
“y”: 332,
“capInsetsHeight”: 1,
“capInsetsWidth”: 1,
“capInsetsX”: 0,
“capInsetsY”: 0,
“disabled”: null,
“disabledData”: {
“path”: null,
“plistFile”: null,
“resourceType”: 0
},
“fontName”: “微软雅黑”,
“fontSize”: 14,
“fontType”: 0,
“normal”: null,
“normalData”: {
“path”: “界面0-3.png”,
“plistFile”: “”,
“resourceType”: 0
},
“pressed”: null,
“pressedData”: {
“path”: “界面0-4.png”,
“plistFile”: “”,
“resourceType”: 0
},
“scale9Enable”: false,
“scale9Height”: 198,
“scale9Width”: 852,
“text”: “”,
“textColorB”: 255,
“textColorG”: 255,
“textColorR”: 255
}
},
{
“classname”: “Button”,
“name”: null,
“children”:
{
“classname”: “Label”,
“name”: null,
“children”: ],
“options”: {
“__type”: “LabelSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Label”,
“name”: “Label_realm name_2”,
“ZOrder”: 0,
“actiontag”: 133,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “Label”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 59,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.0151515156,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 0.334507048,
“sizePercentY”: 0.2979798,
“sizeType”: 0,
“tag”: 90,
“touchAble”: false,
“useMergedTexture”: false,
“visible”: true,
“width”: 285,
“x”: 0,
“y”: 3,
“areaHeight”: 0,
“areaWidth”: 0,
“fontFile”: null,
“fontName”: “微软雅黑”,
“fontSize”: 46,
“hAlignment”: 0,
“text”: “九天星辰 3区”,
“touchScaleEnable”: false,
“vAlignment”: 0
}
}
],
“options”: {
“__type”: “ButtonSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Button”,
“name”: “Button_realm_2”,
“ZOrder”: 0,
“actiontag”: 132,
“anchorPointX”: 0.5,
“anchorPointY”: 0.5,
“classType”: “Button”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 198,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0.4322183,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 1,
“sizePercentY”: 0.174295768,
“sizeType”: 0,
“tag”: 89,
“touchAble”: true,
“useMergedTexture”: false,
“visible”: true,
“width”: 852,
“x”: 0,
“y”: 491,
“capInsetsHeight”: 1,
“capInsetsWidth”: 1,
“capInsetsX”: 0,
“capInsetsY”: 0,
“disabled”: null,
“disabledData”: {
“path”: null,
“plistFile”: null,
“resourceType”: 0
},
“fontName”: “微软雅黑”,
“fontSize”: 14,
“fontType”: 0,
“normal”: null,
“normalData”: {
“path”: “界面0-3.png”,
“plistFile”: “”,
“resourceType”: 0
},
“pressed”: null,
“pressedData”: {
“path”: “界面0-4.png”,
“plistFile”: “”,
“resourceType”: 0
},
“scale9Enable”: false,
“scale9Height”: 198,
“scale9Width”: 852,
“text”: “”,
“textColorB”: 255,
“textColorG”: 255,
“textColorR”: 255
}
}
],
“options”: {
“__type”: “ImageViewSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “ImageView”,
“name”: “ImageView_background”,
“ZOrder”: 0,
“actiontag”: 50,
“anchorPointX”: 0.5,
“anchorPointY”: 1.49011612E-08,
“classType”: “ImageView”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 1136,
“ignoreSize”: true,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0.5,
“positionPercentY”: 0,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 0.85,
“scaleY”: 0.85,
“sizePercentX”: 1.33125,
“sizePercentY”: 1.18333328,
“sizeType”: 0,
“tag”: 25,
“touchAble”: true,
“useMergedTexture”: false,
“visible”: true,
“width”: 852,
“x”: 320,
“y”: 0,
“capInsetsHeight”: 1,
“capInsetsWidth”: 1,
“capInsetsX”: 0,
“capInsetsY”: 0,
“fileName”: null,
“fileNameData”: {
“path”: “界面0-2.png”,
“plistFile”: “”,
“resourceType”: 0
},
“scale9Enable”: false,
“scale9Height”: 1136,
“scale9Width”: 852
}
}
],
“options”: {
“__type”: “PanelSurrogate:#EditorCommon.JsonModel.Component.GUI”,
“classname”: “Panel”,
“name”: “Panel_48”,
“ZOrder”: 0,
“actiontag”: -1,
“anchorPointX”: 0,
“anchorPointY”: 0,
“classType”: “Panel”,
“colorB”: 255,
“colorG”: 255,
“colorR”: 255,
“customProperty”: “”,
“flipX”: false,
“flipY”: false,
“height”: 960,
“ignoreSize”: false,
“layoutParameter”: null,
“opacity”: 255,
“positionPercentX”: 0,
“positionPercentY”: 0,
“positionType”: 0,
“rotation”: 0,
“scaleX”: 1,
“scaleY”: 1,
“sizePercentX”: 0,
“sizePercentY”: 0,
“sizeType”: 0,
“tag”: 24,
“touchAble”: true,
“useMergedTexture”: false,
“visible”: true,
“width”: 640,
“x”: 0,
“y”: 0,
“adaptScreen”: false,
“backGroundImage”: null,
“backGroundImageData”: null,
“backGroundScale9Enable”: false,
“bgColorB”: 255,
“bgColorG”: 200,
“bgColorOpacity”: 0,
“bgColorR”: 150,
“bgEndColorB”: 255,
“bgEndColorG”: 200,
“bgEndColorR”: 150,
“bgStartColorB”: 255,
“bgStartColorG”: 255,
“bgStartColorR”: 255,
“capInsetsHeight”: 1,
“capInsetsWidth”: 1,
“capInsetsX”: 0,
“capInsetsY”: 0,
“clipAble”: false,
“colorType”: 1,
“layoutType”: 0,
“vectorX”: 0,
“vectorY”: -0.5
}
}
}
请问你的分辨率是多少
640x960 也不知道为啥不能显示!
— Begin quote from ____
引用第6楼hanxiangmoran于2014-03-27 15:33发表的 回 5楼(孤独の快乐) 的帖子 :
640x960 也不知道为啥不能显示! http://www.cocoachina.com/bbs/job.php?action=topost&tid=195836&pid=912799
— End quote
难道你用了cocos2d-x的适配函数了?
谢谢 找到原因了!
为何不给分享
xcode给我带来的困扰!清下就好了!
如图,,项目资源,看不到cocos2dx,不能直接编辑代码?》 模拟器也不好使。不能运行