Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "cbase.h"
  7. #include "modelimagepanel.h"
  8. #include "tf_badge_panel.h"
  9. DECLARE_BUILD_FACTORY( CTFBadgePanel );
  10. CTFBadgePanel::CTFBadgePanel( vgui::Panel *pParent, const char *pName ) : BaseClass( pParent, pName )
  11. {
  12. m_pBadgePanel = new CModelImagePanel( this, "BadgePanel" );
  13. m_nPrevLevel = 0;
  14. }
  15. void CTFBadgePanel::ApplySchemeSettings( vgui::IScheme *pScheme )
  16. {
  17. BaseClass::ApplySchemeSettings( pScheme );
  18. m_pBadgePanel->LoadControlSettings( "resource/ui/BadgePanel.res" );
  19. }
  20. void CTFBadgePanel::SetupBadge( const IProgressionDesc* pProgress, const LevelInfo_t& levelInfo )
  21. {
  22. if ( !pProgress )
  23. return;
  24. pProgress->SetupBadgePanel( m_pBadgePanel, levelInfo );
  25. if ( m_nPrevLevel != levelInfo.m_nLevelNum )
  26. {
  27. m_nPrevLevel = levelInfo.m_nLevelNum;
  28. m_pBadgePanel->InvalidateImage();
  29. }
  30. }
  31. void CTFBadgePanel::SetupBadge( const IProgressionDesc* pProgress, const CSteamID& steamID )
  32. {
  33. if ( pProgress && steamID.IsValid() )
  34. {
  35. SetupBadge( pProgress, pProgress->YieldingGetLevelForSteamID( steamID ) );
  36. }
  37. }