void RectWorld::pauseResumePressed() { this->resumeSchedulerAndActions(); CCMenu *pItem = (CCMenu *)this->getChildByTag(6); pItem->setIsVisible(true); ScoreLayer *scoreLayer = (ScoreLayer *)this->getChildByTag(2); scoreLayer->setIsVisible(true); TimeLayer *timeLayer = (TimeLayer*)this->getChildByTag(4); timeLayer->setIsVisible(true); CCMutableArray<CCSprite *> :: CCMutableArrayIterator it; for(it = _barriers->begin(); it != _barriers->end(); it++) { (*it)->resumeSchedulerAndActions(); } for(it = _stars->begin(); it != _stars->end(); it++) { (*it)->resumeSchedulerAndActions(); } }
//-------------------------------------------------------------- // // void COption::onEnter() { CCXMLLayer::onEnter(); LoadPlist("option.plist"); const char *MenuButton[] = { "button_back", "button_delsave", }; for( int i = 0; i < 2; i++ ) { CCSprite *pSprite= (CCSprite*)GetXMLNodeFromKey( MenuButton[i] ); CCMenu *pMenu = CreatGameUIWithSprite( pSprite, menu_selector(COption::menuCallback), i, this, pSprite->getPosition() ); addChild( pMenu, pSprite->getZOrder() ); pMenu->setTag( i ); removeChild( pSprite, true ); } const char *MenuButton2[] = { "button_close1", "button_close2", "button_open1", "button_open2" }; for( int i = 0; i < 4; i++ ) { CCSprite *pSprite= (CCSprite*)GetXMLNodeFromKey( MenuButton2[i] ); CCMenu *pMenu = CreatGameUIWithSprite( pSprite, menu_selector(COption::menuSound), i%2, this, pSprite->getPosition() ); addChild( pMenu, pSprite->getZOrder() ); pMenu->setTag( i ); pMenu->setIsVisible( false ); removeChild( pSprite, true ); m_pControlMenu[i] = pMenu; } //CCUserDefault::sharedUserDefault()->setBoolForKey("music", true ); //CCUserDefault::sharedUserDefault()->setBoolForKey("sound", true ); schedule( schedule_selector( COption::UpData ), 0.1f ); }
void RectWorld::menuPause(CCObject* pSender) { this->pauseSchedulerAndActions(); CCMutableArray<CCSprite*> :: CCMutableArrayIterator it; for(it = _barriers->begin(); it != _barriers->end(); it++) { (*it)->pauseSchedulerAndActions(); } for(it = _stars->begin(); it != _stars->end(); it++) { (*it)->pauseSchedulerAndActions(); } Pause *pause = Pause::node(); pause->setDelegate(this); CCMenu *pItem = (CCMenu *)this->getChildByTag(6); pItem->setIsVisible(false); ScoreLayer *scoreLayer = (ScoreLayer *)this->getChildByTag(2); scoreLayer->setIsVisible(false); ScoreLayer *score = (ScoreLayer*)this->getChildByTag(2); pause->setDistance(score->getCurrentDistance()); pause->setStar(score->getCurrentStar()); TimeLayer *timeLayer = (TimeLayer*)this->getChildByTag(4); timeLayer->setIsVisible(false); this->addChild(pause,5); }