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.

107 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef TF_DUCKLEADERBOARD_H
  8. #define TF_DUCKLEADERBOARD_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #ifdef CLIENT_DLL
  13. #include "tf_mapinfo.h"
  14. #include "tf_leaderboardpanel.h"
  15. #include "tf_controls.h"
  16. #endif
  17. extern const char* g_szDuckLeaderboardNames[];
  18. #define TF_DUCK_ID "DUCK_ID"
  19. #define DUCK_XP_SCALE 5000
  20. #define DUCK_XP_WEIGHT_GENERATION 3
  21. #define DUCK_XP_WEIGHT_OFFENSE 3
  22. #define DUCK_XP_WEIGHT_DEFENSE 1
  23. #define DUCK_XP_WEIGHT_OBJECTIVE 3
  24. #define DUCK_XP_WEIGHT_TEAMMATE 3
  25. #define DUCK_XP_WEIGHT_BONUS 50
  26. enum EDuckLeaderboardTypes
  27. {
  28. TF_DUCK_SCORING_OVERALL_RATING = 0,
  29. TF_DUCK_SCORING_PERSONAL_GENERATION,
  30. TF_DUCK_SCORING_PERSONAL_PICKUP_OFFENSE,
  31. TF_DUCK_SCORING_PERSONAL_PICKUP_DEFENDED,
  32. TF_DUCK_SCORING_PERSONAL_PICKUP_OBJECTIVE,
  33. TF_DUCK_SCORING_TEAM_PICKUP_MY_DUCKS,
  34. TF_DUCK_SCORING_PERSONAL_BONUS_PICKUP,
  35. DUCK_NUM_LEADERBOARDS
  36. };
  37. enum EDuckEventTypes
  38. {
  39. DUCK_CREATED = 1,
  40. DUCK_COLLECTED,
  41. };
  42. enum EDuckFlags
  43. {
  44. DUCK_FLAG_OBJECTIVE = 1 << 0,
  45. DUCK_FLAG_BONUS = 1 << 1
  46. };
  47. #ifdef CLIENT_DLL
  48. class CDucksLeaderboard : public CTFLeaderboardPanel
  49. {
  50. DECLARE_CLASS_SIMPLE( CDucksLeaderboard, CTFLeaderboardPanel );
  51. public:
  52. CDucksLeaderboard( Panel *parent, const char *panelName, const char *pszDuckLeaderboardname );
  53. virtual ~CDucksLeaderboard();
  54. virtual void ApplySchemeSettings( IScheme *pScheme ) OVERRIDE;
  55. private:
  56. virtual bool UpdateLeaderboards() OVERRIDE;
  57. virtual bool GetLeaderboardData( CUtlVector< LeaderboardEntry_t* >& scores ) OVERRIDE;
  58. const char *m_pszDuckLeaderboardName;
  59. CTFTextToolTip *m_pToolTip;
  60. vgui::EditablePanel *m_pToolTipEmbeddedPanel;
  61. };
  62. class CDucksLeaderboardManager : public EditablePanel, CGameEventListener
  63. {
  64. DECLARE_CLASS_SIMPLE( CDucksLeaderboardManager, EditablePanel );
  65. public:
  66. CDucksLeaderboardManager( Panel *parent, const char *panelName );
  67. virtual void ApplySchemeSettings( IScheme *pScheme ) OVERRIDE;
  68. virtual void ApplySettings( KeyValues *inResourceData ) OVERRIDE;
  69. virtual void OnCommand( const char *command ) OVERRIDE;
  70. virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;
  71. virtual void OnThink();
  72. private:
  73. void NextPage();
  74. void PrevPage();
  75. void ShowPage( int nPage );
  76. int m_nCurrentPage;
  77. CUtlVector< EditablePanel* > m_vecLeaderboards;
  78. CTFTextToolTip *m_pToolTip;
  79. vgui::EditablePanel *m_pToolTipEmbeddedPanel;
  80. vgui::EditablePanel *m_pDimmer;
  81. float m_flFadeStartTime;
  82. CPanelAnimationVarAliasType( int, m_iScoreStep, "score_step", "0", "proportional_int" );
  83. };
  84. #endif
  85. #endif // TF_DUCKLEADERBOARD_H