示例#1
0
//
// handlers management
//
void CCTouchDispatcher::forceAddHandler(CCTouchHandler *pHandler,
		CCArray *pArray)
{
	unsigned int u = 0;

	CCObject* pObj = NULL;
	CCARRAY_FOREACH(pArray, pObj)
	{
		CCTouchHandler *h = (CCTouchHandler *) pObj;
		if (h)
		{
			if (h->getPriority() < pHandler->getPriority())
			{
				++u;
			}

#if 0
			if (h->getPriority() == pHandler->getPriority())
			{
				if (h->getDelegate()->getSubPriority() < pHandler->getDelegate()->getSubPriority())
				{
					++u;
				}
			}
#endif

			if (h->getDelegate() == pHandler->getDelegate())
			{
				CCAssert(0, "");
				return;
			}
		}
	}
示例#2
0
//
// handlers management
//
void CCTouchDispatcher::forceAddHandler(CCTouchHandler *pHandler, CCMutableArray<CCTouchHandler*> *pArray)
{
	unsigned int u = 0;

 	CCMutableArray<CCTouchHandler*>::CCMutableArrayIterator iter;
 	for (iter = pArray->begin(); iter != pArray->end(); ++iter)
 	{
 		CCTouchHandler *h = *iter;
         if (h)
         {
 		    if (h->getPriority() < pHandler->getPriority())
 		    {
 			    ++u;
 		    }
 
 		    if (h->getDelegate() == pHandler->getDelegate())
 		    {
 			    CCAssert(0, "");
 			    return;
 		    }
         }
 	}

	pArray->insertObjectAtIndex(pHandler, u);
}