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.

137 lines
4.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TF_HUD_MATCH_STATUS_H
  8. #define TF_HUD_MATCH_STATUS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "GameEventListener.h"
  13. #include "hudelement.h"
  14. #include "basemodelpanel.h"
  15. #include "tf_teamstatus.h"
  16. #include "tf_matchmaking_shared.h"
  17. using namespace vgui;
  18. bool ShouldUseMatchHUD();
  19. //-----------------------------------------------------------------------------
  20. // Purpose:
  21. //-----------------------------------------------------------------------------
  22. class CRoundCounterPanel : public EditablePanel, public CGameEventListener
  23. {
  24. public:
  25. DECLARE_CLASS_SIMPLE( CRoundCounterPanel, EditablePanel );
  26. typedef CUtlVector< ImagePanel* > ImageVector;
  27. CRoundCounterPanel( Panel *parent, const char *panelName );
  28. ~CRoundCounterPanel();
  29. virtual void ApplySchemeSettings(IScheme *pScheme) OVERRIDE;
  30. virtual void ApplySettings(KeyValues *inResourceData) OVERRIDE;
  31. virtual void PerformLayout() OVERRIDE;
  32. virtual void OnThink() OVERRIDE;
  33. virtual void FireGameEvent(IGameEvent * event) OVERRIDE;
  34. private:
  35. void CreateRoundPanels( ImageVector& vecImages, const char* pszName, KeyValues* pKVSettings );
  36. enum EAlignment
  37. {
  38. ALIGN_WEST,
  39. ALIGN_EAST
  40. };
  41. void LayoutPanels( ImageVector& vecImages, EAlignment eAlignment, int nStartPos, int nMaxWide );
  42. KeyValues* m_pRoundIndicatorKVs;
  43. KeyValues* m_pRoundWinIndicatorRedKV;
  44. KeyValues* m_pRoundWinIndicatorBlueKV;
  45. ImageVector m_vecRedRoundIndicators;
  46. ImageVector m_vecBlueRoundIndicators;
  47. ImageVector m_vecRedWinIndicators;
  48. ImageVector m_vecBlueWinIndicators;
  49. bool m_bCountDirty;
  50. CPanelAnimationVarAliasType( int, m_nStartingWidth, "starting_width", "10", "proportional_int" );
  51. CPanelAnimationVarAliasType( int, m_nWidthPerRound, "width_per_round", "10", "proportional_int" );
  52. CPanelAnimationVarAliasType( int, m_nIndicatorStartOffset, "indicator_start_offset", "8", "proportional_int" );
  53. CPanelAnimationVarAliasType( int, m_nIndicatorPanelStep, "indicator_max_wide", "10", "proportional_int" );
  54. };
  55. //-----------------------------------------------------------------------------
  56. // Purpose:
  57. //-----------------------------------------------------------------------------
  58. class CTFHudMatchStatus : public CHudElement, public EditablePanel
  59. {
  60. DECLARE_CLASS_SIMPLE( CTFHudMatchStatus, EditablePanel );
  61. public:
  62. CTFHudMatchStatus( const char *pElementName );
  63. virtual ~CTFHudMatchStatus( void );
  64. virtual void ApplySchemeSettings( IScheme *pScheme ) OVERRIDE;
  65. virtual void FireGameEvent( IGameEvent * event ) OVERRIDE;
  66. virtual void OnThink() OVERRIDE;
  67. virtual void PerformLayout() OVERRIDE;
  68. virtual bool ShouldDraw( void ) OVERRIDE;
  69. virtual void Reset() OVERRIDE;
  70. void SetPanelsVisible();
  71. private:
  72. void ShowMatchStartDoors();
  73. void ShowRoundSign( int nRoundNumber );
  74. void InitPlayerList( SectionedListPanel *pPlayerList, int nTeam );
  75. void UpdatePlayerList();
  76. void UpdatePlayerAvatar( int playerIndex, KeyValues *kv );
  77. void UpdateTeamInfo();
  78. void HandleCountdown( int nTime );
  79. CRoundCounterPanel *m_pRoundCounter;
  80. class CTFHudTimeStatus *m_pTimePanel;
  81. CModelPanel *m_pRoundSignModel;
  82. CTFTeamStatus *m_pTeamStatus;
  83. CModelPanel *m_pMatchStartModelPanel;
  84. EMatchGroup m_eMatchGroupSettings;
  85. vgui::EditablePanel *m_pBlueTeamPanel;
  86. vgui::SectionedListPanel *m_pPlayerListBlue;
  87. vgui::EditablePanel *m_pRedTeamPanel;
  88. vgui::SectionedListPanel *m_pPlayerListRed;
  89. vgui::ImageList *m_pImageList;
  90. CUtlMap<CSteamID, int> m_mapAvatarsToImageList;
  91. CAvatarImagePanel *m_pRedLeaderAvatarImage;
  92. EditablePanel *m_pRedLeaderAvatarBG;
  93. vgui::ImagePanel *m_pRedTeamImage;
  94. CExLabel *m_pRedTeamName;
  95. CAvatarImagePanel *m_pBlueLeaderAvatarImage;
  96. EditablePanel *m_pBlueLeaderAvatarBG;
  97. vgui::ImagePanel *m_pBlueTeamImage;
  98. CExLabel *m_pBlueTeamName;
  99. CPanelAnimationVar( int, m_iAvatarWidth, "avatar_width", "34" ); // Avatar width doesn't scale with resolution
  100. CPanelAnimationVarAliasType( int, m_iSpacerWidth, "spacer", "5", "proportional_int" );
  101. CPanelAnimationVarAliasType( int, m_iNameWidth, "name_width", "136", "proportional_int" );
  102. CPanelAnimationVarAliasType( int, m_iHorizFillInset, "horiz_inset", "4", "proportional_int" );
  103. vgui::HFont m_hPlayerListFont;
  104. bool m_bUseMatchHUD;
  105. };
  106. #endif // TF_HUD_MATCH_STATUS_H