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.

128 lines
4.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef ITEM_PICKUP_PANEL_H
  8. #define ITEM_PICKUP_PANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Panel.h>
  13. #include <vgui_controls/Frame.h>
  14. #include "GameEventListener.h"
  15. #include "basemodel_panel.h"
  16. #include "basemodelpanel.h"
  17. #include "econ_item_inventory.h"
  18. #include "econ_item_view.h"
  19. #include "item_model_panel.h"
  20. #include "vgui_controls/TextEntry.h"
  21. #include "econ_controls.h"
  22. class CEconItemView;
  23. class CBackpackPanel;
  24. #define ITEMPICKUP_NUM_MODELPANELS 5 // 1 in the center of the screen, 2 to each side to handle smooth sliding.
  25. #define ITEMPICKUP_MODELPANEL_CENTER 2 // Panel that's in the center of the queue
  26. //-----------------------------------------------------------------------------
  27. // Purpose:
  28. //-----------------------------------------------------------------------------
  29. class CItemPickupPanel : public vgui::Frame, public CGameEventListener
  30. {
  31. DECLARE_CLASS_SIMPLE( CItemPickupPanel, vgui::Frame );
  32. public:
  33. CItemPickupPanel( Panel *parent );
  34. virtual ~CItemPickupPanel();
  35. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  36. virtual void ApplySettings( KeyValues *inResourceData );
  37. virtual void PerformLayout( void );
  38. virtual void OnCommand( const char *command );
  39. virtual void ShowPanel( bool bShow );
  40. virtual void FireGameEvent( IGameEvent *event );
  41. virtual void OnKeyCodeTyped( vgui::KeyCode code );
  42. virtual void OnKeyCodePressed( vgui::KeyCode code );
  43. void AddItem( CEconItemView *pItem );
  44. void SetReturnToGame( bool bReturn ) { m_bReturnToGame = bReturn; }
  45. #ifdef DEBUG
  46. void DebugRandomizePickupMethods( void ) { m_bRandomizePickupMethods = true; }
  47. #endif
  48. MESSAGE_FUNC_PARAMS( OnConfirmDelete, "ConfirmDlgResult", data );
  49. protected:
  50. virtual void UpdateModelPanels( void );
  51. virtual void AcknowledgeItems ( void );
  52. protected:
  53. int m_iSelectedItem;
  54. struct founditem_t
  55. {
  56. CEconItemView pItem;
  57. bool bDiscarded;
  58. };
  59. CUtlVector<founditem_t> m_aItems;
  60. CItemModelPanel *m_aModelPanels[ITEMPICKUP_NUM_MODELPANELS];
  61. vgui::Button *m_pNextButton;
  62. vgui::Button *m_pPrevButton;
  63. vgui::Button *m_pOpenLoadoutButton;
  64. CExButton *m_pCloseButton;
  65. CExImageButton *m_pDiscardButton;
  66. vgui::Label *m_pItemsFoundLabel;
  67. vgui::Label *m_pItemFoundMethod;
  68. KeyValues *m_pModelPanelsKV;
  69. vgui::EditablePanel *m_pConfirmDeleteDialog;
  70. vgui::Label *m_pDiscardedLabel;
  71. bool m_bRandomizePickupMethods;
  72. CSimplePanelToolTip *m_pToolTip;
  73. bool m_bReturnToGame;
  74. CPanelAnimationVarAliasType( float, m_iModelPanelSpacing, "modelpanels_spacing", "40", "proportional_float" );
  75. CPanelAnimationVarAliasType( float, m_iModelPanelW, "modelpanels_width", "128", "proportional_float" );
  76. CPanelAnimationVarAliasType( float, m_iModelPanelH, "modelpanels_height", "80", "proportional_float" );
  77. CPanelAnimationVarAliasType( float, m_iModelPanelY, "modelpanels_ypos", "120", "proportional_float" );
  78. };
  79. //-----------------------------------------------------------------------------
  80. // Purpose:
  81. //-----------------------------------------------------------------------------
  82. class CItemDiscardPanel : public vgui::Frame, public CGameEventListener
  83. {
  84. DECLARE_CLASS_SIMPLE( CItemDiscardPanel, vgui::Frame );
  85. public:
  86. CItemDiscardPanel( Panel *parent );
  87. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  88. virtual void PerformLayout( void );
  89. virtual void OnCommand( const char *command );
  90. virtual void ShowPanel( bool bShow );
  91. virtual void FireGameEvent( IGameEvent *event );
  92. virtual void OnKeyCodeTyped( vgui::KeyCode code );
  93. virtual void OnKeyCodePressed( vgui::KeyCode code );
  94. void SetItem( CEconItemView *pItem );
  95. MESSAGE_FUNC_PARAMS( OnConfirmDelete, "ConfirmDlgResult", data );
  96. protected:
  97. CItemModelPanel *m_pModelPanel;
  98. CBackpackPanel *m_pBackpackPanel;
  99. vgui::EditablePanel *m_pConfirmDeleteDialog;
  100. vgui::Label *m_pDiscardedLabel;
  101. vgui::Label *m_pDiscardedLabelCarat;
  102. bool m_bDiscardedNewItem;
  103. bool m_bMadeRoom;
  104. CExButton *m_pDiscardButton;
  105. CExButton *m_pCloseButton;
  106. CSimplePanelToolTip *m_pItemToolTip;
  107. CItemModelPanel *m_pItemMouseOverPanel;
  108. };
  109. #endif // ITEM_PICKUP_PANEL_H