为了账号安全,请及时绑定邮箱和手机立即绑定

cocos2d-x 3.0怎么创建触摸优先级高于Menu

cocos2d-x 3.0怎么创建触摸优先级高于Menu

HUH函数 2018-10-29 04:00:05
cocos2d-x 3.0怎么创建触摸优先级高于Menu
查看完整描述

1 回答

?
白猪掌柜的

TA贡献1893条经验 获得超10个赞

LayerColor *GameStopSprite::createNoTouchLayer(){

auto noTouchLayer = LayerColor::create(Color4B(255, 0, 0, 100));

auto listener = EventListenerTouchOneByOne::create();

listener->setSwallowTouches(true);

listener->onTouchBegan = [](Touch *touch, Event *event){

log("pressed.......");

return false;

};

Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(listener, -130); //第1句

Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, noTouchLayer); //第2句

return noTouchLayer;

}

查看完整回答
反对 回复 2018-11-09
  • 1 回答
  • 0 关注
  • 861 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信