void HTouchEnabledLayerColor::setPriority(CCNode *node, int priority) { if (dynamic_cast<CCControl *>(node)) { CCControl *control = (CCControl *)node; control->setTouchPriority(priority); if (control->isTouchEnabled()) { control->setTouchEnabled(false); control->setTouchEnabled(true); } } else if (dynamic_cast<CCScrollView *>(node)) { CCScrollView *scrollView = (CCScrollView *)node; scrollView->setTouchPriority(priority); if (scrollView->isTouchEnabled()) { scrollView->setTouchEnabled(false); scrollView->setTouchEnabled(true); } } else if (dynamic_cast<CCMenu *>(node)) { CCMenu *menu = (CCMenu *)node; menu->setTouchPriority(priority); if (menu->isTouchEnabled()) { menu->setTouchEnabled(false); menu->setTouchEnabled(true); } } else if (dynamic_cast<CCLayer *>(node)) { CCLayer *layer = (CCLayer *)node; layer->setTouchPriority(priority); if (layer->isTouchEnabled()) { layer->setTouchEnabled(false); layer->setTouchEnabled(true); } } }
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; }