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


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

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


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

示例1: AddFragFn

void AddFragFn(int argc, char **argv)
{
	uint32 nID = 0;
	int nFragCount =0;
	if (argc > 0)
	{
		nID =  (uint32)atoi(argv[0]);
		if (argc > 1)
		{
			nFragCount = atoi(argv[1]);
		}
	}

	CClientInfoMgr *pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
	if (pCIMgr)
	{
		CLIENT_INFO *ptr = pCIMgr->GetFirstClient();
		while (ptr)
		{
			if (ptr->nID == nID)
			{
				pCIMgr->AddFrag(nID);
				break;
			}
			ptr = ptr->pNext;
		}
	}

}
开发者ID:germanocaldeira,项目名称:no-one-lives-forever,代码行数:29,代码来源:ClientInfoMgr.cpp

示例2: BootPlayer

void CCheatMgr::BootPlayer(CParsedMsgW const& cMsg)
{
	if (!IsMultiplayerGameClient()) return;

	CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
	if (!pCIMgr) return;

	if( cMsg.GetArgCount() < 2 )
		return;

	// The full name of the player might be split between several 
	// arguments of the message so build the name from all arguments
	// except the name of the actual cheat (Arg 1).
	
	wchar_t szPlayerName[MAX_PLAYER_NAME] = {0};
	cMsg.ReCreateMsg( szPlayerName, LTARRAYSIZE( szPlayerName ), 1 );

	CLIENT_INFO* pInfo = pCIMgr->GetFirstClient();
	while (pInfo && LTStrICmp(pInfo->sName.c_str(),szPlayerName) != 0)
		pInfo = pInfo->pNext;

	if (pInfo)
	{

		// Tell the server
		SendCheatMessage( CHEAT_BOOT, pInfo->nID );
	}
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:28,代码来源:CheatMgr.cpp

示例3: ListClientFn

void ListClientFn(int argc, char **argv)
{
	CClientInfoMgr *pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
	if (pCIMgr)
	{
		CLIENT_INFO *ptr = pCIMgr->GetFirstClient();
		while (ptr)
		{
			g_pLTClient->CPrint("%d %s %d",ptr->nID,g_pLTClient->GetStringData(ptr->hstrName),ptr->nFrags);
			ptr = ptr->pNext;
		}
	}

}
开发者ID:germanocaldeira,项目名称:no-one-lives-forever,代码行数:14,代码来源:ClientInfoMgr.cpp

示例4: Update

void CHUDScoreDiff::Update()
{
	if (!IsMultiplayerGameClient()) return;

	if (GameModeMgr::Instance( ).m_grbEliminationWin)
	{
		CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
		if (!pCIMgr) return;

		CLIENT_INFO* pCI = pCIMgr->GetFirstClient();

		int32 nEnemiesLeft = 0;
		while (pCI)
		{
			if (pCI && pCI != g_pInterfaceMgr->GetClientInfoMgr()->GetLocalClient())
			{
				CCharacterFX* pCharacter = g_pGameClientShell->GetSFXMgr()->GetCharacterFromClientID(pCI->nID);
				if (pCharacter &&  !pCharacter->IsPlayerDead() && !pCharacter->m_cs.bIsSpectating )
				{
					if (GameModeMgr::Instance( ).m_grbUseTeams)
					{
						if (!pCIMgr->IsLocalTeam(pCI->nTeamID)) 
						{
							++nEnemiesLeft;
						}
					}
					else
					{
						++nEnemiesLeft;
					}
				}
			}
			pCI = pCI->pNext;
		}
		wchar_t wsScore[16] = L"";
		FormatString("HUD_Score_Format",wsScore,LTARRAYSIZE(wsScore),nEnemiesLeft);
		m_Text.SetText(wsScore);
		m_Text.SetColor(m_cTextColor);
	}
	else
	{
		int32 nLocalScore = 0;
		int32 nOtherScore = 0;
		if (GameModeMgr::Instance( ).m_grbUseTeams)
		{
			uint8 nTeam = g_pInterfaceMgr->GetClientInfoMgr()->GetLocalTeam();
			CTeam* pTeam = CTeamMgr::Instance().GetTeam(nTeam);
			if (pTeam)
			{
				nLocalScore = pTeam->GetScore();
			}

			nTeam = 1-nTeam;
			pTeam = CTeamMgr::Instance().GetTeam(nTeam);
			if (pTeam)
			{
				nOtherScore = pTeam->GetScore();
			}
		}
		else
		{
			CLIENT_INFO* pCI = g_pInterfaceMgr->GetClientInfoMgr()->GetLocalClient();
			if (pCI)
			{
				nLocalScore = pCI->sScore.GetScore();
			}

			pCI = g_pInterfaceMgr->GetClientInfoMgr()->GetFirstClient();
			if (pCI && pCI == g_pInterfaceMgr->GetClientInfoMgr()->GetLocalClient())
			{
				pCI = pCI->pNext;
			}
			if (pCI)
			{
				nOtherScore = pCI->sScore.GetScore();
			}
		}
		wchar_t wsScore[16] = L"";
		int32 nDiff = (nLocalScore-nOtherScore);

		FormatString("HUD_Score_Format",wsScore,LTARRAYSIZE(wsScore),nDiff);
		if (nDiff > 0)
		{
			m_Text.SetColor(m_cWinningTextColor);
			FormatString("HUD_Score_Format_Advantage",wsScore,LTARRAYSIZE(wsScore),nDiff);
		}
		else if (nDiff == 0)
		{
			m_Text.SetColor(m_cTextColor);
		}
		else
		{
			m_Text.SetColor(m_cLosingTextColor);
		}

		m_Text.SetText(wsScore);

	}

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

示例5: Update

void CHUDScores::Update()
{
	if (m_nDraw <= 0) return;

	uint32 textCol = (m_bScreen ? m_nScreenTextColor : m_nTextColor);
	uint32 playerTextCol = (m_bScreen ? m_nScreenPlayerTextColor : m_nPlayerTextColor);

	float fScale = g_pInterfaceResMgr->GetXRatio();
	if (fScale != m_fScale)
	{
		m_fScale = fScale;
		m_Server.SetScale(fScale);
		m_SingleFrame.SetScale(fScale);
		for (int team = 0; team < kNumTeams; team++)
		{
			m_Team[team].SetScale(fScale);
			m_Rounds[team].SetScale(fScale);
			m_Header[team].SetScale(fScale);
			m_Frame[team].SetScale(fScale);

			for (int i = 0; i < kMaxPlayers; i++)
			{
				m_Columns[team][i].SetScale(fScale);
			}
		}

	}

	if (IsTeamGameType())
	{
		CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();

		for( uint8 team = 0; team < kNumTeams; ++team )
		{
			CTeam* pTeam = CTeamMgr::Instance().GetTeam(team);
			if (!pTeam) continue;
			
			char szTmp[128];
			sprintf(szTmp,"%s : %d",pTeam->GetName(),pTeam->GetScore());
			m_Team[team].SetString(szTmp);

			sprintf(szTmp,"%s : %d", LoadTempString(IDS_ROUNDS), pTeam->GetRoundScore( ));
			m_Rounds[team].SetString(szTmp);
		
			m_Header[team].Show(LTTRUE);
		}

	}
	else
	{
		m_Team[0].SetString("");
		m_Rounds[0].SetString("");
		m_Header[1].Show(LTFALSE);
	}


	m_Server.SetColors(textCol,textCol,textCol);

	CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
	if (!pCIMgr) return;

	CLIENT_INFO* pCI = pCIMgr->GetFirstClient();
	int nTotal = 0;
	int count[kNumTeams] = {0,0};
	char szTmp[64] = "";
	uint16 nHeight[kNumTeams];
	nHeight[0] = m_Server.GetBaseHeight() + m_Header[0].GetBaseHeight() + m_Team[0].GetBaseHeight() + 24;
	nHeight[1] = m_Team[1].GetBaseHeight() + m_Header[1].GetBaseHeight() + 16;
	uint32 nLocalID = 0;
	g_pLTClient->GetLocalClientID (&nLocalID);


	while (pCI && (nTotal < kMaxPlayers))
	{
		uint8 nTeam = 0;
		
		if (IsTeamGameType())
		{
			nTeam = pCI->nTeamID;
		}


		int ndx = count[nTeam];


		
		if (nTeam < kNumTeams)
		{
			sprintf( szTmp, "%s%s",pCI->sName.c_str( ), pCI->bIsAdmin ? "[*]" : "" );
			m_Columns[nTeam][ndx].GetPolyString(0)->SetText( szTmp );
			sprintf(szTmp,"%d",pCI->sScore.GetScore());
			m_Columns[nTeam][ndx].GetPolyString(1)->SetText(szTmp);

			sprintf(szTmp,"%d",pCI->sScore.GetFrags());
			m_Columns[nTeam][ndx].GetPolyString(2)->SetText(szTmp);

			sprintf(szTmp,"%d",pCI->sScore.GetTags());
			m_Columns[nTeam][ndx].GetPolyString(3)->SetText(szTmp);

			sprintf(szTmp,"%d",pCI->nPing);
//.........这里部分代码省略.........
开发者ID:rickyharis39,项目名称:nolf2,代码行数:101,代码来源:HUDScores.cpp

示例6: Update

void CHUDScores::Update()
{
    if( !m_bInitialized )
        return;

    if( !m_bDraw )
        return;

//	uint32 textCol = (m_bScreen ? m_cScreenTextColor : m_cTextColor);
//	uint32 playerTextCol = (m_bScreen ? m_cScreenPlayerTextColor : m_cPlayerTextColor);

    //for the screen mode scoreboard, don't update the text once we've drawn it
    if (m_bScreen && !m_bFirstScreenUpdate)
        return;

    m_bFirstScreenUpdate = false;

    if (GameModeMgr::Instance( ).m_grbUseTeams)
    {
        for( uint8 nTeamNum = 0; nTeamNum < kNumTeams; ++nTeamNum )
        {
            uint8 team;
            if (g_pInterfaceMgr->GetClientInfoMgr()->IsLocalTeam(nTeamNum))
                team = 0;
            else
                team = 1;

            CTeam* pTeam = CTeamMgr::Instance().GetTeam(nTeamNum);
            if (!pTeam) continue;

            wchar_t wszTmp[128];
            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%s : %d",pTeam->GetName(),pTeam->GetScore());
            m_Team[team].SetString(wszTmp);

            LTSNPrintF(wszTmp,LTARRAYSIZE(wszTmp),L"%s : %d", LoadString("IDS_ROUNDS"), pTeam->GetRoundScore( ));
            m_Rounds[team].SetString(wszTmp);

            m_Header[team].Show(true);
        }

    }
    else
    {
        m_Team[0].SetString(L"");
        m_Rounds[0].SetString(L"");
        m_Header[1].Show(false);
    }


    m_Server.SetColor(m_cTextColor);

    if ( !GameModeMgr::Instance( ).m_grwsSessionName.GetValue().empty())
    {
        std::wstring wstr = GameModeMgr::Instance( ).m_grwsSessionName;
        if ( g_pClientConnectionMgr->IsConnectedToRemoteServer( ))
        {
            wstr += L" : ";
            wstr += MPA2W(g_pClientConnectionMgr->GetStartGameRequest( ).m_TCPAddress).c_str();
        }

        m_Server.SetString(wstr.c_str());
    }
    else
    {
        m_Server.SetString(L"");
    }

    // Update the round counter.
    m_RoundInfo.SetColor(m_cTextColor);
    wchar_t wszRound[32];
    uint8 nCurrentRound = g_pClientConnectionMgr ? g_pClientConnectionMgr->GetCurrentRound() : 0;
    uint8 nNumRounds = GameModeMgr::Instance( ).m_grnNumRounds;
    FormatString( "HUD_SCORES_ROUNDINFO", wszRound, LTARRAYSIZE( wszRound ), nCurrentRound + 1, nNumRounds );
    m_RoundInfo.SetString( wszRound );

    CClientInfoMgr *pCIMgr = g_pGameClientShell->GetInterfaceMgr( )->GetClientInfoMgr();
    if (!pCIMgr) return;

    CLIENT_INFO* pCI = pCIMgr->GetFirstClient();
    int nTotal = 0;
    int count[kNumTeams] = {0,0};
    wchar_t wszTmp[64] = L"";
    uint32 nHeight[kNumTeams];
    nHeight[0] = m_Server.GetBaseHeight() + m_Header[0].GetBaseHeight() + m_Team[0].GetBaseHeight() + 24;
    nHeight[1] = m_Team[1].GetBaseHeight() + m_Header[1].GetBaseHeight() + 16;
    uint32 nLocalID = 0;
    g_pLTClient->GetLocalClientID (&nLocalID);


    while (pCI && (nTotal < kMaxPlayers))
    {
        uint8 nTeam = 0;
        CCharacterFX* pCharacter = g_pGameClientShell->GetSFXMgr()->GetCharacterFromClientID(pCI->nID);

        if (GameModeMgr::Instance( ).m_grbUseTeams)
        {
            if (g_pInterfaceMgr->GetClientInfoMgr()->IsLocalTeam(pCI->nTeamID))
                nTeam = 0;
            else
                nTeam = 1;
//.........这里部分代码省略.........
开发者ID:jordandavidson,项目名称:lithtech,代码行数:101,代码来源:HUDScores.cpp


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