Esempio n. 1
0
void LoadManager::load(SCENE target)
{
	clearCache();

	mNextScene = target;

	if (mAllNum + mArmatureNum <= 0)
	{
		changeScene();
		return;
	}

	CCScene* tempSc = LoadScene::scene();
	mLoadScene = (LoadScene*)(tempSc->getChildren()->objectAtIndex(0));
	CCDirector::sharedDirector()->replaceScene(tempSc);

	if (mLoadArray->count() == 0)
	{
		loadArmature();
		return;
	}

	for (int i = mLoadArray->count() - 1; i >= 0; i--) 
	{
		LoadInfoVo* pObj = (LoadInfoVo*)mLoadArray->objectAtIndex(i);
		
		switch (pObj->mType)
		{
		//case LArmature:
		//	CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfoAsync(pObj->mImagePath.c_str(), 
		//		pObj->mPlistPath.c_str(), 
		//		pObj->mJsonPath.c_str(),
		//		this,
		//		schedule_selector(LoadManager::loadedArmatureCall));
		//	break;
		case LSprite:
			mSpriteLoadArray->addObject(pObj);
			CCTextureCache::sharedTextureCache()->addImageAsync(pObj->mImagePath.c_str(),
				this,
				callfuncO_selector(LoadManager::loadedImageCall));
			break;
		case LImage:
			CCTextureCache::sharedTextureCache()->addImageAsync(pObj->mImagePath.c_str(),
				this,
				callfuncO_selector(LoadManager::loadedImageCall));
			break;
		}
		mLoadArray->removeObject(pObj);
	}
}
Esempio n. 2
0
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {
    CCDirector::sharedDirector()->stopAnimation();
    if(SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying()) {
        SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
    }
    // if you use SimpleAudioEngine, it must be pause
    // CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
#ifdef MULTIPLAY
    UserData * userData = GameController::getGameController()->getUserData();
    if(userData->pvpMode != NONE) {
        CCScene * currentScene = CCDirector::sharedDirector()->getRunningScene();
        MultiPlayScene * multiPlayScene = (MultiPlayScene *)currentScene->getChildren()->objectAtIndex(0);
        multiPlayScene->gameOver();
        CCDirector::sharedDirector()->replaceScene(StartMenuScene::scene());
    }
#endif
}