当前位置: 首页>>代码示例>>C++>>正文


C++ AppDelegate类代码示例

本文整理汇总了C++中AppDelegate的典型用法代码示例。如果您正苦于以下问题:C++ AppDelegate类的具体用法?C++ AppDelegate怎么用?C++ AppDelegate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AppDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateFlow

std::string GameWin::updateFlow()
{
	AppDelegate *app = (AppDelegate*)Application::getInstance();
	std::string strLocal=DataAccess::getParamValue("LocalFlow");
	if (strLocal.length() > 0)
	{
		strLocal = app->base64_xxtea_decode(strLocal);//format:x,x,x,x,x,x,
		string::size_type pos;
		string sSub;
		for (int i = 0; i < 6; i++)
		{
			pos = strLocal.find(",");
			if (pos != string::npos)//found
			{
				sSub = strLocal.substr(0, pos);
				strLocal = strLocal.substr(pos + 1, strLocal.size() - 1);
				m_iLocal[i] = atoi(sSub.c_str());
			}
			else return "\0";//wrong 
		}
		m_iLocal[m_iCurrentGameID - 1] += iReward;
	}
	else  m_iLocal[m_iCurrentGameID - 1] = iReward;
	char cFlow[20] = "\0";
	std::string strFlow = "";
	for (int i = 0; i < 6; i++)
	{
		if (m_iLocal[i]>0)
		{
			sprintf(cFlow, "%d:%d,\0", i + 1, m_iLocal[i]);
			strFlow += cFlow;
		}
	}
	return strFlow;
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:35,代码来源:GameWinScene.cpp

示例2: menuKeyCallback

void MultiPriceMatch::menuKeyCallback(Ref* pSender, ui::Widget::TouchEventType eEventType){

	AppDelegate *app = (AppDelegate*)Application::getInstance();


	switch (eEventType) {
		case ui::Widget::TouchEventType::BEGAN:
			cocos2d::log("touch Began");
			break;
		case ui::Widget::TouchEventType::ENDED:
			cocos2d::log("touch Ended");
			if (app->getBGMstatus() == BGMusic_flag::ON){
				app->PlayEffect(SOUND_BUTTON_CLICK);
			}	
			MultiPriceMatch::gameover(); //quit the game
			break;
		case ui::Widget::TouchEventType::MOVED:
			cocos2d::log("touch Cancel");
			break;
		case ui::Widget::TouchEventType::CANCELED:
			cocos2d::log("touch Cancel");
			break;
		default:
			cocos2d::log("touch Default");
			break;
	}
	return;

}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:29,代码来源:MultiPriceMatch.cpp

示例3: yesCallback

void MultiPriceMatch::yesCallback(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type){
    if (type == cocos2d::ui::Widget::TouchEventType::ENDED){

		AppDelegate *app = (AppDelegate*)Application::getInstance();
		if (app->getBGMstatus() == BGMusic_flag::ON){
			app->PlayEffect(SOUND_BUTTON_CLICK);
		}		

		_vec_circle.clear();
		_vec_circle2.clear();
		this->unschedule(schedule_selector(MultiPriceMatch::updateTimeLabel));
		//this->unschedule(schedule_selector(FindDiffLayer::updateDragMove));

		//AppDelegate *app = (AppDelegate*)Application::getInstance();
//		app->SaveGamePassLevel();
		app->moveToNextGameLevel();

		if (app->iGameMode == MobileGameMode::Theme_Mode)
		{
			auto scene = ThemeLayer::createScene();
			TransitionScene *transition = TransitionFade::create(1, scene);
			Director::getInstance()->replaceScene(transition);
		}
		else
		{
			auto scene = WelcomeScene::create();
			TransitionScene *transition = TransitionFade::create(1, scene);
			Director::getInstance()->replaceScene(transition);
		}

		this->removeChildByTag(9000);
        CCLOG("touch ended.");
    }
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:34,代码来源:MultiPriceMatch.cpp

示例4: yesCallback

void GameLayer::yesCallback(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type)//quit game button
{
	if (type == cocos2d::ui::Widget::TouchEventType::ENDED)
	{

		AppDelegate *app = (AppDelegate*)Application::getInstance();
		app->PlayEffect(SOUND_BUTTON_CLICK);
		app->moveToNextGameLevel();

		this->unschedule(schedule_selector(GameLayer::updateLabels));
		this->unschedule(schedule_selector(GameLayer::updateTimeLabel));


		if (app->iGameMode == MobileGameMode::Theme_Mode)
		{
			auto scene = ThemeLayer::createScene();
			TransitionScene *transition = TransitionFade::create(1, scene);
			Director::getInstance()->replaceScene(transition);
		}
		else
		{
			auto scene = WelcomeScene::create();
			TransitionScene *transition = TransitionFade::create(1, scene);
			Director::getInstance()->replaceScene(transition);
		}

		this->removeChildByTag(9000);
		CCLOG("touch ended.");
	}
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:30,代码来源:GameLayer.cpp

示例5: updateLocalFlow

void GameWin::onSyncCompleted(HttpClient *sender, HttpResponse *response){
	if (!response)
	{
		updateLocalFlow();
		return;
	}

	// You can get original request type from: response->request->reqType
	if (0 != strlen(response->getHttpRequest()->getTag()))
	{
		log("%s completed", response->getHttpRequest()->getTag());
	}
	int statusCode = response->getResponseCode();
	char statusString[64] = {};
	sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
	// _labelStatusCode->setString(statusString);
	log("response code: %d", statusCode);
	if (!response->isSucceed())
	{
		log("response failed");
		log("error buffer: %s", response->getErrorBuffer());
		updateLocalFlow();
		return;
	}
	if (statusCode != 200){
		log("response code failed");
		log("error buffer: %s", response->getErrorBuffer());
		updateLocalFlow();
		return;
	}
	clearLocalFlow();

	// dump data
	AppDelegate *app = (AppDelegate*)Application::getInstance();
	std::vector<char> *buffer = response->getResponseData();
	string sXml(buffer->begin(), buffer->end());
	pugi::xml_document doc;
	pugi::char_t cXml[1024];
	strcpy(cXml, sXml.c_str());
	pugi::xml_parse_result result = doc.load_string(cXml);

	pugi::xml_node nodes = doc.child("mobileAppSyncPoint");

	std::string strResult = nodes.child_value("result");
	char p[100];
	strcpy(p, strResult.c_str());
	int iScore = atoi(p);
	if (iScore==0)
	{
		//get TotalPoints
		 strResult = nodes.child_value("TotalPoints");
		 app->SaveUserScoreDiff(atoi(strResult.c_str()));
		//get TotalTools
		strResult = nodes.child_value("TotalTools");
		app->SaveUserToolsDiff(atoi(strResult.c_str()));
	}

}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:58,代码来源:GameWinScene.cpp

示例6: noCallback

void GameLayer::noCallback(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type)
{
	if (type == cocos2d::ui::Widget::TouchEventType::ENDED)
	{
		AppDelegate *app = (AppDelegate*)Application::getInstance();
		app->PlayEffect(SOUND_BUTTON_CLICK);
		this->removeChildByTag(9000);
	}
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:9,代码来源:GameLayer.cpp

示例7: CallbackRegisterNo

void GameWin::CallbackRegisterNo(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type){
	if (type == cocos2d::ui::Widget::TouchEventType::ENDED)         {
	AppDelegate *app = (AppDelegate*)Application::getInstance();
	if (app->getBGMstatus() == BGMusic_flag::ON){
		app->PlayEffect(SOUND_BUTTON_CLICK);
	}

	switch (m_iCurrentGameID){
			case 1:{
				auto scene = FindDiffScene::create();
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}
				   break;

			case 2:{
				auto scene = ZoomGameScene::create();
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}
				   break;
			case 3:{


				auto scene = jigSawScene::create();

				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}
				   break;
			case 4:{
				auto scene = GameScene::create();


				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}
				   break;

			case 5:{
				auto scene = PriceMatchScene::create();


				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}
				   break;
			case 6:
			{
				auto scene = MultiPriceMatchScene::create();
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}
		}			
		this->removeChildByTag(9000);
	}
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:57,代码来源:GameWinScene.cpp

示例8: btnQuitCallBack

void EventBoard::btnQuitCallBack(Ref* pSender, ui::Widget::TouchEventType eEventType){
	if (eEventType == cocos2d::ui::Widget::TouchEventType::ENDED){
		AppDelegate *app = (AppDelegate*)Application::getInstance();
		app->PlayEffect(SOUND_BUTTON_CLICK);
		this->cleanup();
		Director::getInstance()->popScene();
	}
	return;
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:9,代码来源:EventBoard.cpp

示例9: updateServerAddressLabel

void MainWindow::updateServerAddressLabel() {
    AppDelegate* app = AppDelegate::getInstance();

    _serverAddressLabel->setText("<html><head/><body style=\"font:14pt 'Helvetica', 'Arial', 'sans-serif';"
                                 "font-weight: bold;\"><p><span style=\"color:#545454;\">Accessible at: </span>"
                                 "<a href=\"" + app->getServerAddress() + "\">"
                                 "<span style=\"color:#29957e;\">" + app->getServerAddress() +
                                 "</span></a></p></body></html>");
    _serverAddressLabel->adjustSize();
}
开发者ID:binaryking,项目名称:StackManagerQt,代码行数:10,代码来源:MainWindow.cpp

示例10: CallbackRegisterYes

void GameWin::CallbackRegisterYes(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type){
	if (type == cocos2d::ui::Widget::TouchEventType::ENDED){
		AppDelegate *app = (AppDelegate*)Application::getInstance();
		if (app->getBGMstatus() == BGMusic_flag::ON){
			app->PlayEffect(SOUND_BUTTON_CLICK);
		}

		GameWin::showRegister();
	}
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:10,代码来源:GameWinScene.cpp

示例11: GameFailed

void GameLayer::GameFailed(){
	AppDelegate *app = (AppDelegate*)Application::getInstance();
	app->moveToNextGameLevel();

	this->unschedule(schedule_selector(GameLayer::updateLabels));
	this->unschedule(schedule_selector(GameLayer::updateTimeLabel));

	auto scene = GameFailed::createScene();
	TransitionScene *transition = TransitionFade::create(1, scene);
	Director::getInstance()->replaceScene(transition);
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:11,代码来源:GameLayer.cpp

示例12: PlayAnimation

void MultiPriceMatch::PlayAnimation(float dt)
{
	Armature *armature = dynamic_cast<Armature *>(_SORT_UINode->getChildByTag(888));
	armature->getAnimation()->playWithIndex(0, -1, 0);//from the first frame, no loop
	armature->getAnimation()->setSpeedScale(0.8);
	AppDelegate* app = (AppDelegate*)Application::getInstance();
	if (app->getBGMstatus() == BGMusic_flag::ON)
	{
		app->PlayEffect(SOUND_ANIMATION);
	}
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:11,代码来源:MultiPriceMatch.cpp

示例13: _tWinMain

int APIENTRY _tWinMain(HINSTANCE hInstance,
					   HINSTANCE hPrevInstance,
					   LPTSTR    lpCmdLine,
					   int       nCmdShow){
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	g_hInstance = hInstance;

	int nRet = 0;
	AppDelegate app;
	nRet = app.Run();

	return nRet;
}
开发者ID:geniikw,项目名称:myFirst2DGame,代码行数:15,代码来源:main.cpp

示例14: btnPriceCallback

void MultiPriceMatch::btnPriceCallback(Ref* pSender, ui::Widget::TouchEventType eEventType){
	/*if (eEventType != ui::Widget::TouchEventType::BEGAN)*/

	CCNode* node = (CCNode*) pSender;
	int tag = node->getTag();
	bool bSel = false;

	for (int i = 0; i < 3;i++){
		if (tag == (BTN_PRICE_1 + i)) bSel = true;
	}

	if (bSel == false) return;

	cocos2d::log("button's tag is %d",tag);
	auto button = (Button*) _SORT_UINode->getChildByTag(tag);
	AppDelegate *app = (AppDelegate*)Application::getInstance();


	switch (eEventType) {
		case ui::Widget::TouchEventType::BEGAN:
			cocos2d::log("btnPriceCallback Began");
			button->getTouchBeganPosition();
			button->setZOrder(99);
			break;
		case ui::Widget::TouchEventType::ENDED:
			cocos2d::log("btnPriceCallback Ended");
			if (app->getBGMstatus() == BGMusic_flag::ON){
				app->PlayEffect(SOUND_BUTTON_CLICK);

			}	
			button->setZOrder(1);
			MovetoPriceLabel(button);
			break;
		case ui::Widget::TouchEventType::MOVED:
			button->setPosition(button->getTouchMovePosition());
			cocos2d::log("btnPriceCallback Moving");
			break;
		case ui::Widget::TouchEventType::CANCELED:
			cocos2d::log("touch Cancel");
			button->setZOrder(1);
			break;
		default:
			cocos2d::log("touch Default");
			break;
	}
	return;

}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:48,代码来源:MultiPriceMatch.cpp

示例15: noCallback

void MultiPriceMatch::noCallback(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type){
    if (type == cocos2d::ui::Widget::TouchEventType::ENDED){
			
		AppDelegate *app = (AppDelegate*)Application::getInstance();
		if (app->getBGMstatus() == BGMusic_flag::ON){
			app->PlayEffect(SOUND_BUTTON_CLICK);
		}		
		
		//Don't quit the game
		this->removeChildByTag(9000);
		//enable the touch event
		//CallFunc *runCallback = CallFunc::create(CC_CALLBACK_0(FindDiffLayer::resetTouchEvent, this));
		//this->runAction(Sequence::create(DelayTime::create(1.0f), runCallback, nullptr));
        CCLOG("touch ended.");
    }
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:16,代码来源:MultiPriceMatch.cpp


注:本文中的AppDelegate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。