现象如下:
关闭Mask,当点击Button时 自身active为false,a脚本是收不到触摸消息的,整个游戏正常
开启Mask,当点击Button时 自身active为false,a脚本竟然还是会收到触摸消息,导致无法继续游戏
坑了一天了。。。
结构如下
Canvas
—Node大小全屏(带一个MASK和一个a脚本)
—Button(仅仅为了测试,点击调用a脚本的onPopUpClose)
以下是a脚本
cc.Class({
extends: cc.Component,
properties: {
},
// use this for initialization
onLoad: function () {
function onTouchDown (event) {
Tools.showToast("touch1",0);
event.stopPropagation();
}
function onTouchUp (event) {
event.stopPropagation();
}
function onTouchMove (event) {
event.stopPropagation();
}
this.node.on('touchstart', onTouchDown, this.node);
this.node.on('touchend', onTouchUp, this.node);
this.node.on('touchcancel', onTouchUp, this.node);
this.node.on('touchmove', onTouchMove, this.node);
},
onPopUpClose:function(){
this.node.active=false;
},
});
