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.

82 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef SERVERBROWSER_H
  8. #define SERVERBROWSER_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. class CServerBrowserDialog;
  13. //-----------------------------------------------------------------------------
  14. // Purpose: Handles the UI and pinging of a half-life game server list
  15. //-----------------------------------------------------------------------------
  16. class CServerBrowser : public IServerBrowser, public IVGuiModule
  17. {
  18. public:
  19. CServerBrowser();
  20. ~CServerBrowser();
  21. // IVGui module implementation
  22. virtual bool Initialize(CreateInterfaceFn *factorylist, int numFactories);
  23. virtual bool PostInitialize(CreateInterfaceFn *modules, int factoryCount);
  24. virtual vgui::VPANEL GetPanel();
  25. virtual bool Activate();
  26. virtual bool IsValid();
  27. virtual void Shutdown();
  28. virtual void Deactivate();
  29. virtual void Reactivate();
  30. virtual void SetParent(vgui::VPANEL parent);
  31. // IServerBrowser implementation
  32. // joins a specified game - game info dialog will only be opened if the server is fully or passworded
  33. virtual bool JoinGame( uint32 unGameIP, uint16 usGamePort, const char *pszConnectCode );
  34. virtual bool JoinGame( uint64 ulSteamIDFriend, const char *pszConnectCode );
  35. // opens a game info dialog to watch the specified server; associated with the friend 'userName'
  36. virtual bool OpenGameInfoDialog( uint64 ulSteamIDFriend, const char *pszConnectCode );
  37. // forces the game info dialog closed
  38. virtual void CloseGameInfoDialog( uint64 ulSteamIDFriend );
  39. // closes all the game info dialogs
  40. virtual void CloseAllGameInfoDialogs();
  41. virtual const char *GetMapFriendlyNameAndGameType( const char *pszMapName, char *szFriendlyMapName, int cchFriendlyName ) OVERRIDE;
  42. // methods
  43. virtual void CreateDialog();
  44. virtual void Open();
  45. // true if the user can't play a game
  46. bool IsVACBannedFromGame( int nAppID );
  47. // Enable filtering of workshop maps, requires the game/tool loading us to feed subscription data. This is a
  48. // slightly ugly workaround to TF2 not yet having native workshop UI in quickplay, once that is in place this should
  49. // either be stripped back out or expanded to be directly aware of the steam workshop without being managed.
  50. virtual void SetWorkshopEnabled( bool bManaged ) OVERRIDE;
  51. virtual void AddWorkshopSubscribedMap( const char *pszMapName ) OVERRIDE;
  52. virtual void RemoveWorkshopSubscribedMap( const char *pszMapName ) OVERRIDE;
  53. bool IsWorkshopEnabled();
  54. bool IsWorkshopSubscribedMap( const char *pszMapName );
  55. private:
  56. vgui::DHANDLE<CServerBrowserDialog> m_hInternetDlg;
  57. bool m_bWorkshopEnabled;
  58. CUtlVector< CUtlString > m_vecWorkshopSubscribedMaps;
  59. };
  60. // singleton accessor
  61. CServerBrowser &ServerBrowser();
  62. class CSteamAPIContext;
  63. extern CSteamAPIContext *steamapicontext;
  64. #endif // SERVERBROWSER_H