From 179266240f605cf7b797264044c7d55f936c657a Mon Sep 17 00:00:00 2001 From: VisualSJ Date: Wed, 29 Jul 2015 19:49:54 +0800 Subject: [PATCH] Update js parser (timelineParser-2.x.js) --- .../studio/parsers/timelineParser-2.x.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js index c70f68f094..5672333e08 100644 --- a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js +++ b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js @@ -332,6 +332,23 @@ widget.setColor(getColor(color)); setLayoutComponent(widget, json); + bindCallback(widget, json); + }; + + var bindCallback = function(widget, json){ + var callBackType = json["CallBackType"]; + var callBackName = json["CallBackName"]; + var callBack = function(e){ + if(typeof widget[callBackName] === "function") + widget[callBackName](e); + }; + if(callBackType === "Click"){ + widget.addClickEventListener(callBack); + }else if(callBackType === "Touch"){ + widget.addTouchEventListener(callBack); + }else if(callBackType === "Event"){ + widget.addCCSEventListener(callBack); + } }; var setLayoutComponent = function(widget, json){ @@ -375,6 +392,7 @@ layoutComponent.setPercentHeightEnabled(sizeYPercentEnable); layoutComponent.setPercentWidth(sizeXPercent); layoutComponent.setPercentHeight(sizeYPercent); + layoutComponent.setPercentWidthEnabled(sizeXPercentEnable || sizeYPercentEnable); layoutComponent.setStretchWidthEnabled(stretchHorizontalEnabled); layoutComponent.setStretchHeightEnabled(stretchVerticalEnabled); @@ -1487,6 +1505,8 @@ {name: "SingleNodeObjectData", handle: parser.initSingleNode}, {name: "NodeObjectData", handle: parser.initSingleNode}, {name: "LayerObjectData", handle: parser.initSingleNode}, + {name: "GameNodeObjectData", handle: parser.initSingleNode}, + {name: "GameLayerObjectData", handle: parser.initSingleNode}, {name: "SpriteObjectData", handle: parser.initSprite}, {name: "ParticleObjectData", handle: parser.initParticle}, {name: "PanelObjectData", handle: parser.initPanel},