Update JSON parser

This commit is contained in:
VisualSj 2015-08-04 16:04:35 +08:00
parent b9602127a4
commit b9b565e64a
2 changed files with 4 additions and 6 deletions

View File

@ -113,7 +113,7 @@
name: "Rotation", name: "Rotation",
handle: function(options){ handle: function(options){
var frame = new ccs.RotationFrame(); var frame = new ccs.RotationFrame();
var rotation = options["Rotation"]; var rotation = options["Rotation"] || options["Value"] || 0;
frame.setRotation(rotation); frame.setRotation(rotation);
return frame; return frame;
} }

View File

@ -104,7 +104,9 @@
var visible = getParam(json["VisibleForFrame"], true); var visible = getParam(json["VisibleForFrame"], true);
node.setVisible(visible); node.setVisible(visible);
setContentSize(node, json["Size"]); var size = json["Size"];
if(size)
setContentSize(node, size);
if (json["Alpha"] != null) if (json["Alpha"] != null)
node.setOpacity(json["Alpha"]); node.setOpacity(json["Alpha"]);
@ -118,9 +120,7 @@
extensionData.setCustomProperty(customProperty); extensionData.setCustomProperty(customProperty);
extensionData.setActionTag(actionTag); extensionData.setActionTag(actionTag);
if (node.getComponent("ComExtensionData")) if (node.getComponent("ComExtensionData"))
{
node.removeComponent("ComExtensionData"); node.removeComponent("ComExtensionData");
}
node.addComponent(extensionData); node.addComponent(extensionData);
node.setCascadeColorEnabled(true); node.setCascadeColorEnabled(true);
@ -294,9 +294,7 @@
extensionData.setCustomProperty(customProperty); extensionData.setCustomProperty(customProperty);
extensionData.setActionTag(actionTag); extensionData.setActionTag(actionTag);
if (widget.getComponent("ComExtensionData")) if (widget.getComponent("ComExtensionData"))
{
widget.removeComponent("ComExtensionData"); widget.removeComponent("ComExtensionData");
}
widget.addComponent(extensionData); widget.addComponent(extensionData);
var rotationSkewX = json["RotationSkewX"]; var rotationSkewX = json["RotationSkewX"];