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.

83 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef INTERNETGAMES_H
  8. #define INTERNETGAMES_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "BaseGamesPage.h"
  13. //-----------------------------------------------------------------------------
  14. // Purpose: Internet games list
  15. //-----------------------------------------------------------------------------
  16. class CInternetGames : public CBaseGamesPage
  17. {
  18. DECLARE_CLASS_SIMPLE( CInternetGames, CBaseGamesPage );
  19. public:
  20. CInternetGames( vgui::Panel *parent, const char *panelName = "InternetGames", EPageType eType = eInternetServer );
  21. ~CInternetGames();
  22. // property page handlers
  23. virtual void OnPageShow();
  24. // returns true if the game list supports the specified ui elements
  25. virtual bool SupportsItem(IGameList::InterfaceItem_e item);
  26. // gets a new server list
  27. MESSAGE_FUNC( GetNewServerList, "GetNewServerList" );
  28. // serverlist refresh responses
  29. virtual void ServerResponded( HServerListRequest hReq, int iServer );
  30. virtual void ServerFailedToRespond( HServerListRequest hReq, int iServer );
  31. virtual void RefreshComplete( HServerListRequest hReq, EMatchMakingServerResponse response );
  32. MESSAGE_FUNC_INT( OnRefreshServer, "RefreshServer", serverID );
  33. virtual int GetRegionCodeToFilter();
  34. virtual bool CheckTagFilter( gameserveritem_t &server );
  35. protected:
  36. // vgui overrides
  37. virtual void PerformLayout();
  38. virtual void OnTick();
  39. virtual const char *GetStringNoUnfilteredServers() { return "#ServerBrowser_NoInternetGames"; }
  40. virtual const char *GetStringNoUnfilteredServersOnMaster() { return "#ServerBrowser_MasterServerHasNoServersListed"; }
  41. virtual const char *GetStringNoServersResponded() { return "#ServerBrowser_NoInternetGamesResponded"; }
  42. private:
  43. // Called once per frame to see if sorting needs to occur again
  44. void CheckRedoSort();
  45. // Called once per frame to check re-send request to master server
  46. void CheckRetryRequest( ESteamServerType serverType );
  47. // opens context menu (user right clicked on a server)
  48. MESSAGE_FUNC_INT( OnOpenContextMenu, "OpenContextMenu", itemID );
  49. struct regions_s
  50. {
  51. CUtlSymbol name;
  52. unsigned char code;
  53. };
  54. CUtlVector<struct regions_s> m_Regions; // list of the different regions you can query for
  55. float m_fLastSort; // Time of last re-sort
  56. bool m_bDirty; // Has the list been modified, thereby needing re-sort
  57. bool m_bRequireUpdate; // checks whether we need an update upon opening
  58. // error cases for if no servers are listed
  59. bool m_bAnyServersRetrievedFromMaster;
  60. bool m_bAnyServersRespondedToQuery;
  61. bool m_bNoServersListedOnMaster;
  62. bool m_bOfflineMode;
  63. };
  64. #endif // INTERNETGAMES_H