|
280 | 280 |
|
281 | 281 | var scale = json["Scale"]; |
282 | 282 | if(scale != null){ |
283 | | - widget.setScaleX(scale["ScaleX"] || 1); |
284 | | - widget.setScaleY(scale["ScaleY"] || 1); |
| 283 | + var scaleX = getParam(scale["ScaleX"], 1); |
| 284 | + var scaleY = getParam(scale["ScaleY"], 1); |
| 285 | + widget.setScaleX(scaleX); |
| 286 | + widget.setScaleY(scaleY); |
285 | 287 | } |
286 | 288 |
|
287 | 289 | var anchorPoint = json["AnchorPoint"]; |
|
372 | 374 |
|
373 | 375 | this.widgetAttributes(widget, json); |
374 | 376 |
|
375 | | - var clipEnabled = json["ClipAple"]; |
| 377 | + var clipEnabled = json["ClipAble"]; |
376 | 378 | if(clipEnabled != null) |
377 | 379 | widget.setClippingEnabled(clipEnabled); |
378 | 380 |
|
|
387 | 389 | if(backGroundScale9Enabled != null) |
388 | 390 | widget.setBackGroundImageScale9Enabled(backGroundScale9Enabled); |
389 | 391 |
|
390 | | - var opacity = json["Alpha"] || 255; |
| 392 | + var opacity = getParam(json["Alpha"], 255); |
391 | 393 | widget.setOpacity(opacity); |
392 | 394 |
|
393 | 395 | loadTexture(json["FileData"], resourcePath, function(path, type){ |
|
640 | 642 | this.widgetAttributes(widget, json); |
641 | 643 |
|
642 | 644 | var clipEnabled = json["ClipAble"]; |
643 | | - if(clipEnabled) |
644 | | - widget.setClippingEnabled(true); |
| 645 | + widget.setClippingEnabled(clipEnabled); |
645 | 646 |
|
646 | 647 | var colorType = getParam(json["ComboBoxIndex"], 0); |
647 | 648 | widget.setBackGroundColorType(colorType); |
|
681 | 682 |
|
682 | 683 | var colorVector = json["ColorVector"]; |
683 | 684 | if(colorVector){ |
684 | | - widget.setBackGroundColorVector(cc.p(colorVector["ScaleX"] || 1, colorVector["ScaleY"] || 1)); |
| 685 | + var colorVectorX = getParam(colorVector["ScaleX"], 1); |
| 686 | + var colorVectorY = getParam(colorVector["ScaleY"], 1); |
| 687 | + widget.setBackGroundColorVector(cc.p(colorVectorX, colorVectorY)); |
685 | 688 | } |
686 | 689 |
|
687 | 690 | loadTexture(json["FileData"], resourcePath, function(path, type){ |
|
690 | 693 |
|
691 | 694 | var innerNodeSize = json["InnerNodeSize"]; |
692 | 695 | var innerSize = cc.size( |
693 | | - innerNodeSize["width"] || 0, |
694 | | - innerNodeSize["height"] || 0 |
| 696 | + innerNodeSize["Width"] || 0, |
| 697 | + innerNodeSize["Height"] || 0 |
695 | 698 | ); |
696 | 699 | widget.setInnerContainerSize(innerSize); |
697 | 700 |
|
|
822 | 825 |
|
823 | 826 | this.widgetAttributes(widget, json); |
824 | 827 |
|
825 | | - var clipEnabled = json["ClipAble"]; |
826 | | - if(clipEnabled) |
827 | | - widget.setClippingEnabled(true); |
| 828 | + var clipEnabled = json["ClipAble"] || false; |
| 829 | + widget.setClippingEnabled(clipEnabled); |
828 | 830 |
|
829 | 831 | var backGroundScale9Enabled = json["Scale9Enable"]; |
830 | 832 | if(backGroundScale9Enabled){ |
|
859 | 861 |
|
860 | 862 | var colorVector = json["ColorVector"]; |
861 | 863 | if(colorVector != null && colorVector["ScaleX"] != null && colorVector["ScaleY"] != null) |
862 | | - widget.setBackGroundColorVector(colorVector["ScaleX"], colorVector["ScaleY"]); |
| 864 | + widget.setBackGroundColorVector(cc.p(colorVector["ScaleX"], colorVector["ScaleY"])); |
863 | 865 | if(bgColorOpacity != null) |
864 | 866 | widget.setBackGroundColorOpacity(bgColorOpacity); |
865 | 867 |
|
|
885 | 887 |
|
886 | 888 | this.widgetAttributes(widget, json); |
887 | 889 |
|
888 | | - var clipEnabled = json["ClipAble"]; |
889 | | - if(clipEnabled) |
890 | | - widget.setClippingEnabled(true); |
| 890 | + var clipEnabled = json["ClipAble"] || false; |
| 891 | + widget.setClippingEnabled(clipEnabled); |
891 | 892 |
|
892 | 893 | var colorType = getParam(json["ComboBoxIndex"], 0); |
893 | 894 | widget.setBackGroundColorType(colorType); |
|
927 | 928 | else if (horizontalType == "Align_Right") |
928 | 929 | widget.setGravity(ccui.ListView.GRAVITY_RIGHT); |
929 | 930 | else if (horizontalType == "Align_HorizontalCenter") |
930 | | - widget.setGravity(ccui.ListView.GRAVITY_CENTER_VERTICAL); |
| 931 | + widget.setGravity(ccui.ListView.GRAVITY_CENTER_HORIZONTAL); |
931 | 932 | } |
932 | 933 |
|
933 | 934 |
|
|
955 | 956 |
|
956 | 957 | var colorVector = json["ColorVector"]; |
957 | 958 | if(colorVector != null && colorVector["ScaleX"] != null && colorVector["ScaleY"] != null) |
958 | | - widget.setBackGroundColorVector(colorVector["ScaleX"], colorVector["ScaleY"]); |
| 959 | + widget.setBackGroundColorVector(cc.p(colorVector["ScaleX"], colorVector["ScaleY"])); |
959 | 960 | if(bgColorOpacity != null) |
960 | 961 | widget.setBackGroundColorOpacity(bgColorOpacity); |
961 | 962 |
|
|
1130 | 1131 | loadTexture(json["FileData"], resourcePath, function(path, type){ |
1131 | 1132 | if(type == 0) |
1132 | 1133 | node = new cc.TMXTiledMap(path); |
| 1134 | + |
| 1135 | + parser.generalAttributes(node, json); |
1133 | 1136 | }); |
1134 | 1137 |
|
1135 | 1138 | return node; |
|
1145 | 1148 | var projectFile = json["FileData"]; |
1146 | 1149 | if(projectFile != null && projectFile["Path"]){ |
1147 | 1150 | var file = resourcePath + projectFile["Path"]; |
1148 | | - if(cc.loader.getRes(file)) |
1149 | | - return ccs._load(file); |
1150 | | - else |
| 1151 | + if(cc.loader.getRes(file)){ |
| 1152 | + var obj = ccs.load(file); |
| 1153 | + parser.generalAttributes(obj.node, json); |
| 1154 | + if(obj.action && obj.node){ |
| 1155 | + obj.action.tag = obj.node.tag; |
| 1156 | + obj.node.runAction(obj.action); |
| 1157 | + obj.action.gotoFrameAndPause(0); |
| 1158 | + } |
| 1159 | + return obj.node; |
| 1160 | + } else |
1151 | 1161 | cc.log("%s need to be preloaded", file); |
1152 | 1162 | } |
1153 | 1163 | }; |
|
1176 | 1186 |
|
1177 | 1187 | var currentAnimationName = json["CurrentAnimationName"]; |
1178 | 1188 |
|
| 1189 | + parser.generalAttributes(node, json); |
| 1190 | + |
1179 | 1191 | loadTexture(json["FileData"], resourcePath, function(path, type){ |
1180 | 1192 | var plists, pngs; |
1181 | 1193 | var armJson = cc.loader.getRes(path); |
|
1241 | 1253 |
|
1242 | 1254 | var register = [ |
1243 | 1255 | {name: "SingleNodeObjectData", handle: parser.initSingleNode}, |
| 1256 | + {name: "LayerObjectData", handle: parser.initSingleNode}, |
1244 | 1257 | {name: "SpriteObjectData", handle: parser.initSprite}, |
1245 | 1258 | {name: "ParticleObjectData", handle: parser.initParticle}, |
1246 | 1259 | {name: "PanelObjectData", handle: parser.initPanel}, |
|
0 commit comments