您的位置:首页 > 其它

CCLayer的优先级设置函数setTouchPriority()不生效

2014-05-06 18:53 204 查看

cocos2dx 2.2.3版本, 对于CCLayer的优先级设置函数setTouchPriority()居然不起作用,我表示非常的愤懑



因为CCLayer的触摸事件注册函数用到的priority为 m_pScriptTouchHandlerEntry->getPriority(),该值为函数

void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches)设置

而非setTouchPriority()设置的值







void CCLayer::registerWithTouchDispatcher()

{

CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher();

// Using LuaBindings

if (m_pScriptTouchHandlerEntry)

{

if (m_pScriptTouchHandlerEntry->isMultiTouches())

{

pDispatcher->addStandardDelegate(this, 0);

LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptTouchHandlerEntry->getHandler());

}

else

{

pDispatcher->addTargetedDelegate(this,

m_pScriptTouchHandlerEntry->getPriority(),

m_pScriptTouchHandlerEntry->getSwallowsTouches());

LUALOG("[LUA] Add touch event handler: %d", m_pScriptTouchHandlerEntry->getHandler());

}

}

else

{

if( m_eTouchMode == kCCTouchesAllAtOnce ) {

pDispatcher->addStandardDelegate(this, 0);

} else {

pDispatcher->addTargetedDelegate(this, m_nTouchPriority, true);

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: