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.

165 lines
5.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef TF_HUD_TOURNAMENT_H
  8. #define TF_HUD_TOURNAMENT_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tf_clientscoreboard.h"
  13. #include "tf_playerpanel.h"
  14. #include "basemodelpanel.h"
  15. class CTFHudTimeStatus;
  16. class CHudTournament : public CHudElement, public EditablePanel
  17. {
  18. DECLARE_CLASS_SIMPLE( CHudTournament, EditablePanel );
  19. public:
  20. CHudTournament( const char *pElementName );
  21. ~CHudTournament();
  22. virtual void Init( void );
  23. virtual void OnTick( void );
  24. virtual void LevelInit( void );
  25. virtual void ApplySettings( KeyValues *inResourceData );
  26. virtual void ApplySchemeSettings( IScheme *scheme );
  27. virtual void SetVisible( bool state );
  28. virtual void PerformLayout( void );
  29. virtual void FireGameEvent( IGameEvent * event );
  30. void PreparePanel( void );
  31. void PlaySounds( int nTime );
  32. virtual bool ShouldDraw( void ) { return m_bShouldBeVisible; }
  33. private:
  34. void RecalculatePlayerPanels( void );
  35. void UpdatePlayerPanels( void );
  36. void SetPlayerPanelsVisible( bool bVisible );
  37. CTFPlayerPanel *GetOrAddPanel( int iPanelIndex );
  38. void InitPlayerList( SectionedListPanel *pPlayerList, int nTeam );
  39. static bool TFPlayerSortFunc( vgui::SectionedListPanel *list, int itemID1, int itemID2 );
  40. void UpdatePlayerList();
  41. void UpdatePlayerAvatar( int playerIndex, KeyValues *kv );
  42. void UpdateTeamInfo();
  43. private:
  44. Label *m_pTournamentLabel;
  45. Label *m_pReasonLabel;
  46. bool m_bShouldBeVisible;
  47. float m_flNextUpdate;
  48. bool m_bTeamReady[MAX_TEAMS];
  49. bool m_bReadyStatusMode;
  50. bool m_bCompetitiveMode;
  51. bool m_bReadyTextBlinking;
  52. bool m_bCountDownVisible;
  53. CUtlVector<CTFPlayerPanel*> m_PlayerPanels;
  54. KeyValues *m_pPlayerPanelKVs;
  55. bool m_bReapplyPlayerPanelKVs;
  56. vgui::DHANDLE< CTFClientScoreBoardDialog > m_pScoreboard;
  57. vgui::ScalableImagePanel *m_pCountdownBG;
  58. CExLabel *m_pCountdownLabel;
  59. CExLabel *m_pCountdownLabelShadow;
  60. vgui::ImagePanel *m_pModeImage;
  61. vgui::ScalableImagePanel *m_pHudTournamentBG;
  62. CExLabel *m_pTournamentConditionLabel;
  63. CPanelAnimationVarAliasType( int, m_iTeam1PlayerBaseOffsetX, "team1_player_base_offset_x", "0", "proportional_int" );
  64. CPanelAnimationVarAliasType( int, m_iTeam1PlayerBaseX, "team1_player_base_x", "0", "proportional_int" );
  65. CPanelAnimationVarAliasType( int, m_iTeam1PlayerBaseY, "team1_player_base_y", "0", "proportional_int" );
  66. CPanelAnimationVarAliasType( int, m_iTeam2PlayerBaseX, "team2_player_base_x", "0", "proportional_int" );
  67. CPanelAnimationVarAliasType( int, m_iTeam2PlayerBaseOffsetX, "team2_player_base_offset_x", "0", "proportional_int" );
  68. CPanelAnimationVarAliasType( int, m_iTeam2PlayerBaseY, "team2_player_base_y", "0", "proportional_int" );
  69. CPanelAnimationVarAliasType( int, m_iTeam1PlayerDeltaX, "team1_player_delta_x", "0", "proportional_int" );
  70. CPanelAnimationVarAliasType( int, m_iTeam1PlayerDeltaY, "team1_player_delta_y", "0", "proportional_int" );
  71. CPanelAnimationVarAliasType( int, m_iTeam2PlayerDeltaX, "team2_player_delta_x", "0", "proportional_int" );
  72. CPanelAnimationVarAliasType( int, m_iTeam2PlayerDeltaY, "team2_player_delta_y", "0", "proportional_int" );
  73. CPanelAnimationVarAliasType( int, m_iTeamsPlayerDeltaXComp, "teams_player_delta_x_comp", "0", "proportional_int" );
  74. };
  75. class CHudTournamentSetup : public CHudElement, public EditablePanel
  76. {
  77. DECLARE_CLASS_SIMPLE( CHudTournamentSetup, EditablePanel );
  78. public:
  79. CHudTournamentSetup( const char *pElementName );
  80. virtual void Init( void );
  81. virtual void OnTick( void );
  82. virtual void LevelInit( void );
  83. virtual void ApplySchemeSettings( IScheme *scheme );
  84. virtual bool ShouldDraw( void );
  85. virtual void FireGameEvent( IGameEvent * event );
  86. void EnableInput( void );
  87. void DisableInput( void );
  88. bool ToggleState( ButtonCode_t code );
  89. virtual void OnCommand( const char *command );
  90. virtual void OnKeyCodeTyped(vgui::KeyCode code)
  91. {
  92. if ( code == KEY_ESCAPE || code == KEY_F4 || code == KEY_ENTER )
  93. {
  94. ToggleState( code );
  95. }
  96. else
  97. {
  98. BaseClass::OnKeyCodeTyped( code );
  99. }
  100. }
  101. private:
  102. TextEntry *m_pNameEntry;
  103. CTFImagePanel *m_pEntryBG;
  104. CExButton *m_pReadyButton;
  105. CExButton *m_pNotReadyButton;
  106. vgui::Label *m_pTeamNameLabel;
  107. float m_flNextThink;
  108. };
  109. class CHudStopWatch : public CHudElement, public EditablePanel
  110. {
  111. DECLARE_CLASS_SIMPLE( CHudStopWatch, EditablePanel );
  112. public:
  113. CHudStopWatch( const char *pElementName );
  114. virtual void LevelInit( void );
  115. virtual void ApplySchemeSettings( IScheme *pScheme );
  116. virtual void OnTick( void );
  117. virtual bool ShouldDraw( void );
  118. virtual void FireGameEvent( IGameEvent * event );
  119. private:
  120. CTFHudTimeStatus *m_pTimePanel;
  121. CExLabel *m_pStopWatchLabel;
  122. CExLabel *m_pStopWatchScore;
  123. CExLabel *m_pStopWatchPointsLabel;
  124. ImagePanel *m_pStopWatchImage;
  125. CExLabel *m_pStopWatchDescriptionLabel;
  126. Panel *m_pStopWatchDescriptionBG;
  127. bool m_bShouldBeVisible;
  128. };
  129. #endif // TF_HUD_TOURNAMENT_H