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.

135 lines
5.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CHARACTER_INFO_PANEL_H
  8. #define CHARACTER_INFO_PANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "econ_ui.h"
  13. #include "vgui_controls/PropertyDialog.h"
  14. #include "tf_shareddefs.h"
  15. #include "GameEventListener.h"
  16. #include "vgui_controls/Panel.h"
  17. #include "vgui_controls/PHandle.h"
  18. class CCharInfoLoadoutSubPanel;
  19. class CArmoryPanel;
  20. class CBackpackPanel;
  21. class CCraftingPanel;
  22. //-----------------------------------------------------------------------------
  23. // Purpose:
  24. //-----------------------------------------------------------------------------
  25. class CServerNotConnectedToSteamDialog : public vgui::EditablePanel
  26. {
  27. DECLARE_CLASS_SIMPLE( CServerNotConnectedToSteamDialog, vgui::EditablePanel );
  28. public:
  29. CServerNotConnectedToSteamDialog( vgui::Panel *pParent, const char *pElementName );
  30. virtual void ApplySchemeSettings( vgui::IScheme *scheme );
  31. virtual void OnCommand( const char *command );
  32. };
  33. //-----------------------------------------------------------------------------
  34. // Purpose:
  35. //-----------------------------------------------------------------------------
  36. class CCheatDetectionDialog : public vgui::EditablePanel
  37. {
  38. DECLARE_CLASS_SIMPLE( CCheatDetectionDialog, vgui::EditablePanel );
  39. public:
  40. CCheatDetectionDialog( vgui::Panel *pParent, const char *pElementName );
  41. virtual void ApplySchemeSettings( vgui::IScheme *scheme );
  42. virtual void OnCommand( const char *command );
  43. };
  44. //-----------------------------------------------------------------------------
  45. // Purpose:
  46. //-----------------------------------------------------------------------------
  47. class CCharacterInfoPanel : public vgui::PropertyDialog, public IEconRootUI, public CGameEventListener
  48. {
  49. DECLARE_CLASS_SIMPLE( CCharacterInfoPanel, vgui::PropertyDialog );
  50. public:
  51. CCharacterInfoPanel( Panel *parent );
  52. virtual ~CCharacterInfoPanel();
  53. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  54. virtual void PerformLayout( void );
  55. virtual void OnCommand( const char *command );
  56. virtual void ShowPanel( bool bShow );
  57. virtual void OnKeyCodeTyped(vgui::KeyCode code) OVERRIDE;
  58. virtual void OnKeyCodePressed(vgui::KeyCode code) OVERRIDE;
  59. virtual void OnThink();
  60. void OpenLoadoutToClass( int iClassIndex, bool bOpenClassLoadout );
  61. void OpenLoadoutToBackpack( void );
  62. void OpenLoadoutToCrafting( void );
  63. void OpenLoadoutToArmory( void );
  64. void SetCheckForRoomOnExit( bool bCheck ) { m_bCheckForRoomOnExit = bCheck; }
  65. void FireGameEvent( IGameEvent *event );
  66. CArmoryPanel *GetArmoryPanel( void );
  67. MESSAGE_FUNC_PARAMS( OnOpenArmoryDirect, "OpenArmoryDirect", data );
  68. //---------------------------------------
  69. // IEconRootUI
  70. virtual IEconRootUI *OpenEconUI( int iDirectToPage = 0, bool bCheckForInventorySpaceOnExit = false );
  71. virtual void CloseEconUI( void );
  72. virtual bool IsUIPanelVisible( EconBaseUIPanels_t iPanel );
  73. virtual void SetPreventClosure( bool bPrevent ) OVERRIDE;
  74. // Sub panel access.
  75. // These are panels that are parented to the root EconUI.
  76. virtual CBackpackPanel *GetBackpackPanel( void );
  77. virtual CCraftingPanel *GetCraftingPanel( void );
  78. // Gamestats access
  79. virtual void Gamestats_ItemTransaction( int eventID, CEconItemView *item, const char *pszReason = NULL, int iQuality = 0 );
  80. virtual void Gamestats_Store( int eventID, CEconItemView* item=NULL, const char* panelName=NULL,
  81. int classId=0, const cart_item_t* in_cartItem=NULL, int in_checkoutAttempts=0, const char* storeError=NULL, int in_totalPrice=0, int in_currencyCode=0 );
  82. virtual void SetExperimentValue( uint64 experimentValue );
  83. // Open separate economy panels (they're not parented to the root EconUI)
  84. // This is here so that games can customize the implementation of these panels.
  85. virtual CItemPickupPanel *OpenItemPickupPanel( void );
  86. virtual CItemDiscardPanel *OpenItemDiscardPanel( void );
  87. virtual void CreateStorePanel( void );
  88. virtual CStorePanel *OpenStorePanel( int iItemDef, bool bAddToCart );
  89. virtual CStorePanel *GetStorePanel( void );
  90. // When the root UI is closed, send an "EconUIClosed" message to pListener.
  91. virtual void AddPanelCloseListener( vgui::Panel *pListener );
  92. // The panel at which we want back to actually close the UI - defaults to the root panel - a negative value can be passed in for class loadout panels
  93. virtual void SetClosePanel( int iPanel );
  94. // Call this to set which team the class loadout should display
  95. virtual void SetDefaultTeam( int iTeam );
  96. private:
  97. void Close();
  98. void NotifyListenersOfCloseEvent();
  99. vgui::Panel *m_pNotificationsPresentPanel;
  100. CCharInfoLoadoutSubPanel *m_pLoadoutPanel;
  101. bool m_bCheckForRoomOnExit;
  102. bool m_bPreventClosure;
  103. int m_iClosePanel;
  104. int m_iDefaultTeam;
  105. CUtlVector< vgui::VPanelHandle > m_vecOnCloseListeners;
  106. };
  107. CCheatDetectionDialog *OpenCheatDetectionDialog( vgui::Panel *pParent, const char *pszCheatMessage );
  108. #endif // CHARACTER_INFO_PANEL_H