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.

121 lines
4.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef IGAMEUI_H
  8. #define IGAMEUI_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "interface.h"
  13. #include "vgui/IPanel.h"
  14. #if !defined( _X360 )
  15. #include "xbox/xboxstubs.h"
  16. #endif
  17. // reasons why the user can't connect to a game server
  18. enum ESteamLoginFailure
  19. {
  20. STEAMLOGINFAILURE_NONE,
  21. STEAMLOGINFAILURE_BADTICKET,
  22. STEAMLOGINFAILURE_NOSTEAMLOGIN,
  23. STEAMLOGINFAILURE_VACBANNED,
  24. STEAMLOGINFAILURE_LOGGED_IN_ELSEWHERE
  25. };
  26. enum ESystemNotify
  27. {
  28. SYSTEMNOTIFY_STORAGEDEVICES_CHANGED,
  29. SYSTEMNOTIFY_USER_SIGNEDIN,
  30. SYSTEMNOTIFY_USER_SIGNEDOUT,
  31. SYSTEMNOTIFY_XUIOPENING,
  32. SYSTEMNOTIFY_XUICLOSED,
  33. SYSTEMNOTIFY_INVITE_SHUTDOWN, // Cross-game invite is causing us to shutdown
  34. };
  35. //-----------------------------------------------------------------------------
  36. // Purpose: contains all the functions that the GameUI dll exports
  37. //-----------------------------------------------------------------------------
  38. abstract_class IGameUI
  39. {
  40. public:
  41. // initialization/shutdown
  42. virtual void Initialize( CreateInterfaceFn appFactory ) = 0;
  43. virtual void PostInit() = 0;
  44. // connect to other interfaces at the same level (gameui.dll/server.dll/client.dll)
  45. virtual void Connect( CreateInterfaceFn gameFactory ) = 0;
  46. virtual void Start() = 0;
  47. virtual void Shutdown() = 0;
  48. virtual void RunFrame() = 0;
  49. // notifications
  50. virtual void OnGameUIActivated() = 0;
  51. virtual void OnGameUIHidden() = 0;
  52. // OLD: Use OnConnectToServer2
  53. virtual void OLD_OnConnectToServer(const char *game, int IP, int port) = 0;
  54. virtual void OnDisconnectFromServer_OLD( uint8 eSteamLoginFailure, const char *username ) = 0;
  55. virtual void OnLevelLoadingStarted(bool bShowProgressDialog) = 0;
  56. virtual void OnLevelLoadingFinished(bool bError, const char *failureReason, const char *extendedReason) = 0;
  57. // level loading progress, returns true if the screen needs updating
  58. virtual bool UpdateProgressBar(float progress, const char *statusText) = 0;
  59. // Shows progress desc, returns previous setting... (used with custom progress bars )
  60. virtual bool SetShowProgressText( bool show ) = 0;
  61. // !!!!!!!!!members added after "GameUI011" initial release!!!!!!!!!!!!!!!!!!!
  62. virtual void ShowNewGameDialog( int chapter ) = 0;
  63. // Xbox 360
  64. virtual void SessionNotification( const int notification, const int param = 0 ) = 0;
  65. virtual void SystemNotification( const int notification ) = 0;
  66. virtual void ShowMessageDialog( const uint nType, vgui::Panel *pOwner ) = 0;
  67. virtual void UpdatePlayerInfo( uint64 nPlayerId, const char *pName, int nTeam, byte cVoiceState, int nPlayersNeeded, bool bHost ) = 0;
  68. virtual void SessionSearchResult( int searchIdx, void *pHostData, XSESSION_SEARCHRESULT *pResult, int ping ) = 0;
  69. virtual void OnCreditsFinished( void ) = 0;
  70. // inserts specified panel as background for level load dialog
  71. virtual void SetLoadingBackgroundDialog( vgui::VPANEL panel ) = 0;
  72. // Bonus maps interfaces
  73. virtual void BonusMapUnlock( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
  74. virtual void BonusMapComplete( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
  75. virtual void BonusMapChallengeUpdate( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest ) = 0;
  76. virtual void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName ) = 0;
  77. virtual void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold ) = 0;
  78. virtual void BonusMapDatabaseSave( void ) = 0;
  79. virtual int BonusMapNumAdvancedCompleted( void ) = 0;
  80. virtual void BonusMapNumMedals( int piNumMedals[ 3 ] ) = 0;
  81. virtual void OnConnectToServer2(const char *game, int IP, int connectionPort, int queryPort) = 0;
  82. // X360 Storage device validation:
  83. // returns true right away if storage device has been previously selected.
  84. // otherwise returns false and will set the variable pointed by pStorageDeviceValidated to 1
  85. // once the storage device is selected by user.
  86. virtual bool ValidateStorageDevice( int *pStorageDeviceValidated ) = 0;
  87. virtual void SetProgressOnStart() = 0;
  88. virtual void OnDisconnectFromServer( uint8 eSteamLoginFailure ) = 0;
  89. virtual void OnConfirmQuit( void ) = 0;
  90. virtual bool IsMainMenuVisible( void ) = 0;
  91. // Client DLL is providing us with a panel that it wants to replace the main menu with
  92. virtual void SetMainMenuOverride( vgui::VPANEL panel ) = 0;
  93. // Client DLL is telling us that a main menu command was issued, probably from its custom main menu panel
  94. virtual void SendMainMenuCommand( const char *pszCommand ) = 0;
  95. };
  96. #define GAMEUI_INTERFACE_VERSION "GameUI011"
  97. #endif // IGAMEUI_H