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


C++ CClientInfoMgr::GetPlayerName方法代码示例

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


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

示例1: HandleVoteStart

void ClientVoteMgr::HandleVoteStart(ILTMessage_Read* pMsg)
{
	m_CurrentVote.m_nVoteID = pMsg->Readuint8();
	VoteType eVoteType = (VoteType)pMsg->ReadBits( FNumBitsExclusive<kNumVoteTypes>::k_nValue );
	m_CurrentVote.m_eVoteType = eVoteType;
	m_CurrentVote.m_nCallerID = pMsg->Readuint32();
	m_CurrentVote.m_nTargetID = pMsg->Readuint32();
	m_CurrentVote.m_nVotesNeeded = pMsg->Readuint8();
	m_VoteTimer.Start(pMsg->Readdouble());

	m_CurrentVote.m_nYesVotes = 1; //count the person who called the vote

	uint32 nLocalID = 0;
	g_pLTClient->GetLocalClientID (&nLocalID);

	//if I'm the one who called the vote, I've already voted yes
	m_bHasVoted = (nLocalID == m_CurrentVote.m_nCallerID);

	wchar_t wszMsg[256] = L"";
	wchar_t wszTxt[256] = L"";
	CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
	if (!pCIMgr)
	{
		LTERROR("ClientInfoMgr not available");
		return;
	}

	switch(eVoteType)
	{
	case eVote_Kick:
		m_sTargetName = pCIMgr->GetPlayerName(m_CurrentVote.m_nTargetID);

		FormatString("Vote_StartKick",wszMsg,LTARRAYSIZE(wszMsg),pCIMgr->GetPlayerName(m_CurrentVote.m_nCallerID),pCIMgr->GetPlayerName(m_CurrentVote.m_nTargetID));
		FormatString("Vote_Kick",wszTxt,LTARRAYSIZE(wszTxt),pCIMgr->GetPlayerName(m_CurrentVote.m_nTargetID));

		break;
	case eVote_TeamKick:
		m_sTargetName = pCIMgr->GetPlayerName(m_CurrentVote.m_nTargetID);

		FormatString("Vote_StartTeamKick",wszMsg,LTARRAYSIZE(wszMsg),pCIMgr->GetPlayerName(m_CurrentVote.m_nCallerID),pCIMgr->GetPlayerName(m_CurrentVote.m_nTargetID));
		FormatString("Vote_TeamKick",wszTxt,LTARRAYSIZE(wszTxt),pCIMgr->GetPlayerName(m_CurrentVote.m_nTargetID));

		break;
	case eVote_Ban:
		m_sTargetName = pCIMgr->GetPlayerName(m_CurrentVote.m_nTargetID);

		FormatString("Vote_StartBan",wszMsg,LTARRAYSIZE(wszMsg),pCIMgr->GetPlayerName(m_CurrentVote.m_nCallerID),pCIMgr->GetPlayerName(m_CurrentVote.m_nTargetID));
		FormatString("Vote_Ban",wszTxt,LTARRAYSIZE(wszTxt),m_sTargetName.c_str());

		break;
	case eVote_NextRound:
		m_sTargetName = L"";

		FormatString("Vote_StartNextRound",wszMsg,LTARRAYSIZE(wszMsg),pCIMgr->GetPlayerName(m_CurrentVote.m_nCallerID));
		FormatString("Vote_NextRound",wszTxt,LTARRAYSIZE(wszTxt));

		break;
	case eVote_NextMap:
		m_sTargetName = L"";

		FormatString("Vote_StartNextMap",wszMsg,LTARRAYSIZE(wszMsg),pCIMgr->GetPlayerName(m_CurrentVote.m_nCallerID));
		FormatString("Vote_NextMap",wszTxt,LTARRAYSIZE(wszTxt));

		break;
	case eVote_SelectMap:
		m_sTargetName = g_pMissionMgr->GetMapList()[m_CurrentVote.m_nTargetID].c_str();

		FormatString("Vote_StartSelectMap",wszMsg,LTARRAYSIZE(wszMsg),pCIMgr->GetPlayerName(m_CurrentVote.m_nCallerID),m_sTargetName.c_str());
		FormatString("Vote_SelectMap",wszTxt,LTARRAYSIZE(wszTxt),m_sTargetName.c_str());

		break;
	}

	g_pGameMsgs->AddMessage(wszMsg);
	g_pTransmission->Show(wszMsg);
	m_sVoteString = wszTxt;

	g_pHUDMgr->QueueUpdate(kHUDVote);

}
开发者ID:Arc0re,项目名称:lithtech,代码行数:80,代码来源:ClientVoteMgr.cpp

示例2: CheckPlayersWithinTrigger


//.........这里部分代码省略.........
					bWithinHeight = true;

				if( bWithinHeight && BoxesIntersect( vTrigMin, vTrigMax, vPlayerMin, vPlayerMax ) && !pChar->IsPlayerDead())
				{
					if( dwLocalId == pChar->m_cs.nClientID )
						bLocalPlayerIn = true;

					// If it wasn't in the list add it...

					if( iter == m_lstCurPlayersInTrigger.end() )
					{
						m_lstCurPlayersInTrigger.push_back( pChar );
						m_lstNewPlayersInTrigger.push_back( pChar );
					}

				}
				else
				{
					if( iter != m_lstCurPlayersInTrigger.end() )
						m_lstCurPlayersInTrigger.erase( iter );

					m_lstPlayersNotInTrigger.push_back( pChar );
				}
			}
		}
	}

	wchar_t wszBuffer[256];

	if( (m_lstNewPlayersInTrigger.size() > 0) && (nNumPlayersFound > 1) )
	{
		CClientInfoMgr *pInfoMgr = g_pInterfaceMgr->GetClientInfoMgr();
		if( !pInfoMgr )
			return;

		if( bLocalPlayerIn )
		{
			// Display a general transmission and messages for each player you are waiting for...

			int nPlayersNotInTrig = m_lstPlayersNotInTrigger.size();

			if( m_cs.nPlayerInsideID != (uint32)-1 )
			{
				g_pTransmission->Show( StringIDFromIndex(m_cs.nPlayerInsideID) );
			}
			else if( nPlayersNotInTrig > 1 )
			{
				//sTransmission.Format( "You are waiting for %i players.", nPlayersNotInTrig );
				FormatString( "IDS_EXIT_PLAYER_WAITING", wszBuffer, LTARRAYSIZE(wszBuffer), nPlayersNotInTrig );
				g_pTransmission->Show( wszBuffer );
			}
			else
			{
				//sTransmission.Format( "You are waiting for 1 player." );
				FormatString( "IDS_EXIT_PLAYER_WAITING_1", wszBuffer, LTARRAYSIZE(wszBuffer) );
				g_pTransmission->Show( wszBuffer );
			}		
			
			
			CharFXList::iterator iter;
			for( iter = m_lstPlayersNotInTrigger.begin(); iter != m_lstPlayersNotInTrigger.end(); ++iter )
			{
				//sMessage.Format( "You are waiting for %s.", pInfoMgr->GetPlayerName( (*iter)->m_cs.nClientID ));
				FormatString( "IDS_EXIT_PLAYER_WAITING_NAME", wszBuffer, LTARRAYSIZE(wszBuffer), pInfoMgr->GetPlayerName( (*iter)->m_cs.nClientID) );
				g_pGameMsgs->AddMessage( wszBuffer );
			}
		}
		else
		{
			// Display a general transmission and messages for each player waiting for you...

			int nPlayersInTrig = m_lstCurPlayersInTrigger.size();
			
			if( m_cs.nPlayerOutsideID != (uint32)-1 )
			{
				g_pTransmission->Show( LoadString(m_cs.nPlayerOutsideID) );
			}
			else if( nPlayersInTrig > 1 )
			{
//				sTransmission.Format( "%i players are waiting for you",nPlayersInTrig  );
				FormatString( "IDS_EXIT_WAITING", wszBuffer, LTARRAYSIZE(wszBuffer), nPlayersInTrig );
				g_pTransmission->Show( wszBuffer );
			}
			else
			{
//				sTransmission.Format( "1 player is waiting for you." );
				FormatString( "IDS_EXIT_WAITING_1", wszBuffer, LTARRAYSIZE(wszBuffer) );
				g_pTransmission->Show( wszBuffer );
			}
			

			CharFXList::iterator iter;
			for( iter = m_lstCurPlayersInTrigger.begin(); iter != m_lstCurPlayersInTrigger.end(); ++iter )
			{
				FormatString( "IDS_EXIT_WAITING_NAME", wszBuffer, LTARRAYSIZE(wszBuffer), pInfoMgr->GetPlayerName( (*iter)->m_cs.nClientID) );
				g_pGameMsgs->AddMessage( wszBuffer );	
			}
		}
	}
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:101,代码来源:TriggerFX.cpp


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