コード例 #1
0
void LHTouchMgr::removeTouchEndedObserver(CCObject* observer){
    
#if COCOS2D_VERSION >= 0x00020000
    CCArray* keys = onTouchEndedOnSpriteOfTag.allKeys();
    
    if(keys){
        for(int i = 0; i < keys->count(); ++i){
            
            LHObserverPair* pair = (LHObserverPair*)onTouchEndedOnSpriteOfTag.objectForKey(((CCInteger*)keys->objectAtIndex(i))->getValue());
            
            if(pair->object == observer){
                onTouchEndedOnSpriteOfTag.removeObjectForKey(((CCInteger*)keys->objectAtIndex(i))->getValue());
            }
        }
    }
    
#else
    
    std::vector<int> keys = onTouchEndedOnSpriteOfTag.allKeys();
    for(int i = 0; i < keys.size(); ++i){
        LHObserverPair* pair = (LHObserverPair*)onTouchEndedOnSpriteOfTag.objectForKey(keys[i]);
        
        if(pair->object == observer){
            onTouchEndedOnSpriteOfTag.removeObjectForKey(keys[i]);
        }
    }    
#endif
}
コード例 #2
0
ファイル: plistHelper.cpp プロジェクト: nkligang/ccbi2ccb
void RecurseDestroy(CCObject * pObj)
{
  if (pObj == NULL) return;
  if (pObj->isOfClass(CCObject::ClassOfCCDictionary))
  {
    CCDictionary * pDict = (CCDictionary *)pObj;
    CCDictionary::const_iterator itDict = pDict->begin();
    while(itDict != pDict->end())
    {
      RecurseDestroy(itDict->second);
      itDict++;
    }
    pDict->erase(pDict->begin(), pDict->end());
    V_SAFE_DELETE(pDict);
  }
  else if (pObj->isOfClass(CCObject::ClassOfCCArray))
  {
    CCArray * pArray = (CCArray *)pObj;
    int iCount = (int)pArray->size();
    for (int i = 0; i < iCount; i++)
    {
      RecurseDestroy((*pArray)[i]);
    }
    V_SAFE_DELETE(pArray);
  }
  else if (pObj->isOfClass(CCObject::ClassOfCCString))
  {
    CCString * pString = (CCString*)pObj;
    V_SAFE_DELETE(pString);
  }
  else
  {
    V_SAFE_DELETE(pObj);
  }
}
コード例 #3
0
void LHSettings::removeMarkedNodes(){
    
#if COCOS2D_VERSION >= 0x00020000
    
    CCArray* keys = markedNodes.allKeys();
    if(keys){
        for(int i = 0; i < keys->count(); ++i){
            LHNode* node = (LHNode*)markedNodes.objectForKey(((CCString*)keys->objectAtIndex(i))->getCString());
            removeMarkedNode(node);
        }
    }
    markedNodes.removeAllObjects();
    
#else
    
    std::vector<std::string> keys = markedNodes.allKeys();
    for(int i = 0; i < keys.size(); ++i){
        LHNode* node = (LHNode*)markedNodes.objectForKey(keys[i]);
        removeMarkedNode(node);
    }
    markedNodes.removeAllObjects();
#endif
}