mirror of https://github.com/axmolengine/axmol.git
JS Studio parser (Modify callback method)
This commit is contained in:
parent
b282d75346
commit
d4900493e2
|
@ -364,21 +364,16 @@
|
||||||
var bindCallback = function(widget, json){
|
var bindCallback = function(widget, json){
|
||||||
var callBackType = json["CallBackType"];
|
var callBackType = json["CallBackType"];
|
||||||
var callBackName = json["CallBackName"];
|
var callBackName = json["CallBackName"];
|
||||||
|
var callBack = function(e){
|
||||||
|
if(typeof widget[callBackName] === "function")
|
||||||
|
widget[callBackName](e);
|
||||||
|
};
|
||||||
if(callBackType === "Click"){
|
if(callBackType === "Click"){
|
||||||
widget.addClickEventListener(function(){
|
widget.addClickEventListener(callBack);
|
||||||
if(widget.onLocateClickCallback)
|
|
||||||
widget.onLocateClickCallback(callBackName);
|
|
||||||
});
|
|
||||||
}else if(callBackType === "Touch"){
|
}else if(callBackType === "Touch"){
|
||||||
widget.addTouchEventListener(function(){
|
widget.addTouchEventListener(callBack);
|
||||||
if(widget.onLocateTouchCallback)
|
|
||||||
widget.onLocateTouchCallback(callBackName);
|
|
||||||
});
|
|
||||||
}else if(callBackType === "Event"){
|
}else if(callBackType === "Event"){
|
||||||
widget.addCCSEventListener(function(){
|
widget.addCCSEventListener(callBack);
|
||||||
if(widget.onLocateEventCallback)
|
|
||||||
widget.onLocateEventCallback(callBackName);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue