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


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

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


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

示例1: ClientsideProjectileNailCallback

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void ClientsideProjectileNailCallback(const CEffectData &data)
{
	C_TFPlayer *pPlayer = dynamic_cast<C_TFPlayer*>(ClientEntityList().GetBaseEntityFromHandle(data.m_hEntity));
	if (pPlayer)
	{
		C_LocalTempEntity *pNail = ClientsideProjectileCallback(data, NAILGUN_NAIL_GRAVITY);
		if (pNail)
		{
			switch (pPlayer->GetTeamNumber())
			{
			case TF_TEAM_RED:
				pNail->m_nSkin = 0;
				break;
			case TF_TEAM_BLUE:
				pNail->m_nSkin = 1;
				break;
			case TF_TEAM_GREEN:
				pNail->m_nSkin = 2;
				break;
			case TF_TEAM_YELLOW:
				pNail->m_nSkin = 3;
				break;
			}
			bool bCritical = ((data.m_nDamageType & DMG_CRITICAL) != 0);
			pPlayer->m_Shared.SetParticleToMercColor(
				pNail->AddParticleEffect(GetNailTrailParticleName(pPlayer->GetTeamNumber(), bCritical))
				);
			pNail->AddEffects(EF_NOSHADOW);
			pNail->flags |= FTENT_USEFASTCOLLISIONS;
		}
	}
}
开发者ID:TenmaPL,项目名称:TF2Classic,代码行数:35,代码来源:tf_projectile_nail.cpp

示例2: ClientsideProjectileSyringeCallback

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void ClientsideProjectileSyringeCallback( const CEffectData &data )
{
	// Get the syringe and add it to the client entity list, so we can attach a particle system to it.
	C_TFPlayer *pPlayer = dynamic_cast<C_TFPlayer*>( ClientEntityList().GetBaseEntityFromHandle( data.m_hEntity ) );
	if ( pPlayer )
	{
		C_LocalTempEntity *pSyringe = ClientsideProjectileCallback( data, SYRINGE_GRAVITY );
		if ( pSyringe )
		{
			switch (pPlayer->GetTeamNumber())
			{
			case TF_TEAM_RED:
				pSyringe->m_nSkin = 0;
				break;
			case TF_TEAM_BLUE:
				pSyringe->m_nSkin = 1;
				break;
			case TF_TEAM_GREEN:
				pSyringe->m_nSkin = 2;
				break;
			case TF_TEAM_YELLOW:
				pSyringe->m_nSkin = 3;
				break;
			}
			bool bCritical = ( ( data.m_nDamageType & DMG_CRITICAL ) != 0 );
			pPlayer->m_Shared.SetParticleToMercColor(
				pSyringe->AddParticleEffect(GetSyringeTrailParticleName(pPlayer->GetTeamNumber(), bCritical))
				);
			pSyringe->AddEffects( EF_NOSHADOW );
			pSyringe->flags |= FTENT_USEFASTCOLLISIONS;
		}
	}
}
开发者ID:TenmaPL,项目名称:TF2Classic,代码行数:36,代码来源:tf_projectile_nail.cpp

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

示例4: GetDisplayedSubtitlePlayerName

const char *CHudChat::GetDisplayedSubtitlePlayerName( int clientIndex )
{
	C_TFPlayer *pPlayer = ToTFPlayer( UTIL_PlayerByIndex( clientIndex ) );
	C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

	if ( !pPlayer || !pLocalPlayer )
		return BaseClass::GetDisplayedSubtitlePlayerName( clientIndex );

	// If they are disguised as the enemy, and not on our team
	if ( pPlayer->m_Shared.InCond( TF_COND_DISGUISED ) &&
		pPlayer->m_Shared.GetDisguiseTeam() != pPlayer->GetTeamNumber() && 
		!pLocalPlayer->InSameTeam( pPlayer ) )
	{
		C_TFPlayer *pDisguiseTarget = ToTFPlayer( pPlayer->m_Shared.GetDisguiseTarget() );

		Assert( pDisguiseTarget );

		if ( !pDisguiseTarget )
		{
			return BaseClass::GetDisplayedSubtitlePlayerName( clientIndex );
		}

		return pDisguiseTarget->GetPlayerName();
	}

	return BaseClass::GetDisplayedSubtitlePlayerName( clientIndex );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:27,代码来源:tf_hud_chat.cpp

示例5: Update

//-----------------------------------------------------------------------------
// Purpose: called to update the menu with new information
//-----------------------------------------------------------------------------
void CTFTeamMenu::Update( void )
{
	BaseClass::Update();

	C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

	if ( pLocalPlayer && ( pLocalPlayer->GetTeamNumber() != TEAM_UNASSIGNED ) )
	{
#ifdef _X360
		if ( m_pFooter )
		{
			m_pFooter->ShowButtonLabel( "cancel", true );
		}
#else
		if ( m_pCancelButton )
		{
			m_pCancelButton->SetVisible( true );
		}
#endif
	}
	else
	{
#ifdef _X360
		if ( m_pFooter )
		{
			m_pFooter->ShowButtonLabel( "cancel", false );
		}
#else
		if ( m_pCancelButton && m_pCancelButton->IsVisible() )
		{
			m_pCancelButton->SetVisible( false );
		}
#endif
	}
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:38,代码来源:tf_teammenu.cpp

示例6:

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
const char *CBuildingStatusItem_SentryGun::GetBackgroundImage( void )
{
	C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

	const char *pResult = "obj_status_background_tall_blue";

	if ( !pLocalPlayer )
	{
		return pResult;
	}

	switch( pLocalPlayer->GetTeamNumber() )
	{
	case TF_TEAM_BLUE:
		pResult = "obj_status_background_tall_blue";
		break;
	case TF_TEAM_RED:
		pResult = "obj_status_background_tall_red";
		break;
	default:
		break;
	}

	return pResult;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:28,代码来源:tf_hud_building_status.cpp

示例7: FireGameEvent

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFImagePanel::FireGameEvent(IGameEvent * event)
{
	if ( FStrEq( "localplayer_changeteam", event->GetName() ) )
	{
		C_TFPlayer *pPlayer = ToTFPlayer( C_BasePlayer::GetLocalPlayer() );
		m_iBGTeam = pPlayer ? pPlayer->GetTeamNumber() : TEAM_UNASSIGNED;
		UpdateBGImage();
	}
}
开发者ID:xomp,项目名称:TF2Classic,代码行数:12,代码来源:tf_imagepanel.cpp

示例8: ScalableImagePanel

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CTFImagePanel::CTFImagePanel(Panel *parent, const char *name) : ScalableImagePanel(parent, name)
{
	for ( int i = 0; i < TF_TEAM_COUNT; i++ )
	{
		m_szTeamBG[i][0] = '\0';
	}

	C_TFPlayer *pPlayer = ToTFPlayer( C_BasePlayer::GetLocalPlayer() );
	m_iBGTeam = pPlayer ? pPlayer->GetTeamNumber() : TEAM_UNASSIGNED;

	ListenForGameEvent( "localplayer_changeteam" );
}
开发者ID:xomp,项目名称:TF2Classic,代码行数:15,代码来源:tf_imagepanel.cpp

示例9: TestStatPanel

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFStatPanel::TestStatPanel( TFStatType_t statType, RecordBreakType_t recordType )
{
	C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
	if ( !pPlayer )
		return;
	
	m_iCurStatClass = pPlayer->GetPlayerClass()->GetClassIndex();
	ClassStats_t &classStats = GetClassStats( m_iCurStatClass );;
	m_iCurStatValue = classStats.max.m_iStat[statType];
	m_iCurStatTeam = pPlayer->GetTeamNumber();

	ShowStatPanel( m_iCurStatClass, m_iCurStatTeam, m_iCurStatValue, statType, recordType, false );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:16,代码来源:tf_hud_statpanel.cpp

示例10: OnCommand

//-----------------------------------------------------------------------------
// Purpose: Called when the user picks a team
//-----------------------------------------------------------------------------
void CTFTeamMenu::OnCommand( const char *command )
{
	C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

	if ( Q_stricmp( command, "vguicancel" ) )
	{
		// we're selecting a team, so make sure it's not the team we're already on before sending to the server
		if ( pLocalPlayer && ( Q_strstr( command, "jointeam " ) ) )
		{
			const char *pTeam = command + Q_strlen( "jointeam " );
			int iTeam = TEAM_INVALID;

			if ( Q_stricmp( pTeam, "spectate" ) == 0 )
			{
				iTeam = TEAM_SPECTATOR;
			}
			else if ( Q_stricmp( pTeam, "red" ) == 0 )
			{
				iTeam = TF_TEAM_RED;
			}
			else if ( Q_stricmp( pTeam, "blue" ) == 0 )
			{
				iTeam = TF_TEAM_BLUE;
			}
	
			if ( iTeam == TF_TEAM_RED && m_bRedDisabled )
			{
				return;
			}

			if ( iTeam == TF_TEAM_BLUE && m_bBlueDisabled )
			{
				return;
			}

			// are we selecting the team we're already on?
			if ( pLocalPlayer->GetTeamNumber() != iTeam )
			{
				engine->ClientCmd( command );
			}
		}
		else if ( pLocalPlayer && ( Q_strstr( command, "jointeam_nomenus " ) ) )
		{
			engine->ClientCmd( command );
		}
	}

	BaseClass::OnCommand( command );
	ShowPanel( false );
	OnClose();
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:54,代码来源:tf_teammenu.cpp

示例11: ShouldDraw

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CHudBuildingStatusContainer_Engineer::ShouldDraw( void )
{
	// Don't draw in freezecam
	C_TFPlayer *pPlayer = CTFPlayer::GetLocalTFPlayer();
	if ( !pPlayer || !pPlayer->IsPlayerClass( TF_CLASS_ENGINEER ) || pPlayer->GetObserverMode() == OBS_MODE_FREEZECAM )
	{
		return false;
	}

	if ( pPlayer->GetTeamNumber() <= TEAM_SPECTATOR )
	{
		return false;
	}

	return CHudElement::ShouldDraw();
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:19,代码来源:tf_hud_building_status.cpp

示例12: GetTargetIDString

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_AI_BaseNPC::GetTargetIDString( wchar_t *sIDString, int iMaxLenInBytes )
{
	sIDString[0] = '\0';

	C_TFPlayer *pLocalTFPlayer = C_TFPlayer::GetLocalTFPlayer();
	
	if ( !pLocalTFPlayer )
		return;

	if ( InSameTeam( pLocalTFPlayer ) || pLocalTFPlayer->IsPlayerClass( TF_CLASS_SPY ) || pLocalTFPlayer->GetTeamNumber() == TEAM_SPECTATOR )
	{
		const char *pszClassname = GetClassname();
		wchar_t *wszNPCName;
		wszNPCName = g_pVGuiLocalize->Find( pszClassname );

		if ( !wszNPCName )
		{
			wchar_t wszNPCNameBuf[MAX_PLAYER_NAME_LENGTH];
			g_pVGuiLocalize->ConvertANSIToUnicode( pszClassname, wszNPCNameBuf, sizeof(wszNPCNameBuf) );
			wszNPCName = wszNPCNameBuf;
		}

		const char *printFormatString = NULL;

		if ( pLocalTFPlayer->GetTeamNumber() == TEAM_SPECTATOR || InSameTeam( pLocalTFPlayer ) )
		{
			printFormatString = "#TF_playerid_sameteam";
		}
		else if ( pLocalTFPlayer->IsPlayerClass( TF_CLASS_SPY ) )
		{
			// Spy can see enemy's health.
			printFormatString = "#TF_playerid_diffteam";
		}

		wchar_t *wszPrepend = L"";

		if ( printFormatString )
		{
			g_pVGuiLocalize->ConstructString( sIDString, iMaxLenInBytes, g_pVGuiLocalize->Find(printFormatString), 3, wszPrepend, wszNPCName );
		}
	}
}
开发者ID:tryzombie501,项目名称:TF2HLCoop,代码行数:45,代码来源:c_ai_basenpc.cpp

示例13: GetClientColor

//-----------------------------------------------------------------------------
Color CHudChat::GetClientColor( int clientIndex )
{
	IScheme *pScheme = scheme()->GetIScheme( GetScheme() );

	if ( pScheme == NULL )
		return Color( 255, 255, 255, 255 );

	if ( clientIndex == 0 ) // console msg
	{
		return g_ColorGreen;
	}
	else if( g_PR )
	{
		int iTeam = g_PR->GetTeam( clientIndex );

		C_TFPlayer *pPlayer = ToTFPlayer( UTIL_PlayerByIndex( clientIndex ) );
		C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

		if ( IsVoiceSubtitle() == true )
		{
			// if this player is on the other team, disguised as my team, show disguised color
			if ( pPlayer && pLocalPlayer && pPlayer->m_Shared.InCond( TF_COND_DISGUISED ) &&
				pPlayer->m_Shared.GetDisguiseTeam() == pLocalPlayer->GetTeamNumber() )
			{
				iTeam = pPlayer->m_Shared.GetDisguiseTeam();
			}
		}

		switch ( iTeam )
		{
		case TF_TEAM_RED	: return pScheme->GetColor( "TFColors.ChatTextRed", g_ColorRed );
		case TF_TEAM_BLUE	: return pScheme->GetColor( "TFColors.ChatTextBlue", g_ColorBlue );;
		default	: return g_ColorGrey;
		}
	}

	return g_ColorYellow;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:39,代码来源:tf_hud_chat.cpp

示例14: OnKeyCodePressed

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFFourTeamMenu::OnKeyCodePressed(KeyCode code)
{
	if ((m_iTeamMenuKey != BUTTON_CODE_INVALID && m_iTeamMenuKey == code) ||
		code == KEY_XBUTTON_BACK ||
		code == KEY_XBUTTON_B)
	{
		C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

		if (pLocalPlayer && (pLocalPlayer->GetTeamNumber() != TEAM_UNASSIGNED))
		{
			ShowPanel(false);
		}
	}
	else if (code == KEY_SPACE)
	{
		engine->ClientCmd("jointeam auto");

		ShowPanel(false);
		OnClose();
	}
	else if (code == KEY_XBUTTON_A || code == KEY_XBUTTON_RTRIGGER)
	{
		// select the active focus
		if (GetFocusNavGroup().GetCurrentFocus())
		{
			ipanel()->SendMessage(GetFocusNavGroup().GetCurrentFocus()->GetVPanel(), new KeyValues("PressButton"), GetVPanel());
		}
	}
	else if (code == KEY_XBUTTON_RIGHT || code == KEY_XSTICK1_RIGHT)
	{
		CTFTeamButton *pButton;

		pButton = dynamic_cast< CTFTeamButton *> (GetFocusNavGroup().GetCurrentFocus());
		if (pButton)
		{
			pButton->OnCursorExited();
			GetFocusNavGroup().RequestFocusNext(pButton->GetVPanel());
		}
		else
		{
			GetFocusNavGroup().RequestFocusNext(NULL);
		}

		pButton = dynamic_cast< CTFTeamButton * > (GetFocusNavGroup().GetCurrentFocus());
		if (pButton)
		{
			pButton->OnCursorEntered();
		}
	}
	else if (code == KEY_XBUTTON_LEFT || code == KEY_XSTICK1_LEFT)
	{
		CTFTeamButton *pButton;

		pButton = dynamic_cast< CTFTeamButton *> (GetFocusNavGroup().GetCurrentFocus());
		if (pButton)
		{
			pButton->OnCursorExited();
			GetFocusNavGroup().RequestFocusPrev(pButton->GetVPanel());
		}
		else
		{
			GetFocusNavGroup().RequestFocusPrev(NULL);
		}

		pButton = dynamic_cast< CTFTeamButton * > (GetFocusNavGroup().GetCurrentFocus());
		if (pButton)
		{
			pButton->OnCursorEntered();
		}
	}
	else if (m_iScoreBoardKey != BUTTON_CODE_INVALID && m_iScoreBoardKey == code)
	{
		gViewPortInterface->ShowPanel(PANEL_SCOREBOARD, true);
		gViewPortInterface->PostMessageToPanel(PANEL_SCOREBOARD, new KeyValues("PollHideCode", "code", code));
	}
	else
	{
		BaseClass::OnKeyCodePressed(code);
	}
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:83,代码来源:tf_teammenu.cpp

示例15: OnTick

//-----------------------------------------------------------------------------
// Frame-based update
//-----------------------------------------------------------------------------
void CTFTeamMenu::OnTick()
{
	// update the number of players on each team

	// enable or disable buttons based on team limit

	C_Team *pRed = GetGlobalTeam( TF_TEAM_RED );
	C_Team *pBlue = GetGlobalTeam( TF_TEAM_BLUE );

	if ( !pRed || !pBlue )
		return;

	// set our team counts
	SetDialogVariable( "bluecount", pBlue->Get_Number_Players() );
	SetDialogVariable( "redcount", pRed->Get_Number_Players() );

	C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

	if ( !pLocalPlayer )
		return;

	CTFGameRules *pRules = TFGameRules();

	if ( !pRules )
		return;

	// check if teams are unbalanced
	m_bRedDisabled = m_bBlueDisabled = false;

	int iHeavyTeam, iLightTeam;

	bool bUnbalanced = pRules->AreTeamsUnbalanced( iHeavyTeam, iLightTeam );
	
	int iCurrentTeam = pLocalPlayer->GetTeamNumber();

	if ( ( bUnbalanced && iHeavyTeam == TF_TEAM_RED ) || ( pRules->WouldChangeUnbalanceTeams( TF_TEAM_RED, iCurrentTeam ) ) )
	{
		m_bRedDisabled = true;
	}

	if ( ( bUnbalanced && iHeavyTeam == TF_TEAM_BLUE ) || ( pRules->WouldChangeUnbalanceTeams( TF_TEAM_BLUE, iCurrentTeam ) ) )
	{
		m_bBlueDisabled = true;
	}

	if ( m_pSpecTeamButton && m_pSpecLabel )
	{
		ConVarRef mp_allowspectators( "mp_allowspectators" );
		if ( mp_allowspectators.IsValid() )
		{
			if ( mp_allowspectators.GetBool() )
			{
				if ( !m_pSpecTeamButton->IsVisible() )
				{
					m_pSpecTeamButton->SetVisible( true );
					m_pSpecLabel->SetVisible( true );
				}
			}
			else
			{
				if ( m_pSpecTeamButton->IsVisible() )
				{
					m_pSpecTeamButton->SetVisible( false );
					m_pSpecLabel->SetVisible( false );
				}
			}
		}
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:72,代码来源:tf_teammenu.cpp


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