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 callBackType = json["CallBackType"];
|
||||
var callBackName = json["CallBackName"];
|
||||
var callBack = function(e){
|
||||
if(typeof widget[callBackName] === "function")
|
||||
widget[callBackName](e);
|
||||
};
|
||||
if(callBackType === "Click"){
|
||||
widget.addClickEventListener(function(){
|
||||
if(widget.onLocateClickCallback)
|
||||
widget.onLocateClickCallback(callBackName);
|
||||
});
|
||||
widget.addClickEventListener(callBack);
|
||||
}else if(callBackType === "Touch"){
|
||||
widget.addTouchEventListener(function(){
|
||||
if(widget.onLocateTouchCallback)
|
||||
widget.onLocateTouchCallback(callBackName);
|
||||
});
|
||||
widget.addTouchEventListener(callBack);
|
||||
}else if(callBackType === "Event"){
|
||||
widget.addCCSEventListener(function(){
|
||||
if(widget.onLocateEventCallback)
|
||||
widget.onLocateEventCallback(callBackName);
|
||||
});
|
||||
widget.addCCSEventListener(callBack);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue