本文整理汇总了C++中CCLayer::getTouchPriority方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLayer::getTouchPriority方法的具体用法?C++ CCLayer::getTouchPriority怎么用?C++ CCLayer::getTouchPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLayer
的用法示例。
在下文中一共展示了CCLayer::getTouchPriority方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTouchPriority
CCObject *HTouchEnabledLayerColor::updatePriorityEx(int command, CCNode *node) {
int iBasePriority = getTouchPriority();
if (dynamic_cast<CCControl *>(node)) {
CCControl *control = (CCControl *)node;
int priority = control->getTouchPriority();
priority = iBasePriority - 9;
control->setTouchPriority(priority);
if (control->isTouchEnabled()) {
control->setTouchEnabled(false);
control->setTouchEnabled(true);
}
} else if (dynamic_cast<CCScrollView *>(node)) {
CCScrollView *scrollView = (CCScrollView *)node;
int priority = scrollView->getTouchPriority();
priority = iBasePriority - 11;
scrollView->setTouchPriority(priority);
if (scrollView->isTouchEnabled()) {
scrollView->setTouchEnabled(false);
scrollView->setTouchEnabled(true);
}
} else if (dynamic_cast<CCMenu *>(node)) {
CCMenu *menu = (CCMenu *)node;
int priority = menu->getTouchPriority();
priority = iBasePriority - 128;
menu->setTouchPriority(priority);
if (menu->isTouchEnabled()) {
menu->setTouchEnabled(false);
menu->setTouchEnabled(true);
}
} else if (dynamic_cast<CCLayer *>(node)) {
CCLayer *layer = (CCLayer *)node;
int priority = layer->getTouchPriority();
priority = iBasePriority;
layer->setTouchPriority(priority);
if (layer->isTouchEnabled()) {
layer->setTouchEnabled(false);
layer->setTouchEnabled(true);
}
}
CCArray *children = node->getChildren();
if (children) {
int count = children->count();
for (int i = 0; i < count; ++i) {
CCNode *child = (CCNode *)children->objectAtIndex(i);
updatePriorityEx(command, child);
}
}
return NULL;
}
示例2: registerWithTouchDispatcher
void GameLoadingLayer::registerWithTouchDispatcher()
{
CCLayer::registerWithTouchDispatcher();
CCObject* child;
//循环获取父节点中的子节点
CCARRAY_FOREACH(m_pChildren, child)
{
CCLayer* pNode = dynamic_cast<CCLayer*>(child);
if(pNode)
{
//设置子节点消息响应的优先级
pNode->setTouchPriority(getTouchPriority() + pNode->getTouchPriority());
}
}