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.

139 lines
4.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef TF_LOBBYPANEL_COMP_H
  7. #define TF_LOBBYPANEL_COMP_H
  8. #include "cbase.h"
  9. #include "game/client/iviewport.h"
  10. #include "tf_lobbypanel.h"
  11. #include "tf_leaderboardpanel.h"
  12. #include "local_steam_shared_object_listener.h"
  13. // memdbgon must be the last include file in a .cpp file!!!
  14. #include <tier0/memdbgon.h>
  15. using namespace GCSDK;
  16. class CBaseLobbyPanel;
  17. namespace vgui
  18. {
  19. class ScrollableEditablePanel;
  20. };
  21. //-----------------------------------------------------------------------------
  22. // Purpose:
  23. //-----------------------------------------------------------------------------
  24. class CLadderLobbyLeaderboard : public CTFLeaderboardPanel
  25. {
  26. DECLARE_CLASS_SIMPLE( CLadderLobbyLeaderboard, CTFLeaderboardPanel );
  27. public:
  28. CLadderLobbyLeaderboard( Panel *pParent, const char *pszPanelName );
  29. //-----------------------------------------------------------------------------
  30. // Purpose: Create leaderboard panels
  31. //-----------------------------------------------------------------------------
  32. virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
  33. virtual void PerformLayout() OVERRIDE;
  34. virtual void OnCommand( const char *command ) OVERRIDE;
  35. virtual bool GetLeaderboardData( CUtlVector< LeaderboardEntry_t* >& scores );
  36. virtual bool UpdateLeaderboards();
  37. void SetLeaderboard( const char *pszLeaderboardName, bool bGlobal );
  38. const char *GetLeaderboardName() const { return m_pszLeaderboardName; }
  39. bool IsDataValid( void ) { return m_bIsDataValid; }
  40. private:
  41. const char *m_pszLeaderboardName;
  42. bool m_bGlobal;
  43. bool m_bIsDataValid;
  44. vgui::ScrollableEditablePanel *m_pScoreListScroller;
  45. EditablePanel *m_pScoreList;
  46. CTFTextToolTip *m_pToolTip;
  47. vgui::EditablePanel *m_pToolTipEmbeddedPanel;
  48. };
  49. //-----------------------------------------------------------------------------
  50. // Purpose:
  51. //-----------------------------------------------------------------------------
  52. class CLobbyPanel_Comp : public CBaseLobbyPanel, public CLocalSteamSharedObjectListener
  53. {
  54. DECLARE_CLASS_SIMPLE( CLobbyPanel_Comp, CBaseLobbyPanel );
  55. public:
  56. CLobbyPanel_Comp( vgui::Panel *pParent, CBaseLobbyContainerFrame* pLobbyContainer );
  57. virtual ~CLobbyPanel_Comp();
  58. //
  59. // Panel overrides
  60. //
  61. virtual void PerformLayout() OVERRIDE;
  62. virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
  63. virtual void OnCommand( const char *command ) OVERRIDE;
  64. virtual EMatchGroup GetMatchGroup( void ) const OVERRIDE;
  65. virtual void SOCreated( const CSteamID & steamIDOwner, const CSharedObject *pObject, ESOCacheEvent eEvent ) OVERRIDE;
  66. virtual void SOUpdated( const CSteamID & steamIDOwner, const CSharedObject *pObject, ESOCacheEvent eEvent ) OVERRIDE;
  67. virtual void OnThink() OVERRIDE;
  68. //
  69. // CGameEventListener overrides
  70. //
  71. virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;
  72. private:
  73. virtual bool ShouldShowLateJoin() const OVERRIDE;
  74. virtual void ApplyChatUserSettings( const LobbyPlayerInfo &player,KeyValues *pKV ) const OVERRIDE;
  75. virtual const char* GetResFile() const OVERRIDE { return "Resource/UI/LobbyPanel_Comp.res"; }
  76. CPanelAnimationVarAliasType( int, m_iStatMedalWidth, "stat_medal_width", "14", "proportional_int" );
  77. CPanelAnimationVarAliasType( int, m_iMedalCountWidth, "stat_medal_count_width", "20", "proportional_int" );
  78. CPanelAnimationVarAliasType( int, m_iHasPassWidth, "has_pass_width", "12", "proportional_int" );
  79. CUtlVector<vgui::Label *> m_vecSearchCriteriaLabels;
  80. // leaderboards
  81. CLadderLobbyLeaderboard *m_pCompetitiveModeLeaderboard;
  82. vgui::HFont m_fontMedalsCount;
  83. enum EMatchHistorySortMethods_t
  84. {
  85. SORT_BY_RESULT = 0,
  86. SORT_BY_DATE,
  87. SORT_BY_MAP,
  88. SORT_BY_KDR,
  89. NUM_SORT_METHODS
  90. };
  91. CScrollableList* m_pMatchHistoryScroller;
  92. EMatchHistorySortMethods_t m_eMatchSortMethod;
  93. bool m_bDescendingMatchHistorySort;
  94. float m_flCompetitiveRankProgress;
  95. float m_flCompetitiveRankPrevProgress;
  96. float m_flRefreshPlayerListTime;
  97. bool m_bCompetitiveRankChangePlayedSound;
  98. bool m_bMatchHistoryLoaded;
  99. void WriteGameSettingsControls() OVERRIDE;
  100. int GetMedalCountForStat( EMatchGroup unLadderType, RankStatType_t nStatType, int nMedalLevel );
  101. void UpdateMatchDataForLocalPlayer();
  102. bool m_bMatchDataForLocalPlayerDirty;
  103. };
  104. #endif //TF_LOBBYPANEL_COMP_H