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.

136 lines
3.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef TF_TEAMMENU_H
  8. #define TF_TEAMMENU_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tf_controls.h"
  13. #include "tf_imagepanel.h"
  14. #include <teammenu.h>
  15. //-----------------------------------------------------------------------------
  16. // Purpose:
  17. //-----------------------------------------------------------------------------
  18. class CTFTeamButton : public CExButton
  19. {
  20. private:
  21. DECLARE_CLASS_SIMPLE( CTFTeamButton, CExButton );
  22. public:
  23. CTFTeamButton( vgui::Panel *parent, const char *panelName );
  24. void ApplySettings( KeyValues *inResourceData );
  25. void ApplySchemeSettings( vgui::IScheme *pScheme );
  26. void OnCursorExited();
  27. void OnCursorEntered();
  28. void OnTick( void );
  29. void SetDefaultAnimation( const char *pszName );
  30. private:
  31. bool IsTeamFull();
  32. void SendAnimation( const char *pszAnimation );
  33. void SetMouseEnteredState( bool state );
  34. private:
  35. char m_szModelPanel[64]; // the panel we'll send messages to
  36. int m_iTeam; // the team we're associated with (if any)
  37. float m_flHoverTimeToWait; // length of time to wait before reporting a "hover" message (-1 = no hover)
  38. float m_flHoverTime; // when should a "hover" message be sent?
  39. bool m_bMouseEntered; // used to track when the mouse is over a button
  40. bool m_bTeamDisabled; // used to keep track of whether our team is a valid team for selection
  41. };
  42. //-----------------------------------------------------------------------------
  43. // Purpose: Displays the team menu
  44. //-----------------------------------------------------------------------------
  45. class CTFTeamMenu : public CTeamMenu, public CGameEventListener
  46. {
  47. private:
  48. DECLARE_CLASS_SIMPLE( CTFTeamMenu, CTeamMenu );
  49. public:
  50. CTFTeamMenu( IViewPort *pViewPort );
  51. ~CTFTeamMenu();
  52. void Update();
  53. void ShowPanel( bool bShow );
  54. #ifdef _X360
  55. CON_COMMAND_MEMBER_F( CTFTeamMenu, "join_team", Join_Team, "Send a jointeam command", 0 );
  56. #endif
  57. bool IsBlueTeamDisabled(){ return m_bBlueDisabled; }
  58. bool IsRedTeamDisabled(){ return m_bRedDisabled; }
  59. // IGameEventListener interface:
  60. virtual void FireGameEvent( IGameEvent *event );
  61. protected:
  62. virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
  63. virtual void OnKeyCodePressed( vgui::KeyCode code );
  64. // command callbacks
  65. virtual void OnCommand( const char *command );
  66. virtual void OnClose();
  67. virtual void LoadMapPage( const char *mapName );
  68. virtual void OnTick( void );
  69. virtual void OnThink() OVERRIDE;
  70. private:
  71. void SetHighlanderTeamsFullPanels( bool bTeamsFull, bool bForce = false );
  72. void ActivateSelectIconHint( int focus_group_number );
  73. private:
  74. CTFTeamButton *m_pBlueTeamButton;
  75. CTFTeamButton *m_pRedTeamButton;
  76. CTFTeamButton *m_pAutoTeamButton;
  77. CTFTeamButton *m_pSpecTeamButton;
  78. CExLabel *m_pSpecLabel;
  79. #ifdef _X360
  80. CTFFooter *m_pFooter;
  81. #else
  82. CExButton *m_pCancelButton;
  83. CExLabel *m_pHighlanderLabel;
  84. CExLabel *m_pHighlanderLabelShadow;
  85. CExLabel *m_pTeamsFullLabel;
  86. CExLabel *m_pTeamsFullLabelShadow;
  87. CTFImagePanel *m_pTeamsFullArrow;
  88. CSCHintIcon *m_pCancelHintIcon;
  89. CSCHintIcon *m_pJoinBluHintIcon;
  90. CSCHintIcon *m_pJoinRedHintIcon;
  91. CSCHintIcon *m_pJoinAutoHintIcon;
  92. CSCHintIcon *m_pJoinSpectatorsHintIcon;
  93. #endif
  94. bool m_bRedDisabled;
  95. bool m_bBlueDisabled;
  96. private:
  97. enum { NUM_TEAMS = 3 };
  98. ButtonCode_t m_iTeamMenuKey;
  99. };
  100. #endif // TF_TEAMMENU_H