cocos2d-x3.x之后触摸方法有所改变,要屏蔽掉某一层的触摸事件其实很简单,首先touchbegan一定要返回true,其次给监听事件设置吞噬触摸为true,最后注册触摸层级一定要高于按钮-128的层级
auto touchListener=EventListenerTouchOneByOne::create(); touchListener->onTouchBegan=[=](Touch *touch,Event *event) { touchListener->setSwallowTouches(true); return true; }; _eventDispatcher->addEventListenerWithFixedPriority(touchListener,-139);
cocos2d-x3.x屏蔽触摸遮罩层屏蔽按钮,布布扣,bubuko.com
时间: 2024-10-13 07:32:01