コード例 #1
0
void CNB_Spend_Skill_Points::OnThink()
{
	BaseClass::OnThink();

	CASW_Marine_Profile *pProfile = Briefing()->GetMarineProfileByProfileIndex( m_nProfileIndex );
	if ( pProfile )
	{
		char imagename[255];
		Q_snprintf( imagename, sizeof(imagename), "briefing/face_%s", pProfile->m_PortraitName );
		m_pSelectedMarine->SetImage( imagename );

		m_pMarineNameLabel->SetText( pProfile->GetShortName() );
		m_pBioLabel->SetText( pProfile->m_Bio );
		int nMouseOverSkill = -1;
		for ( int i = 0; i < NUM_SKILL_PANELS; i++ )
		{
			m_pSkillPanel[ i ]->SetSkillDetails( m_nProfileIndex, i, Briefing()->GetProfileSkillPoints( m_nProfileIndex, i ) );
			m_pSkillPanel[ i ]->m_bSpendPointsMode = true;
			if ( m_pSkillPanel[ i ]->IsCursorOver() )
			{
				nMouseOverSkill = i;
			}
		}	
		if ( nMouseOverSkill != -1 && MarineSkills() )
		{
			ASW_Skill nSkillIndex = pProfile->GetSkillMapping( nMouseOverSkill );		// translate from skill slot to skill index

			m_pSkillTitle->SetText( MarineSkills()->GetSkillName( nSkillIndex ) );
			m_pSkillDescription->SetText( MarineSkills()->GetSkillDescription( nSkillIndex ) );
		}
		m_pSpareSkillPointsLabel->SetText( VarArgs( "%d", Briefing()->GetProfileSkillPoints( m_nProfileIndex, ASW_SKILL_SLOT_SPARE ) ) );
	}
}
コード例 #2
0
void CASW_Hotbar_Entry::UpdateImage()
{
	if ( !m_hMarine.Get() )
	{
		ClearImage();
		return;
	}

	C_ASW_Weapon *pWeapon = m_hMarine->GetASWWeapon( m_iInventoryIndex );
	if ( !pWeapon )
	{
		ClearImage();
		return;
	}


	const CASW_WeaponInfo* pInfo = pWeapon->GetWeaponInfo();
	if ( !pInfo || !pInfo->m_bOffhandActivate )		// TODO: Fix for sentry guns
	{
		if ( !asw_hotbar_self.GetBool() || m_iHotKeyIndex != -1 )		// allow your own third item to show even if it's not usable
		{
			ClearImage();
			return;
		}
	}

	m_pWeaponImage->SetVisible( true );
	m_pMarineNameLabel->SetVisible( true );
	m_pKeybindLabel->SetVisible( true );
	m_pQuantityLabel->SetVisible( true );

	m_pWeaponImage->SetImage( pInfo->szEquipIcon );

	CASW_Marine_Profile *pProfile = m_hMarine->GetMarineProfile();
	if ( pProfile )
	{
		m_pMarineNameLabel->SetText( pProfile->GetShortName() );
	}

	const char *pszKey = "";
	if ( m_iHotKeyIndex != -1 )
	{
		char szBinding[ 128 ];
		Q_snprintf( szBinding, sizeof( szBinding ), "asw_squad_hotbar %d", m_iHotKeyIndex );
		pszKey = ASW_FindKeyBoundTo( szBinding );
	}
	else
	{
		pszKey = ASW_FindKeyBoundTo( "+grenade1" );
	}
	char szKey[ 12 ];
	Q_snprintf( szKey, sizeof(szKey), "%s", pszKey );
	Q_strupr( szKey );
	m_pKeybindLabel->SetText( szKey );		// TODO: Eventually make this into instructor key style? or a version of that which fits the HUD

	char szQuantity[ 32 ];
	Q_snprintf( szQuantity, sizeof( szQuantity ), "x%d", pWeapon->Clip1() );
	m_pQuantityLabel->SetText( szQuantity );
}
コード例 #3
0
void CNB_Select_Marine_Panel::OnThink()
{
	BaseClass::OnThink();
	
	for ( int i = 0; i < m_Entries.Count(); i++ )
	{
		if ( m_Entries[i]->IsCursorOver() )
		{
			vgui::Panel *pPanel = m_Entries[i];
			CNB_Select_Marine_Entry *pCursorOver = dynamic_cast<CNB_Select_Marine_Entry*>( pPanel );
			if ( pCursorOver && pCursorOver->m_pPortraitImage->IsCursorOver() )
			{
				SetHighlight( i );
				break;
			}
		}
	}

	bool bShowSpareSkillPoints = false;
	CNB_Select_Marine_Entry *pHighlighted = dynamic_cast<CNB_Select_Marine_Entry*>( GetHighlightedEntry() );
	if ( pHighlighted )
	{
		int nProfileIndex = pHighlighted->GetProfileIndex();
		CASW_Marine_Profile *pProfile = Briefing()->GetMarineProfileByProfileIndex( nProfileIndex );
		if ( pProfile )
		{
			m_pMarineNameLabel->SetText( pProfile->GetShortName() );
			m_pBioLabel->SetText( pProfile->m_Bio );
			m_pSkillPanel0->SetSkillDetails( nProfileIndex, 0, Briefing()->GetProfileSkillPoints( nProfileIndex, 0 ) );
			m_pSkillPanel1->SetSkillDetails( nProfileIndex, 1, Briefing()->GetProfileSkillPoints( nProfileIndex, 1 ) );
			m_pSkillPanel2->SetSkillDetails( nProfileIndex, 2, Briefing()->GetProfileSkillPoints( nProfileIndex, 2 ) );
			m_pSkillPanel3->SetSkillDetails( nProfileIndex, 3, Briefing()->GetProfileSkillPoints( nProfileIndex, 3 ) );
			m_pSkillPanel4->SetSkillDetails( nProfileIndex, 4, Briefing()->GetProfileSkillPoints( nProfileIndex, 4 ) );

			if ( ASWGameRules() && ASWGameRules()->IsCampaignGame() && ASWGameRules()->GetCampaignSave() && !ASWGameRules()->GetCampaignSave()->UsingFixedSkillPoints() )
			{
				int nSkillPoints = Briefing()->GetProfileSkillPoints( nProfileIndex, ASW_SKILL_SLOT_SPARE );
				if ( nSkillPoints > 0 )
				{
					wchar_t buffer[128];
					char sparebuffer[8];
					Q_snprintf(sparebuffer, sizeof(sparebuffer), "%d", nSkillPoints);
					wchar_t wsparebuffer[8];
					g_pVGuiLocalize->ConvertANSIToUnicode(sparebuffer, wsparebuffer, sizeof( wsparebuffer ));

					g_pVGuiLocalize->ConstructString( buffer, sizeof(buffer),
						g_pVGuiLocalize->Find("#asw_unspent_points"), 1,
						wsparebuffer);
					
					m_pSkillPointsLabel->SetText( buffer );
					bShowSpareSkillPoints = true;
				}
			}
		}

		m_pAcceptButton->SetEnabled( !Briefing()->IsProfileSelectedBySomeoneElse( nProfileIndex ) );
	}
	else
	{
		
	}

	m_pSkillPointsLabel->SetVisible( bShowSpareSkillPoints );
}