一、 方案一:改写Node的派发事件
方法:改写node的派发事件,当有多个响应的时候不去进行dispatch。
在游戏开启的时候把node原来的方法:
cc.Node.prototype.dispatchEvent ƒ (event) {
_doDispatchEvent(this, event);
cachedArray.length = 0;
}、
改为:在游戏必经的文件中调用一次;改写node的dispatchEvent的方法
DealMulityEventListener:function(){
cc.Node.maxTouchNum = 1;
cc.Node.touchNum = 0;
var __dispatchEvent__ = cc.Node.prototype.dispatchEvent;
cc.Node.prototype.dispatchEvent = function (event) {
switch (event.type) {
case 'touchstart':
if (cc.Node.touchNum < cc.Node.maxTouchNum) {
cc.Node.touchNum++;
this._canTouch = true;
__dispatchEvent__.call(this, event);
}
break;
case 'touchmove':
if (!this._canTouch && cc.Node.touch