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


C++ AppDelegate::PlayEffect方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: ShowTutorialCallback

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

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

		auto scene = TutorialScene::create();
		if(scene != nullptr){
			TransitionScene *transition = TransitionFade::create(1, scene);
			Director::getInstance()->pushScene(transition);
		}

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

示例12: PlayAnimation

void GameLayer::PlayAnimation(float dt)
{
	Armature *armature = dynamic_cast<Armature *>(_rootNode->getChildByTag(888));
	if (nAniFlag == 1)
	{
		armature->setPosition(Vec2(200, 400));
		armature->setRotation(270);
		nAniFlag = 2;
	}
	else
	{
		armature->setPosition(Vec2(800, 200));
		armature->setRotation(180);
		nAniFlag = 1;
	}
	armature->getAnimation()->playWithIndex(0, -1, 0);//from the first frame, no loop
	AppDelegate* app = (AppDelegate*)Application::getInstance();
	if (app->getBGMstatus() == BGMusic_flag::ON)
	{
		app->PlayEffect(SOUND_ANIMATION);
	}
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:22,代码来源:GameLayer.cpp

示例13: showHint

bool MultiPriceMatch::showHint(){

	bool bRet = false;
	bool allset = true;
	Vec2 vecbtn;
	
	do{
		if(_bTlEnabled == false) break;
		_bTlEnabled = false;

		AppDelegate *app = (AppDelegate*)Application::getInstance();
		//long score = app->GetUserTotalScore();
		int score = 0;

		if (_nTlimit > 0){
			if(_nTlcount > 0){
				_nTlcount--;
				//AppDelegate *app =  (AppDelegate*) Application::getInstance();
				app->setToolsNumberInfo(_nTlcount);
			}else{
				if(_lTtlScore >= 10){
					showDeductPointEffect(LINK_UI_TEXT_SCORE);
					score = 10;
					_lTtlScore = _lTtlScore - 10;
					AppDelegate *app =  (AppDelegate*) Application::getInstance();
					app->UpdateUserScore(0,10);
				}else{
					break;
				}
			}
			
			app->PlayEffect(SOUND_TOOL_CLICK);
			_nTlimit--;
			if (_nTlimit == 0){
				auto spTips = dynamic_cast<Button*>(_SORT_UINode->getChildByName(LINK_UI_BTN_TIPS));
				CC_BREAK_IF(!spTips);
				spTips->setEnabled(false);
				spTips->setColor(ccc3(84,84,84));//not disabled button, so use color instead
			}

		}else {
			break;
		}

		//if (score < 10) {
		//	MessageBox("Oops, Your score should be greater than 10 to use powerup","Spot it");
		//	break;
		//}
		//_vec_currentPos.clear();

		//for (int i = 0; i < 3; i++){
		//	_vec_currentPos.push_back(_vec_btnPrice[i]->getPosition());
		//}

		//btnClear();
		//int i,j = 0;
		//_vec_Price_index
		for (int i = 0; i < 3; i++){ 	
			for (int j = 0; j < 3; j++){
				vecbtn = _vec_btnPrice[_vec_Price_index[i]]->getPosition();//get correct button position
				if (_vec_lblPrice[i]->getName().compare(LBL_TAKEN) == 0){
					if (_vec_lblPrice[i]->getPosition() == _vec_btnPrice[j]->getPosition()){
						if (_vec_btnPrice[j]->getTitleText().compare(_product_list[i].price.c_str()) == 0){ //price is correct 
							j = 3;
							break;
						}else{//price is wrong
//							vecbtn = _vec_btnPrice[_vec_Price_index[i]]->getPosition();//get correct button position
							_vec_btnPrice[_vec_Price_index[i]]->setPosition(_vec_lblPrice[i]->getPosition()); // move correct button to the position
							_vec_btnPrice[_vec_Price_index[i]]->setBright(false);
							_vec_btnPrice[_vec_Price_index[i]]->setTouchEnabled(false);

							_vec_btnPrice[j]->setPosition(_vec_originalPos[j]); //set wrong button back to original place
							_vec_btnPrice[j]->setTouchEnabled(true);
							_vec_btnPrice[j]->setBright(true);

							_vec_lblPrice[i]->setName(LBL_TAKEN); //set new position is taken
							j = 3;
							i = 3;
							break;
						}
					}
				}else{
					_vec_btnPrice[_vec_Price_index[i]]->setPosition(_vec_lblPrice[i]->getPosition()) ;
					_vec_btnPrice[_vec_Price_index[i]]->setBright(false);
					_vec_btnPrice[_vec_Price_index[i]]->setTouchEnabled(false);
					//_vec_btnPrice[j]->setPosition(_vec_lblPrice[i]->getPosition()) ;
					_vec_lblPrice[i]->setName(LBL_TAKEN);
					j = 3;
					i = 3;
					break;
				}
			}
		}
		for (int i = 0; i < 3; i++){
			if (_vec_lblPrice[i]->getPosition() == vecbtn){
				_vec_lblPrice[i]->setName("");
			}
		}


//.........这里部分代码省略.........
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:101,代码来源:MultiPriceMatch.cpp

示例14: touchButton

void GameLayer::touchButton(Object* obj, ::ui::Widget::TouchEventType eventType)
{
	auto button = dynamic_cast<::ui::Button*>(obj);
	int tag = button->getTag();
	if (eventType == ::ui::Widget::TouchEventType::ENDED)
	{
		AppDelegate *app = (AppDelegate*)Application::getInstance();
		app->PlayEffect(SOUND_BUTTON_CLICK);
		if (tag == 2001)
		{ //Tutorial
			auto scene = TutorialScene::create();
			if (scene != nullptr){
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->pushScene(transition);
			}
		}
		if (tag == 2002)
		{ //Home

			MsgBoxType m_type = TP_Q_YESNO;
			std::string title = MSG_QUIT_TITLE;
			std::string msg = MSG_QUIT_MSG;

			MsgBox::setMsgBox(m_type, &title, &msg);
			auto msgbox = MsgBox::create();
			msgbox->setTag(9000);
			this->addChild(msgbox, 999);

			//Add Event to process
			auto btnYes = dynamic_cast<Button*>(msgbox->getChildByTag(MSGBOX_UINODE)->getChildByName("btn_Yes"));// Magnifier Button
			auto btnNo = dynamic_cast<Button*>(msgbox->getChildByTag(MSGBOX_UINODE)->getChildByName("btn_No"));// Magnifier Button
			btnYes->addTouchEventListener(CC_CALLBACK_2(GameLayer::yesCallback, this));
			btnNo->addTouchEventListener(CC_CALLBACK_2(GameLayer::noCallback, this));

		}
		if (tag == 2003)
		{  //AI tips
			if (_bTlEnabled == false) return;
			_bTlEnabled = false;



			if (_nTlimit > 0)
			{
				if (_nTlcount > 0)
				{
					_nTlcount--;
					//AppDelegate *app = (AppDelegate*)Application::getInstance();
					app->setToolsNumberInfo(_nTlcount);
				}
				else
				{
					if (_lTtlScore >= 10)
					{
						showDeductPointEffect("txtScore");
						_lTtlScore = _lTtlScore - 10;
						//AppDelegate *app = (AppDelegate*)Application::getInstance();
						app->UpdateUserScore(0, 10);
					}
					else return;
				}
				_nTlimit--;
				if (_nTlimit == 0)
				{
					auto spTips = dynamic_cast<::ui::Button*>(_rootNode->getChildByName("btnTipsTools"));
					spTips->setColor(ccc3(84, 84, 84));//not disabled button, so use color instead
				}
				if (app->getBGMstatus() == BGMusic_flag::ON){
					app->PlayEffect(SOUND_TOOL_CLICK);
				}
				UseTips();
				this->scheduleOnce(schedule_selector(GameLayer::enableTools), 2.0f);
			}
			else return;
		}
	}
}
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:77,代码来源:GameLayer.cpp

示例15: touchButton

void GameWin::touchButton(Object* obj,::ui::Widget::TouchEventType eventType)  
{  
    auto button = dynamic_cast<::ui::Button*>(obj);  
    int tag = button->getTag();  
    
	
	auto node =(Node*) this->getChildByTag(CHILD_TURNTABLE);
	if (node != nullptr) {
		return;
	}

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

	switch(eventType)  
    {  
	case ::ui::Widget::TouchEventType::ENDED:  

	if (app->getBGMstatus() == BGMusic_flag::ON){
		app->PlayEffect(SOUND_BUTTON_CLICK);

	}
		if(tag==1001){ //Continue

			if(app->GetNetWorkStatus() != NetworkType::NetworkTypeNone){
				std::string sGuid = app->GetUserGuid();
				log("GUID is %s", sGuid.c_str());
				if (sGuid.length() == 0){ // not a registered user
					if (m_iShowRegister == 5){
						MsgBoxType m_type = TP_Q_YESNO;;
						std::string title="Tweebaa";
						std::string msg = MSG_REGISTER_MSG;
						std::string info = "\0";
				
						MsgBox::setMsgBox(m_type, &title, &msg, &info);
						auto msgbox = MsgBox::create();
						auto btnYES = dynamic_cast<Button*>(msgbox->getChildByTag(MSGBOX_UINODE)->getChildByName("btn_Yes"));// Magnifier Button
						btnYES->setTitleFontSize(36);
						btnYES->setTitleText("YES");
						btnYES->addTouchEventListener(CC_CALLBACK_2(GameWin::CallbackRegisterYes, this));
						auto btnNO = dynamic_cast<Button*>(msgbox->getChildByTag(MSGBOX_UINODE)->getChildByName("btn_No"));// Magnifier Button
						btnNO->setTitleText("NOT NOW");
						btnNO->setTitleFontSize(36);
						btnNO->addTouchEventListener(CC_CALLBACK_2(GameWin::CallbackRegisterNo, this));
						msgbox->setTag(MSGBOX_TAG);
						this->addChild(msgbox, 999);
						//m_iShowRegister = 0;
						break;
					}else{
						//m_iShowRegister++;
					}
				}
			}

			if(m_iCurrentGameID == 1){
				auto scene = FindDiffScene::create();
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}else if(m_iCurrentGameID == 2){
				auto scene = ZoomGameScene::create();
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}else if (m_iCurrentGameID == 3){
				auto scene = jigSawScene::create();
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}else if (m_iCurrentGameID == 4){
				auto scene = GameScene::create();
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}else if (m_iCurrentGameID == 5){
				auto scene = PriceMatchScene::create();
				TransitionScene *transition = TransitionFade::create(1, scene);
				Director::getInstance()->replaceScene(transition);
			}else if (m_iCurrentGameID == 6){
				auto scene = MultiPriceMatchScene::create();
				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);			
			}


			//if(m_iCurrentGameID == 3){
			//	auto scene = jigSawScene::create();
			//	//auto scene = LevelSelectLayer::createScene();
			//	TransitionScene *transition = TransitionFade::create(1, scene);
			//	Director::getInstance()->replaceScene(transition);
			//}
			//if(m_iCurrentGameID == 4){
			//	auto scene = GameScene::create();
			//	//auto scene = LevelSelectLayer::createScene();
			//	TransitionScene *transition = TransitionFade::create(1, scene);
			//	Director::getInstance()->replaceScene(transition);
			//}
			//if(m_iCurrentGameID == 5){
			//	auto scene = PriceMatchScene::create();
			//	//auto scene = LevelSelectLayer::createScene();
			//	TransitionScene *transition = TransitionFade::create(1, scene);
//.........这里部分代码省略.........
开发者ID:zhuanglm,项目名称:TweeBaaMobileApp,代码行数:101,代码来源:GameWinScene.cpp


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