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.

80 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "cbase.h"
  7. #include "cs_achievements_and_stats_interface.h"
  8. #include "baseachievement.h"
  9. #include "GameEventListener.h"
  10. #include "hl2orange.spa.h"
  11. #include "iachievementmgr.h"
  12. #include "utlmap.h"
  13. #include "steam/steam_api.h"
  14. #include "vgui_controls/Panel.h"
  15. #include "vgui_controls/PHandle.h"
  16. #include "vgui_controls/MenuItem.h"
  17. #include "vgui_controls/MessageDialog.h"
  18. #include "cs_gamestats_shared.h"
  19. #include "../client/cstrike/VGUI/achievement_stats_summary.h"
  20. #include "vgui/IInput.h"
  21. #include "vgui/ILocalize.h"
  22. #include "vgui/IPanel.h"
  23. #include "vgui/ISurface.h"
  24. #include "vgui/ISystem.h"
  25. #include "vgui/IVGui.h"
  26. #if defined(CSTRIKE_DLL) && defined(CLIENT_DLL)
  27. CSAchievementsAndStatsInterface::CSAchievementsAndStatsInterface() : AchievementsAndStatsInterface()
  28. {
  29. m_pAchievementAndStatsSummary = NULL;
  30. g_pAchievementsAndStatsInterface = this;
  31. }
  32. void CSAchievementsAndStatsInterface::CreatePanel( vgui::Panel* pParent )
  33. {
  34. // Create achievement & stats dialog if not already created
  35. if ( !m_pAchievementAndStatsSummary )
  36. {
  37. m_pAchievementAndStatsSummary = new CAchievementAndStatsSummary(NULL);
  38. }
  39. if ( m_pAchievementAndStatsSummary )
  40. {
  41. m_pAchievementAndStatsSummary->SetParent(pParent);
  42. }
  43. }
  44. void CSAchievementsAndStatsInterface::DisplayPanel()
  45. {
  46. // Position & show dialog
  47. PositionDialog(m_pAchievementAndStatsSummary);
  48. m_pAchievementAndStatsSummary->Activate();
  49. //Make sure the top of the page appears on the screen (for video modes such as 1280x720).
  50. int x, y;
  51. m_pAchievementAndStatsSummary->GetPos( x, y );
  52. if ( y < 0 )
  53. {
  54. m_pAchievementAndStatsSummary->SetPos( x, 0 );
  55. }
  56. }
  57. void CSAchievementsAndStatsInterface::ReleasePanel()
  58. {
  59. // Make sure the BasePanel doesn't try to delete this, because it doesn't really own it.
  60. if ( m_pAchievementAndStatsSummary )
  61. {
  62. m_pAchievementAndStatsSummary->SetParent((vgui::Panel*)NULL);
  63. }
  64. }
  65. #endif