當前位置: 首頁>>代碼示例>>C++>>正文


C++ ObjectManager::getSelf方法代碼示例

本文整理匯總了C++中ObjectManager::getSelf方法的典型用法代碼示例。如果您正苦於以下問題:C++ ObjectManager::getSelf方法的具體用法?C++ ObjectManager::getSelf怎麽用?C++ ObjectManager::getSelf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ObjectManager的用法示例。


在下文中一共展示了ObjectManager::getSelf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: if

 X_VOID		MainGame::EndBattle(bool win)
 {
	 
	 //------------打開戰鬥前的界麵
	 m_nGameRunState = RUNING_IN_GAME;
	 SceneManger::GetSingleton()->EnterScene(SceneManger::EM_SS_MAIN);

	if(DataPool::GetSingleton()->BattlyType == EM_COPY_SCENE)
		EventSystem::GetSingleton()->PushEvent(GAME_EVENT_LEVELLIST_SHOW);
	else if(DataPool::GetSingleton()->BattlyType == EM_SPORT)
		EventSystem::GetSingleton()->PushEvent(GAME_EVENT_RANKLIST_SHOW);
	else if(DataPool::GetSingleton()->BattlyType == EM_WOODPVP)
	{
		EventSystem::GetSingleton()->PushEvent(GAME_EVENT_BASE_ACTIVITY_SHOW);
	}
	else if(DataPool::GetSingleton()->BattlyType == EM_BATTLETYPE_QUJING)
	{
		vector<string> str;str.clear();
		str.push_back(UtilTools::IntToString(EM_HUSONG_WOOD));//
		EventSystem::GetSingleton()->PushEvent(GAME_EVENT_CHEESE_SHOW,str);
		SendLogicPacket::OpenQuJingUi();
		EventSystem::GetSingleton()->PushEvent(GAME_EVNET_LVL_ESCORTWOOD_SHOW);
	}
	else if(DataPool::GetSingleton()->BattlyType == EM_BATTLETYPE_BLOODBATTLE)
	{
		BloodData* pBloodData = DataPool::GetSingleton()->GetBloodData();
		if (win)
		{
				pBloodData->NextStep();
		}else
		{
				pBloodData->EnterBloodUi();
		}
	}
	else 
		EventSystem::GetSingleton()->PushEvent(GAME_EVENT_CHEESE_SHOW);


	ObjectManager* pManager = DataPool::GetSingleton()->getObjectManager();
	PlayerData* pData = pManager->getSelf()->playerData();
	if (pData && pData->IsLevelUp())
	{
		pData->resetLevelUp();
		EventSystem::GetSingleton()->PushEvent(GAME_EVNET_LVL_UPGRADE_SHOW);
	}
	

	 BattleData * pBattle = DataPool::GetSingleton()->GetBattleData();
	 pBattle->DestroyBattleData();
	 


 }
開發者ID:LSilent,項目名稱:moe_hero,代碼行數:53,代碼來源:MainGame.cpp

示例2: onButtonPur

void userInfoUIView::onButtonPur(cocos2d::CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent)
{
	SoundSystem::GetSingleton()->playClickEffect(GAME_CLICK_COMMON);

	char buffer[512] = {0};
	X_INT buyNum = -1;
	X_INT level = -1;
	X_INT money =-1;
	if (DataPool::GetSingleton())
	{
		ObjectManager* pM = DataPool::GetSingleton()->getObjectManager();
		if (!pM)return;
		ObjectSelf* pSelf = pM->getSelf();
		if (!pSelf)return;

		PlayerData*  pData =  pSelf->playerData();
		if (!pData)return;
		buyNum = pData->GetBuyAcNum();
		level = pData->GetLevel();
		money = pData->GetGold();
	}
	if (buyNum >=ActionPointBuyNum)
	{
		string tip = UtilTools::GET_TEXT_FROM_LANG( 587);
		if (tip != "")
		{
			vector<string> strV;strV.clear();
			strV.push_back(tip);
			EventSystem::GetSingleton()->PushEvent(GAME_EVENT_TIP_UPDATA,strV);
		}
		return;
	}
	const  DataBase* pDataFile  = DataBaseSystem::GetSingleton()->GetDataBase(DBC_FILE_BUYACTIONPOINT);
	if (!pDataFile)return;
	const stDBC_FILE_BUYACTIONPOINT	* m_pTableData =(const stDBC_FILE_BUYACTIONPOINT*)pDataFile->GetFieldsByIndexKey(buyNum+1);
	if (!m_pTableData)return;

	if (level<m_pTableData->level)
	{
		string tip = UtilTools::GET_TEXT_FROM_LANG( 588);
		if (tip != "")
		{
			vector<string> strV;strV.clear();
			strV.push_back(tip);
			EventSystem::GetSingleton()->PushEvent(GAME_EVENT_TIP_UPDATA,strV);
		}
		return;
	}
	if (money < m_pTableData->cost)
	{
		string tip = UtilTools::GET_TEXT_FROM_LANG(102);
		if (tip != "")
		{
			vector<string> strV;strV.clear();
			strV.push_back(tip);
			EventSystem::GetSingleton()->PushEvent(GAME_EVENT_TIP_UPDATA,strV);
		}
		return;
	}
	 
	sprintf(buffer,UtilTools::GET_TEXT_FROM_LANG(543),m_pTableData->cost,m_pTableData->addAction);
	ModalDialogView *dialogPur = ModalDialogView::createDialog( buffer,this);
	dialogPur->setTag(1000);
	addChild(dialogPur,10);
}
開發者ID:LSilent,項目名稱:moe_hero,代碼行數:65,代碼來源:userInfoUIView.cpp


注:本文中的ObjectManager::getSelf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。