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


C++ C_TFPlayer::IsHLTV方法代码示例

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


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

示例1: UpdateReinforcements

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFSpectatorGUI::UpdateReinforcements( void )
{
	if( !m_pReinforcementsLabel )
		return;

	C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
	if ( !pPlayer || pPlayer->IsHLTV() ||
		(pPlayer->GetTeamNumber() != TF_TEAM_RED && pPlayer->GetTeamNumber() != TF_TEAM_BLUE && pPlayer->GetTeamNumber() != TF_TEAM_GREEN && pPlayer->GetTeamNumber() != TF_TEAM_YELLOW) ||
		( pPlayer->m_Shared.GetState() != TF_STATE_OBSERVER ) && ( pPlayer->m_Shared.GetState() != TF_STATE_DYING ) ||
		( pPlayer->GetObserverMode() == OBS_MODE_FREEZECAM ) )
	{
		m_pReinforcementsLabel->SetVisible( false );
		return;
	}

	wchar_t wLabel[128];
	
	if ( TFGameRules()->InStalemate() )
	{
		g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find( "#game_respawntime_stalemate" ), 0 );
	}
	else if ( TFGameRules()->State_Get() == GR_STATE_TEAM_WIN )
	{
		// a team has won the round
		g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find( "#game_respawntime_next_round" ), 0 );
	}
	else
	{
		float flNextRespawn = TFGameRules()->GetNextRespawnWave( pPlayer->GetTeamNumber(), pPlayer );
		if ( !flNextRespawn )
		{
			m_pReinforcementsLabel->SetVisible( false );
			return;
		}

		int iRespawnWait = (flNextRespawn - gpGlobals->curtime);
		if ( iRespawnWait <= 0 )
		{
			g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find("#game_respawntime_now" ), 0 );
		}
		else if ( iRespawnWait <= 1.0 )
		{
			g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find("#game_respawntime_in_sec" ), 0 );
		}
		else
		{
			char szSecs[6];
			Q_snprintf( szSecs, sizeof(szSecs), "%d", iRespawnWait );
			wchar_t wSecs[4];
			g_pVGuiLocalize->ConvertANSIToUnicode(szSecs, wSecs, sizeof(wSecs));
			g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find("#game_respawntime_in_secs" ), 1, wSecs );
		}
	}

	m_pReinforcementsLabel->SetVisible( true );
	m_pReinforcementsLabel->SetText( wLabel, true );
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:60,代码来源:tf_spectatorgui.cpp


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