1 回答

TA貢獻(xiàn)1893條經(jīng)驗(yàn) 獲得超10個(gè)贊
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;
}
- 1 回答
- 0 關(guān)注
- 940 瀏覽
添加回答
舉報(bào)