mirror of https://github.com/axmolengine/axmol.git
Update js parser (timelineParser-2.x.js)
This commit is contained in:
parent
ff7d01376e
commit
179266240f
|
@ -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},
|
||||
|
|
Loading…
Reference in New Issue