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.

99 lines
3.0 KiB

  1. #ifndef TF_WARINFOPANEL_H
  2. #define TF_WARINFOPANEL_H
  3. #include "vgui_controls/EditablePanel.h"
  4. #include "tf_wardata.h"
  5. #include "vgui_controls/ProgressBar.h"
  6. #include "local_steam_shared_object_listener.h"
  7. using namespace vgui;
  8. using namespace GCSDK;
  9. class CExLabel;
  10. class CWarStandingPanel : public EditablePanel, public CGameEventListener
  11. {
  12. DECLARE_CLASS_SIMPLE( CWarStandingPanel, EditablePanel );
  13. public:
  14. CWarStandingPanel( Panel* pParent, const char* pszPanelname );
  15. virtual void ApplySchemeSettings( IScheme *pScheme ) OVERRIDE;
  16. virtual void ApplySettings( KeyValues *inResourceData ) OVERRIDE;
  17. virtual void OnThink() OVERRIDE;
  18. virtual void PerformLayout() OVERRIDE;
  19. virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;
  20. private:
  21. float GetPercentAnimated() const;
  22. struct TeamScore_t
  23. {
  24. TeamScore_t()
  25. : m_nLastScore( 0 )
  26. , m_nNewScore( 0 )
  27. , m_pTeamProgressBar( NULL )
  28. , m_pContainerPanel( NULL )
  29. , m_pTeamLabel( NULL )
  30. , m_pScoreLabel( NULL )
  31. {}
  32. int m_nLastScore;
  33. int m_nNewScore;
  34. ContinuousProgressBar *m_pTeamProgressBar;
  35. EditablePanel* m_pContainerPanel;
  36. CExLabel* m_pTeamLabel;
  37. CExLabel* m_pScoreLabel;
  38. };
  39. bool m_bNeedsLerp;
  40. TeamScore_t m_Scores[2];
  41. float m_flLastUpdateTime;
  42. ContinuousProgressBar *m_pTeam0ProgressBar;
  43. ContinuousProgressBar *m_pTeam1ProgressBar;
  44. CUtlString m_strWarName;
  45. };
  46. //-----------------------------------------------------------------------------
  47. // Purpose:
  48. //-----------------------------------------------------------------------------
  49. class CWarLandingPanel : public EditablePanel, public CLocalSteamSharedObjectListener
  50. {
  51. DECLARE_CLASS_SIMPLE( CWarLandingPanel, EditablePanel );
  52. public:
  53. CWarLandingPanel( Panel *pParent, const char *pszPanelName );
  54. virtual void ApplySchemeSettings( IScheme *pScheme ) OVERRIDE;
  55. virtual void ApplySettings( KeyValues *inResourceData );
  56. virtual void OnCommand( const char *pCommand ) OVERRIDE;
  57. virtual void OnThink() OVERRIDE;
  58. virtual void PerformLayout() OVERRIDE;
  59. virtual void SOCreated( const CSteamID & steamIDOwner, const CSharedObject *pObject, ESOCacheEvent eEvent ) { UpdateWarStatus( steamIDOwner, pObject, eEvent ); }
  60. virtual void SOUpdated( const CSteamID & steamIDOwner, const CSharedObject *pObject, ESOCacheEvent eEvent ) { UpdateWarStatus( steamIDOwner, pObject, eEvent ); }
  61. virtual void SODestroyed( const CSteamID & steamIDOwner, const CSharedObject *pObject, ESOCacheEvent eEvent ) { UpdateWarStatus( steamIDOwner, pObject, eEvent ); }
  62. virtual void SetVisible( bool bVisible ) OVERRIDE;
  63. private:
  64. enum EJoiningState_t
  65. {
  66. NO_ACTION = 0,
  67. CONFIRM_SIDE_SELECTION,
  68. ATTEMPTING_TO_JOIN_AND_WAITING_FOR_RESPONSE,
  69. SUCCESS_RESPONSE_RECIEVED_WAITING_FOR_USER_CONFIRMATION,
  70. FAILED_RESPONSE_RECIEVED_WAITING_FOR_USER_CONFIRMATION,
  71. };
  72. void UpdateWarStatus( const CSteamID & steamIDOwner, const CSharedObject *pObject, ESOCacheEvent eEvent );
  73. void UpdateUIState();
  74. float m_flChoseTeamTime;
  75. war_side_t m_nPendingSide;
  76. war_side_t m_nLastKnownSide;
  77. CUtlString m_strSceneAnimName;
  78. EJoiningState_t m_eJoiningState;
  79. };
  80. #endif //TF_WARINFOPANEL_H