void CPortalStatsDisplayScreen::UpdateTextFields( C_PropPortalStatsDisplay *pPropPortalStatsDisplay )
{
	bool bIsTime = pPropPortalStatsDisplay->IsTime();
	float fNumPlayer = pPropPortalStatsDisplay->GetNumPlayerDisplay();
	float fNumGoal = pPropPortalStatsDisplay->GetNumGoalDisplay();

	// Figure out colors

	Color *( pColors[ 3 ] ) = { &m_cUnknown, &m_cFail, &m_cPass };

	int iColor = pPropPortalStatsDisplay->GetGoalSuccess() + 1;

	m_pNumPlayerLabel->SetFgColor( ( fNumPlayer != 0.0f ) ? ( *pColors[ iColor ] ) : ( m_cInvisible ) );
	m_pNumGoalLabel->SetFgColor( ( pPropPortalStatsDisplay->GetGoalVisible() ) ? ( *pColors[ iColor ] ) : ( m_cInvisible ) );

	// Fill in labels

	CFmtStr str;

	if ( !bIsTime )
	{
		str.sprintf( "%.0f", fNumPlayer );
		m_pNumPlayerLabel->SetText( str );

		str.sprintf( "%.0f", fNumGoal );
		m_pNumGoalLabel->SetText( str );
	}
	else
	{
		// break seconds into mnutes and seconds
		int iMinutes = static_cast<int>( fNumPlayer / 60.0f );
		int iHours = iMinutes / 60;
		iMinutes %= 60;
		int iSeconds = static_cast<int>( fNumPlayer ) % 60;
		MakeTimeString( str, iHours, iMinutes, iSeconds );
		m_pNumPlayerLabel->SetText( str );

		// break seconds into mnutes and seconds
		iMinutes = static_cast<int>( fNumGoal / 60.0f );
		iHours = iMinutes / 60;
		iMinutes %= 60;
		iSeconds = static_cast<int>( fNumGoal ) % 60;
		MakeTimeString( str, iHours, iMinutes, iSeconds );
		m_pNumGoalLabel->SetText( str );
	}

	// Draw cheated label when needed
	m_pCheatedLabel->SetVisible( pPropPortalStatsDisplay->HasCheated() );
}
void CPortalStatsDisplayScreen::ApplySchemeSettings( IScheme *pScheme )
{
	assert( pScheme );

	m_cPass = pScheme->GetColor( "CPortalStatsDisplayScreen_Pass", GetFgColor() );
	m_cFail = pScheme->GetColor( "CPortalStatsDisplayScreen_Fail", GetFgColor() );
	m_cUnknown = pScheme->GetColor( "CPortalStatsDisplayScreen_Unknown", GetFgColor() );
	m_cInvisible = Color( 0, 0, 0, 0 );	

	if( m_bInitLabelColor )
	{
		m_pNumPlayerLabel->SetFgColor( m_cUnknown );
		m_pNumGoalLabel->SetFgColor( m_cUnknown );

		m_bInitLabelColor = false;
	}
}
void CSlideshowDisplayScreen::ApplySchemeSettings( IScheme *pScheme )
{
	assert( pScheme );

	m_cDefault = pScheme->GetColor( "CSlideshowDisplayScreen_Default", GetFgColor() );
	m_cInvisible = Color( 0, 0, 0, 0 );	

	m_pDisplayTextLabel->SetFgColor( m_cDefault );
}
示例#4
0
//==============================================
// CHudFlags's Paint
// errr... paints the panel
//==============================================
void CHudCTFFlags::Paint()
{
	int m_iFlagCount = g_CtfFlags.Count();

	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();

	if( !pPlayer )
		return;


	//char text[512];
	int i;// = 0;
	int x_offset = 0;
	//int y_offset = 5;
	Color ColourWhite( 255, 255, 255, 255 );

	i = 0;
	while (i < MAX_FLAGS)
	{
		m_pLabelFlag[i]->SetVisible(false);
		i++;
	}
	
	//x_offset = ( (ScreenWidth() / 2) - (m_iFlagCount * 74) ); //Always lean to the left from the center. -HairyPotter
	x_offset = 0;

	for( i = 0; i < m_iFlagCount; i++ )
	{

		x_offset += 68;

		float fTimeToCap = gpGlobals->curtime;
		//switch( g_Flags[i]->m_iLastTeam )
		switch( g_CtfFlags[i]->GetTeamNumber() )
		{
		case TEAM_UNASSIGNED:
			switch( g_CtfFlags[i]->m_iForTeam )
			{
			case 0:
				m_pIconBlank->DrawSelf( x_offset, 0, ColourWhite );
				break;
			case 1: //This flag is picked up by the brits... so it's actually the american flag.
				m_pIconBlue->DrawSelf( x_offset, 0, ColourWhite );
				break;
			case 2: //This flag is picked up by the americans... so it's actually the british flag.
				m_pIconRed->DrawSelf( x_offset, 0, ColourWhite );
				break;
			}
			break;
		case TEAM_AMERICANS:
			m_pIconBlue->DrawSelf( x_offset, 0, ColourWhite );
			break;
		case TEAM_BRITISH:
			m_pIconRed->DrawSelf( x_offset, 0, ColourWhite );
			break;
		}

		if ( g_CtfFlags[i]->m_bIsCarried )
		{
			int r=0,g=0,b=0;
			
			//Start at blue.
			r = 0;
			g = 0;
			b = 255;
			//End up at red.
			r += 255 * (sin(fTimeToCap*4) + 1)/2;
			//g -= 100 * (sin(gpGlobals->curtime*4) + 1)/2;
			b -= 255 * (sin(fTimeToCap*4) + 1)/2;

			m_pLabelFlag[i]->SetText( "Taken" );
			m_pLabelFlag[i]->SizeToContents();
			//m_pLabelFlag[i]->SetVisible( true );

			//center on icon
			int w,h;
			m_pLabelFlag[i]->GetSize( w, h );
			m_pLabelFlag[i]->SetPos( (x_offset + 32) - w/2, 32 - h/2 );

			m_pLabelFlag[i]->SetFgColor( Color(r,g,b,255) );
			m_pLabelFlag[i]->SetVisible(true);
		}

		if ( g_CtfFlags[i]->GetMoveParent() && g_CtfFlags[i]->GetMoveParent() == pPlayer )
		{
			int ystart = GetTall() - 140; //Place this just above the LMS indicator.
			int w,h;

			m_pLabelCarrier->SetText( g_pVGuiLocalize->Find("#CTF"));
			m_pLabelCarrier->SizeToContents();
			m_pLabelCarrier->GetSize( w, h );
			m_pLabelCarrier->SetPos( 5, ystart - 1.3*h);
			m_pLabelCarrier->SetFgColor( ColourWhite );
			m_pLabelCarrier->SetVisible( true );
			//Msg("You are carrying a flag! \n");
		}
		else 
			m_pLabelCarrier->SetVisible( false );
	}
}