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},