@piking881 写道:
创建一个NotificationLayer,里面吞掉了触摸事件,但是挂到NotificationNode上时,下面的Layer还是可以接收到消息,请问有什么解决方案能屏蔽掉触摸么
var NotificationLayer = cc.Layer.extend({
_touchListener: null, onEnter: function () { if (this._touchListener == null) { this._touchListener = cc.EventListener.create({ event: cc.EventListener.TOUCH_ONE_BY_ONE, swallowTouches: true, onTouchBegan: this.onTouchBegan, onTouchMoved: this.onTouchMoved, onTouchEnded: this.onTouchEnded }); } cc.eventManager.addListener(this._touchListener, this); }, onExit: function () { cf.removeListener(this._touchListener); }, onTouchBegan: function (touch, event) { return true; }, onTouchMoved: function (touch, event) { }, onTouchEnded: function (touch, event) { }
});
帖子: 1
参与者: 1