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.

132 lines
4.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef QUEST_LOG_PANEL_H
  8. #define QUEST_LOG_PANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "vgui_controls/EditablePanel.h"
  13. #include <game/client/iviewport.h>
  14. #include "quest_item_panel.h"
  15. using namespace vgui;
  16. //-----------------------------------------------------------------------------
  17. // Creates the quest log if it doesnt exists, and gives you a pointer to it
  18. //-----------------------------------------------------------------------------
  19. class CQuestLogPanel *GetQuestLog();
  20. //-----------------------------------------------------------------------------
  21. // A scrollable list of quest items
  22. //-----------------------------------------------------------------------------
  23. class CScrollableQuestList : public EditablePanel
  24. {
  25. DECLARE_CLASS_SIMPLE( CScrollableQuestList, EditablePanel );
  26. public:
  27. CScrollableQuestList( Panel *parent, const char *pszPanelName );
  28. virtual ~CScrollableQuestList();
  29. virtual void ApplySchemeSettings( IScheme *pScheme ) OVERRIDE;
  30. virtual void ApplySettings( KeyValues *inResourceData ) OVERRIDE;
  31. virtual void PerformLayout( void ) OVERRIDE;
  32. virtual void OnThink() OVERRIDE;
  33. virtual void OnCommand( const char *command ) OVERRIDE;
  34. void DirtyQuestLayout() { m_bQuestsLayoutDirty = true; }
  35. void PopulateQuestLists();
  36. void QuestCompletedResponse();
  37. bool AnyQuestItemPanelsInState( CQuestItemPanel::EItemPanelState_t eState ) const;
  38. void PositionQuestItemPanels();
  39. void SetSelected( CQuestItemPanel *pItem, bool bImmediately );
  40. void SetCompletingPanel( const CQuestItemPanel *pItem ) { m_pCompletingPanel = pItem; }
  41. const CQuestItemPanel *GetCompletingPanel() const { return m_pCompletingPanel; }
  42. void UpdateEmptyMessage();
  43. protected:
  44. bool m_bQuestsLayoutDirty;
  45. EditablePanel *m_pContainer;
  46. CUtlVector< CQuestItemPanel* > m_vecQuestItemPanels;
  47. CQuestItemPanel* m_spCompletingPanel;
  48. const CQuestItemPanel* m_pCompletingPanel;
  49. CUtlString m_pszNoQuests;
  50. CUtlString m_pszNeedAPass;
  51. CUtlString m_pszNotPossible;
  52. CPanelAnimationVarAliasType( int, m_iEntryStep, "entry_step", "0", "proportional_int" );
  53. CPanelAnimationVarAliasType( int, m_iEntryStartingX, "entry_x", "0", "proportional_int" );
  54. CPanelAnimationVarAliasType( int, m_iEntryStartingY, "entry_y", "0", "proportional_int" );
  55. };
  56. //-----------------------------------------------------------------------------
  57. // The default quest log panel
  58. //-----------------------------------------------------------------------------
  59. class CQuestLogPanel : public EditablePanel, public IViewPortPanel, public CGameEventListener
  60. {
  61. DECLARE_CLASS_SIMPLE( CQuestLogPanel, EditablePanel );
  62. public:
  63. CQuestLogPanel( IViewPort *pViewPort );
  64. virtual ~CQuestLogPanel();
  65. void AttachToGameUI();
  66. virtual const char *GetName( void ) OVERRIDE;
  67. virtual void SetData( KeyValues *data ) OVERRIDE {}
  68. virtual void Reset() OVERRIDE { Update(); SetVisible( true ); }
  69. virtual void Update() OVERRIDE { return; }
  70. virtual bool NeedsUpdate( void ) OVERRIDE { return false; }
  71. virtual bool HasInputElements( void ) OVERRIDE { return true; }
  72. virtual void ShowPanel( bool bShow ) OVERRIDE;
  73. // both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
  74. vgui::VPANEL GetVPanel( void ){ return BaseClass::GetVPanel(); }
  75. virtual bool IsVisible() OVERRIDE { return BaseClass::IsVisible(); }
  76. virtual void SetParent( vgui::VPANEL parent ) OVERRIDE { BaseClass::SetParent( parent ); }
  77. virtual void ApplySchemeSettings( IScheme *pScheme ) OVERRIDE;
  78. virtual void PerformLayout() OVERRIDE;
  79. virtual void OnCommand( const char *pCommand ) OVERRIDE;
  80. virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;
  81. virtual void SetVisible( bool bState ) OVERRIDE;
  82. virtual void OnKeyCodePressed( KeyCode code ) OVERRIDE;
  83. virtual void OnKeyCodeTyped(KeyCode code) OVERRIDE;
  84. virtual GameActionSet_t GetPreferredActionSet() { return GAME_ACTION_SET_NONE; }
  85. void QuestCompletedResponse();
  86. void UpdateQuestsItemPanels();
  87. void MarkQuestsDirty();
  88. void UpdateBadgeProgressPanels();
  89. bool AnyQuestItemPanelsInState( CQuestItemPanel::EItemPanelState_t eState ) const;
  90. MESSAGE_FUNC( OnCompleteQuest, "CompleteQuest" );
  91. private:
  92. CScrollableQuestList *m_pQuestList;
  93. class CItemModelPanel *m_pMouseOverItemPanel;
  94. class CItemModelPanelToolTip *m_pMouseOverTooltip;
  95. EditablePanel *m_pProgressPanel;
  96. class CQuestTooltip *m_pToolTip;
  97. EditablePanel *m_pToolTipEmbeddedPanel;
  98. ButtonCode_t m_iQuestLogKey;
  99. bool m_bWaitingForComplete;
  100. bool m_bInventoryDirty;
  101. Button *m_pDebugButton;
  102. };
  103. #endif // QUEST_LOG_PANEL_H