本文整理汇总了C++中C_TFPlayer::GetPlayerClass方法的典型用法代码示例。如果您正苦于以下问题:C++ C_TFPlayer::GetPlayerClass方法的具体用法?C++ C_TFPlayer::GetPlayerClass怎么用?C++ C_TFPlayer::GetPlayerClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_TFPlayer
的用法示例。
在下文中一共展示了C_TFPlayer::GetPlayerClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: OnTick
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFIntroMenu::OnTick()
{
// do we have anything special to do?
if ( m_flActionThink > 0 && m_flActionThink < gpGlobals->curtime )
{
if ( m_iAction == INTRO_STARTVIDEO )
{
if ( m_pVideo )
{
// turn on the captions if we have them
if ( LoadCaptions() )
{
if ( m_pCaptionLabel && !m_pCaptionLabel->IsVisible() )
{
m_pCaptionLabel->SetText( " " );
m_pCaptionLabel->SetVisible( true );
}
}
else
{
if ( m_pCaptionLabel && m_pCaptionLabel->IsVisible() )
{
m_pCaptionLabel->SetVisible( false );
}
}
m_pVideo->Activate();
m_pVideo->BeginPlayback( TFGameRules()->GetVideoFileForMap() );
m_pVideo->MoveToFront();
m_flVideoStartTime = gpGlobals->curtime;
}
}
else if ( m_iAction == INTRO_BACK )
{
m_pViewPort->ShowPanel( this, false );
m_pViewPort->ShowPanel( PANEL_MAPINFO, true );
}
else if ( m_iAction == INTRO_CONTINUE )
{
m_pViewPort->ShowPanel( this, false );
if ( GetLocalPlayerTeam() == TEAM_UNASSIGNED )
{
m_pViewPort->ShowPanel( PANEL_TEAM, true );
}
else
{
C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
// only open the class menu if they're not on team Spectator and they haven't already picked a class
if ( pPlayer &&
( GetLocalPlayerTeam() != TEAM_SPECTATOR ) &&
( pPlayer->GetPlayerClass()->GetClassIndex() == TF_CLASS_UNDEFINED ) )
{
switch( GetLocalPlayerTeam() )
{
case TF_TEAM_RED:
m_pViewPort->ShowPanel( PANEL_CLASS_RED, true );
break;
case TF_TEAM_BLUE:
m_pViewPort->ShowPanel( PANEL_CLASS_BLUE, true );
break;
}
}
}
}
// reset our think
SetNextThink( -1, INTRO_NONE );
}
// check if we need to update our captions
if ( m_pCaptionLabel && m_pCaptionLabel->IsVisible() )
{
UpdateCaptions();
}
}
示例3: OnKeyCodePressed
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFClassMenu::OnKeyCodePressed( KeyCode code )
{
m_KeyRepeat.KeyDown( code );
if ( ( m_iClassMenuKey != BUTTON_CODE_INVALID && m_iClassMenuKey == code ) ||
code == KEY_XBUTTON_BACK ||
code == KEY_XBUTTON_B )
{
C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( pLocalPlayer && ( pLocalPlayer->GetPlayerClass()->GetClassIndex() != TF_CLASS_UNDEFINED ) )
{
ShowPanel( false );
}
}
else if( code == KEY_SPACE || code == KEY_XBUTTON_A || code == KEY_XBUTTON_RTRIGGER )
{
ipanel()->SendMessage( GetFocusNavGroup().GetDefaultButton(), new KeyValues( "PressButton" ), GetVPanel() );
}
else if( code == KEY_XBUTTON_RIGHT || code == KEY_XSTICK1_RIGHT )
{
int loopCheck = 0;
do
{
loopCheck++;
m_iCurrentClassIndex++;
m_iCurrentClassIndex = ( m_iCurrentClassIndex % TF_CLASS_MENU_BUTTONS );
} while( ( m_pClassButtons[ iRemapIndexToClass[m_iCurrentClassIndex] ] == NULL ) && ( loopCheck < TF_CLASS_MENU_BUTTONS ) );
CImageMouseOverButton<CTFClassInfoPanel> *pButton = m_pClassButtons[ iRemapIndexToClass[m_iCurrentClassIndex] ];
if ( pButton )
{
pButton->OnCursorEntered();
}
}
else if( code == KEY_XBUTTON_LEFT || code == KEY_XSTICK1_LEFT )
{
int loopCheck = 0;
do
{
loopCheck++;
m_iCurrentClassIndex--;
if ( m_iCurrentClassIndex <= 0 )
{
m_iCurrentClassIndex = TF_CLASS_RANDOM;
}
} while( ( m_pClassButtons[ iRemapIndexToClass[m_iCurrentClassIndex] ] == NULL ) && ( loopCheck < TF_CLASS_MENU_BUTTONS ) );
CImageMouseOverButton<CTFClassInfoPanel> *pButton = m_pClassButtons[ iRemapIndexToClass[m_iCurrentClassIndex] ];
if ( pButton )
{
pButton->OnCursorEntered();
}
}
else if( code == KEY_XBUTTON_UP || code == KEY_XSTICK1_UP )
{
// Scroll class info text up
if ( g_lastPanel )
{
CExRichText *pRichText = dynamic_cast< CExRichText * >( g_lastPanel->FindChildByName( "classInfo" ) );
if ( pRichText )
{
PostMessage( pRichText, new KeyValues("MoveScrollBarDirect", "delta", 1) );
}
}
}
else if( code == KEY_XBUTTON_DOWN || code == KEY_XSTICK1_DOWN )
{
// Scroll class info text up
if ( g_lastPanel )
{
CExRichText *pRichText = dynamic_cast< CExRichText * >( g_lastPanel->FindChildByName( "classInfo" ) );
if ( pRichText )
{
PostMessage( pRichText, new KeyValues("MoveScrollBarDirect", "delta", -1) );
}
}
}
else
{
BaseClass::OnKeyCodePressed( code );
}
}