void HelloWorld::menuCloseCallback(CCObject* pSender) { //#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) // CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert"); //#else // CCDirector::sharedDirector()->end(); //#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) // exit(0); //#endif //#endif int t = g_layoutcnt%2; if( t == 0) { m_pLayout = dynamic_cast<UILayout *>(GUIReader::shareReader()->widgetFromJsonFile("level_select_1.json")); if(m_pLayout) { m_pLayout->setPosition(ccp(-200,0)); this->addChild(m_pLayout); ActionObject* act = NULL; act = ActionManager::shareManager()->getActionByName("level_select_1.json","texiao"); if(NULL != act) act->play(); act = ActionManager::shareManager()->getActionByName("level_select_1.json","shuibodonghua"); if(NULL != act) act->play(); } } else { //ActionManager::shareManager()->stopAllActionByJson("level_select_1.json"); //ActionManager::shareManager()->stopAllActionByJson("level_select.json"); ActionObject* act = NULL; act = ActionManager::shareManager()->getActionByName("level_select_1.json","texiao"); if(NULL != act) act->stop(); act = ActionManager::shareManager()->getActionByName("level_select_1.json","shuibodonghua"); if(NULL != act) act->stop(); ActionManager::shareManager()->releaseActions(); if(m_pLayout) { m_pLayout->removeFromParent(); m_pLayout = NULL; } //CCTextureCache::sharedTextureCache()->removeUnusedTextures(); } g_layoutcnt++; }
ActionObject* ActionManagerEx::stopActionByName(const char* jsonName,const char* actionName) { ActionObject* action = getActionByName(jsonName,actionName); if (action) { action->stop(); } return action; }
void ActionManagerEx::releaseActions() { for (auto& iter : _actionDic) { cocos2d::Vector<ActionObject*> objList = iter.second; ssize_t listCount = objList.size(); for (ssize_t i = 0; i < listCount; i++) { ActionObject* action = objList.at(i); if (action != nullptr) { action->stop(); } } objList.clear(); } _actionDic.clear(); }
void ActionManagerEx::releaseActions() { std::unordered_map<std::string, cocos2d::Vector<ActionObject*>>::iterator iter; for (iter = _actionDic.begin(); iter != _actionDic.end(); iter++) { cocos2d::Vector<ActionObject*> objList = iter->second; ssize_t listCount = objList.size(); for (ssize_t i = 0; i < listCount; i++) { ActionObject* action = objList.at(i); if (action != nullptr) { action->stop(); } } objList.clear(); } _actionDic.clear(); }