Exemple #1
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void HintClear( void )
{
#ifdef CLIENT_DLL
    C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
#else
    CBasePlayer* pPlayer = UTIL_GetCommandClient();
#endif
    if ( pPlayer && pPlayer->Hints() )
    {
        pPlayer->Hints()->ClearHintHistory();
    }
}
//-----------------------------------------------------------------------------
// Purpose: Localize, display, and animate the hud element
//-----------------------------------------------------------------------------
void CHudSideHintPanel::LocalizeAndDisplay( const char *pszHudTxtMsg, const char *szRawString )
{
	static wchar_t szBuf[128];
	static wchar_t *pszBuf;

	// init buffers & pointers
	szBuf[0] = 0;
	pszBuf = szBuf;

	// try to localize
	if ( pszHudTxtMsg )
	{
		pszBuf = g_pVGuiLocalize->Find( pszHudTxtMsg );
	}
	else
	{
		pszBuf = g_pVGuiLocalize->Find( szRawString );
	}

	if ( !pszBuf )
	{
		// use plain ASCII string 
		g_pVGuiLocalize->ConvertANSIToUnicode( szRawString, szBuf, sizeof(szBuf) );
		pszBuf = szBuf;
	}

	// make it visible
	if ( SetHintText( pszBuf ) )
	{
		SetVisible( true );
		g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "SideHintShow" ); 

		C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
		if ( pLocalPlayer )
		{
			pLocalPlayer->EmitSound( "Hud.Hint" );

			if ( pLocalPlayer->Hints() )
			{
				pLocalPlayer->Hints()->PlayedAHint();
			}
		}
	}
	else
	{
		g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "SideHintHide" ); 
	}
}