mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13091 from VisualSJ/v3-13063
Update js parser (timelineParser-2.x.js)
This commit is contained in:
commit
fa6c6de0b9
|
@ -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