Merge pull request #13091 from VisualSJ/v3-13063

Update js parser (timelineParser-2.x.js)
This commit is contained in:
pandamicro 2015-07-29 20:42:51 +08:00
commit fa6c6de0b9
1 changed files with 20 additions and 0 deletions

View File

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