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.

109 lines
4.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TF_TEAMSTATUS_H
  8. #define TF_TEAMSTATUS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/EditablePanel.h>
  13. #include <vgui_controls/ProgressBar.h>
  14. #include "tf_playerpanel.h"
  15. //-----------------------------------------------------------------------------
  16. // Purpose:
  17. //-----------------------------------------------------------------------------
  18. class CTFTeamStatusPlayerPanel : public CTFPlayerPanel
  19. {
  20. DECLARE_CLASS_SIMPLE( CTFTeamStatusPlayerPanel, CTFPlayerPanel );
  21. public:
  22. CTFTeamStatusPlayerPanel( vgui::Panel *parent, const char *name );
  23. virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
  24. virtual void UpdateBorder( void ) OVERRIDE;
  25. virtual bool Update( void ) OVERRIDE;
  26. int GetPreviousTeam( void ) { return m_iTeam; }
  27. private:
  28. vgui::ContinuousProgressBar *m_pHealthBar;
  29. vgui::ContinuousProgressBar *m_pOverhealBar;
  30. vgui::Panel *m_pClassImageBG;
  31. vgui::ImagePanel *m_pDeathFlag;
  32. int m_iTeam;
  33. CPanelAnimationVar( Color, m_ColorPortraitBGRedLocalPlayer, "color_portrait_bg_red_local_player", "195 169 168 255" );
  34. CPanelAnimationVar( Color, m_ColorPortraitBGBlueLocalPlayer, "color_portrait_bg_blue_local_player", "168 169 195 255" );
  35. CPanelAnimationVar( Color, m_ColorPortraitBGRed, "color_portrait_bg_red", "119 62 61 255" );
  36. CPanelAnimationVar( Color, m_ColorPortraitBGBlue, "color_portrait_bg_blue", "62 81 101 255" );
  37. CPanelAnimationVar( Color, m_ColorPortraitBGRedDead, "color_portrait_bg_red_dead", "49 44 42 255" );
  38. CPanelAnimationVar( Color, m_ColorPortraitBGBlueDead, "color_portrait_bg_blue_dead", "44 49 51 255" );
  39. CPanelAnimationVar( Color, m_ColorBarHealthHigh, "color_bar_health_high", "84 191 58 255" );
  40. CPanelAnimationVar( float, m_flPercentageHealthMed, "percentage_health_med", "0.6" );
  41. CPanelAnimationVar( Color, m_ColorBarHealthMed, "color_bar_health_med", "191 183 58 255" );
  42. CPanelAnimationVar( float, m_flPercentageHealthLow, "percentage_health_low", "0.3" );
  43. CPanelAnimationVar( Color, m_ColorBarHealthLow, "color_bar_health_low", "191 58 58 255" );
  44. CPanelAnimationVar( Color, m_ColorPortraitBlendDeadRed, "color_portrait_blend_dead_red", "255 255 255 255" );
  45. CPanelAnimationVar( Color, m_ColorPortraitBlendDeadBlue, "color_portrait_blend_dead_blue", "255 255 255 255" );
  46. };
  47. //-----------------------------------------------------------------------------
  48. // Purpose:
  49. //-----------------------------------------------------------------------------
  50. class CTFTeamStatus : public vgui::EditablePanel
  51. {
  52. DECLARE_CLASS_SIMPLE( CTFTeamStatus, vgui::EditablePanel );
  53. public:
  54. CTFTeamStatus( Panel *parent, const char *panelName );
  55. ~CTFTeamStatus();
  56. virtual void ApplySettings( KeyValues *inResourceData ) OVERRIDE;
  57. virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
  58. virtual void PerformLayout( void ) OVERRIDE;
  59. virtual void OnTick() OVERRIDE;
  60. void Reset();
  61. bool ShouldDraw( void );
  62. enum EGrowDir
  63. {
  64. GROW_EAST = 0,
  65. GROW_WEST
  66. };
  67. protected:
  68. CTFTeamStatusPlayerPanel *GetOrAddPanel( int iPanelIndex );
  69. void RecalculatePlayerPanels( void );
  70. void UpdatePlayerPanels( void );
  71. protected:
  72. CUtlVector<CTFTeamStatusPlayerPanel*> m_PlayerPanels;
  73. KeyValues *m_pPlayerPanelKVs;
  74. bool m_bReapplyPlayerPanelKVs;
  75. CPanelAnimationVarAliasType( int, m_iMaxSize, "max_size", "19", "proportional_int" );
  76. CPanelAnimationVarAliasType( int, m_i6v6Gap, "6v6_gap", "19", "proportional_int" );
  77. CPanelAnimationVarAliasType( int, m_i12v12Gap, "12v12_gap", "9", "proportional_int" );
  78. EGrowDir m_eTeam1GrowDir;
  79. CPanelAnimationVarAliasType( int, m_iTeam1BaseX, "team1_base_x", "0", "proportional_xpos" );
  80. CPanelAnimationVarAliasType( int, m_iTeam1MaxExpand, "team1_max_expand", "0", "proportional_int" );
  81. EGrowDir m_eTeam2GrowDir;
  82. CPanelAnimationVarAliasType( int, m_iTeam2BaseX, "team2_base_x", "0", "proportional_xpos" );
  83. CPanelAnimationVarAliasType( int, m_iTeam2MaxExpand, "team2_max_expand", "0", "proportional_int" );
  84. };
  85. #endif // TF_TEAMSTATUS_H