isteamgameserver.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. // This file is provided under The MIT License as part of Steamworks.NET.
  2. // Copyright (c) 2013-2019 Riley Labrecque
  3. // Please see the included LICENSE.txt for additional information.
  4. // This file is automatically generated.
  5. // Changes to this file will be reverted when you update Steamworks.NET
  6. #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH
  7. #define DISABLESTEAMWORKS
  8. #endif
  9. #if !DISABLESTEAMWORKS
  10. using System.Runtime.InteropServices;
  11. using IntPtr = System.IntPtr;
  12. namespace Steamworks {
  13. public static class SteamGameServer {
  14. /// <summary>
  15. /// <para> Basic server data. These properties, if set, must be set before before calling LogOn. They</para>
  16. /// <para> may not be changed after logged in.</para>
  17. /// <para>/ This is called by SteamGameServer_Init, and you will usually not need to call it directly</para>
  18. /// </summary>
  19. public static bool InitGameServer(uint unIP, ushort usGamePort, ushort usQueryPort, uint unFlags, AppId_t nGameAppId, string pchVersionString) {
  20. InteropHelp.TestIfAvailableGameServer();
  21. using (var pchVersionString2 = new InteropHelp.UTF8StringHandle(pchVersionString)) {
  22. return NativeMethods.ISteamGameServer_InitGameServer(CSteamGameServerAPIContext.GetSteamGameServer(), unIP, usGamePort, usQueryPort, unFlags, nGameAppId, pchVersionString2);
  23. }
  24. }
  25. /// <summary>
  26. /// <para>/ Game product identifier. This is currently used by the master server for version checking purposes.</para>
  27. /// <para>/ It's a required field, but will eventually will go away, and the AppID will be used for this purpose.</para>
  28. /// </summary>
  29. public static void SetProduct(string pszProduct) {
  30. InteropHelp.TestIfAvailableGameServer();
  31. using (var pszProduct2 = new InteropHelp.UTF8StringHandle(pszProduct)) {
  32. NativeMethods.ISteamGameServer_SetProduct(CSteamGameServerAPIContext.GetSteamGameServer(), pszProduct2);
  33. }
  34. }
  35. /// <summary>
  36. /// <para>/ Description of the game. This is a required field and is displayed in the steam server browser....for now.</para>
  37. /// <para>/ This is a required field, but it will go away eventually, as the data should be determined from the AppID.</para>
  38. /// </summary>
  39. public static void SetGameDescription(string pszGameDescription) {
  40. InteropHelp.TestIfAvailableGameServer();
  41. using (var pszGameDescription2 = new InteropHelp.UTF8StringHandle(pszGameDescription)) {
  42. NativeMethods.ISteamGameServer_SetGameDescription(CSteamGameServerAPIContext.GetSteamGameServer(), pszGameDescription2);
  43. }
  44. }
  45. /// <summary>
  46. /// <para>/ If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning</para>
  47. /// <para>/ this application is the original game, not a mod.</para>
  48. /// <para>/</para>
  49. /// <para>/ @see k_cbMaxGameServerGameDir</para>
  50. /// </summary>
  51. public static void SetModDir(string pszModDir) {
  52. InteropHelp.TestIfAvailableGameServer();
  53. using (var pszModDir2 = new InteropHelp.UTF8StringHandle(pszModDir)) {
  54. NativeMethods.ISteamGameServer_SetModDir(CSteamGameServerAPIContext.GetSteamGameServer(), pszModDir2);
  55. }
  56. }
  57. /// <summary>
  58. /// <para>/ Is this is a dedicated server? The default value is false.</para>
  59. /// </summary>
  60. public static void SetDedicatedServer(bool bDedicated) {
  61. InteropHelp.TestIfAvailableGameServer();
  62. NativeMethods.ISteamGameServer_SetDedicatedServer(CSteamGameServerAPIContext.GetSteamGameServer(), bDedicated);
  63. }
  64. /// <summary>
  65. /// <para> Login</para>
  66. /// <para>/ Begin process to login to a persistent game server account</para>
  67. /// <para>/</para>
  68. /// <para>/ You need to register for callbacks to determine the result of this operation.</para>
  69. /// <para>/ @see SteamServersConnected_t</para>
  70. /// <para>/ @see SteamServerConnectFailure_t</para>
  71. /// <para>/ @see SteamServersDisconnected_t</para>
  72. /// </summary>
  73. public static void LogOn(string pszToken) {
  74. InteropHelp.TestIfAvailableGameServer();
  75. using (var pszToken2 = new InteropHelp.UTF8StringHandle(pszToken)) {
  76. NativeMethods.ISteamGameServer_LogOn(CSteamGameServerAPIContext.GetSteamGameServer(), pszToken2);
  77. }
  78. }
  79. /// <summary>
  80. /// <para>/ Login to a generic, anonymous account.</para>
  81. /// <para>/</para>
  82. /// <para>/ Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init,</para>
  83. /// <para>/ but this is no longer the case.</para>
  84. /// </summary>
  85. public static void LogOnAnonymous() {
  86. InteropHelp.TestIfAvailableGameServer();
  87. NativeMethods.ISteamGameServer_LogOnAnonymous(CSteamGameServerAPIContext.GetSteamGameServer());
  88. }
  89. /// <summary>
  90. /// <para>/ Begin process of logging game server out of steam</para>
  91. /// </summary>
  92. public static void LogOff() {
  93. InteropHelp.TestIfAvailableGameServer();
  94. NativeMethods.ISteamGameServer_LogOff(CSteamGameServerAPIContext.GetSteamGameServer());
  95. }
  96. /// <summary>
  97. /// <para> status functions</para>
  98. /// </summary>
  99. public static bool BLoggedOn() {
  100. InteropHelp.TestIfAvailableGameServer();
  101. return NativeMethods.ISteamGameServer_BLoggedOn(CSteamGameServerAPIContext.GetSteamGameServer());
  102. }
  103. public static bool BSecure() {
  104. InteropHelp.TestIfAvailableGameServer();
  105. return NativeMethods.ISteamGameServer_BSecure(CSteamGameServerAPIContext.GetSteamGameServer());
  106. }
  107. public static CSteamID GetSteamID() {
  108. InteropHelp.TestIfAvailableGameServer();
  109. return (CSteamID)NativeMethods.ISteamGameServer_GetSteamID(CSteamGameServerAPIContext.GetSteamGameServer());
  110. }
  111. /// <summary>
  112. /// <para>/ Returns true if the master server has requested a restart.</para>
  113. /// <para>/ Only returns true once per request.</para>
  114. /// </summary>
  115. public static bool WasRestartRequested() {
  116. InteropHelp.TestIfAvailableGameServer();
  117. return NativeMethods.ISteamGameServer_WasRestartRequested(CSteamGameServerAPIContext.GetSteamGameServer());
  118. }
  119. /// <summary>
  120. /// <para> Server state. These properties may be changed at any time.</para>
  121. /// <para>/ Max player count that will be reported to server browser and client queries</para>
  122. /// </summary>
  123. public static void SetMaxPlayerCount(int cPlayersMax) {
  124. InteropHelp.TestIfAvailableGameServer();
  125. NativeMethods.ISteamGameServer_SetMaxPlayerCount(CSteamGameServerAPIContext.GetSteamGameServer(), cPlayersMax);
  126. }
  127. /// <summary>
  128. /// <para>/ Number of bots. Default value is zero</para>
  129. /// </summary>
  130. public static void SetBotPlayerCount(int cBotplayers) {
  131. InteropHelp.TestIfAvailableGameServer();
  132. NativeMethods.ISteamGameServer_SetBotPlayerCount(CSteamGameServerAPIContext.GetSteamGameServer(), cBotplayers);
  133. }
  134. /// <summary>
  135. /// <para>/ Set the name of server as it will appear in the server browser</para>
  136. /// <para>/</para>
  137. /// <para>/ @see k_cbMaxGameServerName</para>
  138. /// </summary>
  139. public static void SetServerName(string pszServerName) {
  140. InteropHelp.TestIfAvailableGameServer();
  141. using (var pszServerName2 = new InteropHelp.UTF8StringHandle(pszServerName)) {
  142. NativeMethods.ISteamGameServer_SetServerName(CSteamGameServerAPIContext.GetSteamGameServer(), pszServerName2);
  143. }
  144. }
  145. /// <summary>
  146. /// <para>/ Set name of map to report in the server browser</para>
  147. /// <para>/</para>
  148. /// <para>/ @see k_cbMaxGameServerName</para>
  149. /// </summary>
  150. public static void SetMapName(string pszMapName) {
  151. InteropHelp.TestIfAvailableGameServer();
  152. using (var pszMapName2 = new InteropHelp.UTF8StringHandle(pszMapName)) {
  153. NativeMethods.ISteamGameServer_SetMapName(CSteamGameServerAPIContext.GetSteamGameServer(), pszMapName2);
  154. }
  155. }
  156. /// <summary>
  157. /// <para>/ Let people know if your server will require a password</para>
  158. /// </summary>
  159. public static void SetPasswordProtected(bool bPasswordProtected) {
  160. InteropHelp.TestIfAvailableGameServer();
  161. NativeMethods.ISteamGameServer_SetPasswordProtected(CSteamGameServerAPIContext.GetSteamGameServer(), bPasswordProtected);
  162. }
  163. /// <summary>
  164. /// <para>/ Spectator server. The default value is zero, meaning the service</para>
  165. /// <para>/ is not used.</para>
  166. /// </summary>
  167. public static void SetSpectatorPort(ushort unSpectatorPort) {
  168. InteropHelp.TestIfAvailableGameServer();
  169. NativeMethods.ISteamGameServer_SetSpectatorPort(CSteamGameServerAPIContext.GetSteamGameServer(), unSpectatorPort);
  170. }
  171. /// <summary>
  172. /// <para>/ Name of the spectator server. (Only used if spectator port is nonzero.)</para>
  173. /// <para>/</para>
  174. /// <para>/ @see k_cbMaxGameServerMapName</para>
  175. /// </summary>
  176. public static void SetSpectatorServerName(string pszSpectatorServerName) {
  177. InteropHelp.TestIfAvailableGameServer();
  178. using (var pszSpectatorServerName2 = new InteropHelp.UTF8StringHandle(pszSpectatorServerName)) {
  179. NativeMethods.ISteamGameServer_SetSpectatorServerName(CSteamGameServerAPIContext.GetSteamGameServer(), pszSpectatorServerName2);
  180. }
  181. }
  182. /// <summary>
  183. /// <para>/ Call this to clear the whole list of key/values that are sent in rules queries.</para>
  184. /// </summary>
  185. public static void ClearAllKeyValues() {
  186. InteropHelp.TestIfAvailableGameServer();
  187. NativeMethods.ISteamGameServer_ClearAllKeyValues(CSteamGameServerAPIContext.GetSteamGameServer());
  188. }
  189. /// <summary>
  190. /// <para>/ Call this to add/update a key/value pair.</para>
  191. /// </summary>
  192. public static void SetKeyValue(string pKey, string pValue) {
  193. InteropHelp.TestIfAvailableGameServer();
  194. using (var pKey2 = new InteropHelp.UTF8StringHandle(pKey))
  195. using (var pValue2 = new InteropHelp.UTF8StringHandle(pValue)) {
  196. NativeMethods.ISteamGameServer_SetKeyValue(CSteamGameServerAPIContext.GetSteamGameServer(), pKey2, pValue2);
  197. }
  198. }
  199. /// <summary>
  200. /// <para>/ Sets a string defining the "gametags" for this server, this is optional, but if it is set</para>
  201. /// <para>/ it allows users to filter in the matchmaking/server-browser interfaces based on the value</para>
  202. /// <para>/</para>
  203. /// <para>/ @see k_cbMaxGameServerTags</para>
  204. /// </summary>
  205. public static void SetGameTags(string pchGameTags) {
  206. InteropHelp.TestIfAvailableGameServer();
  207. using (var pchGameTags2 = new InteropHelp.UTF8StringHandle(pchGameTags)) {
  208. NativeMethods.ISteamGameServer_SetGameTags(CSteamGameServerAPIContext.GetSteamGameServer(), pchGameTags2);
  209. }
  210. }
  211. /// <summary>
  212. /// <para>/ Sets a string defining the "gamedata" for this server, this is optional, but if it is set</para>
  213. /// <para>/ it allows users to filter in the matchmaking/server-browser interfaces based on the value</para>
  214. /// <para>/ don't set this unless it actually changes, its only uploaded to the master once (when</para>
  215. /// <para>/ acknowledged)</para>
  216. /// <para>/</para>
  217. /// <para>/ @see k_cbMaxGameServerGameData</para>
  218. /// </summary>
  219. public static void SetGameData(string pchGameData) {
  220. InteropHelp.TestIfAvailableGameServer();
  221. using (var pchGameData2 = new InteropHelp.UTF8StringHandle(pchGameData)) {
  222. NativeMethods.ISteamGameServer_SetGameData(CSteamGameServerAPIContext.GetSteamGameServer(), pchGameData2);
  223. }
  224. }
  225. /// <summary>
  226. /// <para>/ Region identifier. This is an optional field, the default value is empty, meaning the "world" region</para>
  227. /// </summary>
  228. public static void SetRegion(string pszRegion) {
  229. InteropHelp.TestIfAvailableGameServer();
  230. using (var pszRegion2 = new InteropHelp.UTF8StringHandle(pszRegion)) {
  231. NativeMethods.ISteamGameServer_SetRegion(CSteamGameServerAPIContext.GetSteamGameServer(), pszRegion2);
  232. }
  233. }
  234. /// <summary>
  235. /// <para> Player list management / authentication</para>
  236. /// <para> Handles receiving a new connection from a Steam user. This call will ask the Steam</para>
  237. /// <para> servers to validate the users identity, app ownership, and VAC status. If the Steam servers</para>
  238. /// <para> are off-line, then it will validate the cached ticket itself which will validate app ownership</para>
  239. /// <para> and identity. The AuthBlob here should be acquired on the game client using SteamUser()-&gt;InitiateGameConnection()</para>
  240. /// <para> and must then be sent up to the game server for authentication.</para>
  241. /// <para> Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL</para>
  242. /// <para> If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication</para>
  243. /// <para> for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)</para>
  244. /// </summary>
  245. public static bool SendUserConnectAndAuthenticate(uint unIPClient, byte[] pvAuthBlob, uint cubAuthBlobSize, out CSteamID pSteamIDUser) {
  246. InteropHelp.TestIfAvailableGameServer();
  247. return NativeMethods.ISteamGameServer_SendUserConnectAndAuthenticate(CSteamGameServerAPIContext.GetSteamGameServer(), unIPClient, pvAuthBlob, cubAuthBlobSize, out pSteamIDUser);
  248. }
  249. /// <summary>
  250. /// <para> Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation.</para>
  251. /// <para> Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect()</para>
  252. /// <para> when this user leaves the server just like you would for a real user.</para>
  253. /// </summary>
  254. public static CSteamID CreateUnauthenticatedUserConnection() {
  255. InteropHelp.TestIfAvailableGameServer();
  256. return (CSteamID)NativeMethods.ISteamGameServer_CreateUnauthenticatedUserConnection(CSteamGameServerAPIContext.GetSteamGameServer());
  257. }
  258. /// <summary>
  259. /// <para> Should be called whenever a user leaves our game server, this lets Steam internally</para>
  260. /// <para> track which users are currently on which servers for the purposes of preventing a single</para>
  261. /// <para> account being logged into multiple servers, showing who is currently on a server, etc.</para>
  262. /// </summary>
  263. public static void SendUserDisconnect(CSteamID steamIDUser) {
  264. InteropHelp.TestIfAvailableGameServer();
  265. NativeMethods.ISteamGameServer_SendUserDisconnect(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser);
  266. }
  267. /// <summary>
  268. /// <para> Update the data to be displayed in the server browser and matchmaking interfaces for a user</para>
  269. /// <para> currently connected to the server. For regular users you must call this after you receive a</para>
  270. /// <para> GSUserValidationSuccess callback.</para>
  271. /// <para> Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)</para>
  272. /// </summary>
  273. public static bool BUpdateUserData(CSteamID steamIDUser, string pchPlayerName, uint uScore) {
  274. InteropHelp.TestIfAvailableGameServer();
  275. using (var pchPlayerName2 = new InteropHelp.UTF8StringHandle(pchPlayerName)) {
  276. return NativeMethods.ISteamGameServer_BUpdateUserData(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser, pchPlayerName2, uScore);
  277. }
  278. }
  279. /// <summary>
  280. /// <para> New auth system APIs - do not mix with the old auth system APIs.</para>
  281. /// <para> ----------------------------------------------------------------</para>
  282. /// <para> Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).</para>
  283. /// <para> pcbTicket retrieves the length of the actual ticket.</para>
  284. /// </summary>
  285. public static HAuthTicket GetAuthSessionTicket(byte[] pTicket, int cbMaxTicket, out uint pcbTicket) {
  286. InteropHelp.TestIfAvailableGameServer();
  287. return (HAuthTicket)NativeMethods.ISteamGameServer_GetAuthSessionTicket(CSteamGameServerAPIContext.GetSteamGameServer(), pTicket, cbMaxTicket, out pcbTicket);
  288. }
  289. /// <summary>
  290. /// <para> Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused</para>
  291. /// <para> Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )</para>
  292. /// </summary>
  293. public static EBeginAuthSessionResult BeginAuthSession(byte[] pAuthTicket, int cbAuthTicket, CSteamID steamID) {
  294. InteropHelp.TestIfAvailableGameServer();
  295. return NativeMethods.ISteamGameServer_BeginAuthSession(CSteamGameServerAPIContext.GetSteamGameServer(), pAuthTicket, cbAuthTicket, steamID);
  296. }
  297. /// <summary>
  298. /// <para> Stop tracking started by BeginAuthSession - called when no longer playing game with this entity</para>
  299. /// </summary>
  300. public static void EndAuthSession(CSteamID steamID) {
  301. InteropHelp.TestIfAvailableGameServer();
  302. NativeMethods.ISteamGameServer_EndAuthSession(CSteamGameServerAPIContext.GetSteamGameServer(), steamID);
  303. }
  304. /// <summary>
  305. /// <para> Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to</para>
  306. /// </summary>
  307. public static void CancelAuthTicket(HAuthTicket hAuthTicket) {
  308. InteropHelp.TestIfAvailableGameServer();
  309. NativeMethods.ISteamGameServer_CancelAuthTicket(CSteamGameServerAPIContext.GetSteamGameServer(), hAuthTicket);
  310. }
  311. /// <summary>
  312. /// <para> After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function</para>
  313. /// <para> to determine if the user owns downloadable content specified by the provided AppID.</para>
  314. /// </summary>
  315. public static EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID) {
  316. InteropHelp.TestIfAvailableGameServer();
  317. return NativeMethods.ISteamGameServer_UserHasLicenseForApp(CSteamGameServerAPIContext.GetSteamGameServer(), steamID, appID);
  318. }
  319. /// <summary>
  320. /// <para> Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t</para>
  321. /// <para> returns false if we're not connected to the steam servers and thus cannot ask</para>
  322. /// </summary>
  323. public static bool RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) {
  324. InteropHelp.TestIfAvailableGameServer();
  325. return NativeMethods.ISteamGameServer_RequestUserGroupStatus(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser, steamIDGroup);
  326. }
  327. /// <summary>
  328. /// <para> these two functions s are deprecated, and will not return results</para>
  329. /// <para> they will be removed in a future version of the SDK</para>
  330. /// </summary>
  331. public static void GetGameplayStats() {
  332. InteropHelp.TestIfAvailableGameServer();
  333. NativeMethods.ISteamGameServer_GetGameplayStats(CSteamGameServerAPIContext.GetSteamGameServer());
  334. }
  335. public static SteamAPICall_t GetServerReputation() {
  336. InteropHelp.TestIfAvailableGameServer();
  337. return (SteamAPICall_t)NativeMethods.ISteamGameServer_GetServerReputation(CSteamGameServerAPIContext.GetSteamGameServer());
  338. }
  339. /// <summary>
  340. /// <para> Returns the public IP of the server according to Steam, useful when the server is</para>
  341. /// <para> behind NAT and you want to advertise its IP in a lobby for other clients to directly</para>
  342. /// <para> connect to</para>
  343. /// </summary>
  344. public static uint GetPublicIP() {
  345. InteropHelp.TestIfAvailableGameServer();
  346. return NativeMethods.ISteamGameServer_GetPublicIP(CSteamGameServerAPIContext.GetSteamGameServer());
  347. }
  348. /// <summary>
  349. /// <para> These are in GameSocketShare mode, where instead of ISteamGameServer creating its own</para>
  350. /// <para> socket to talk to the master server on, it lets the game use its socket to forward messages</para>
  351. /// <para> back and forth. This prevents us from requiring server ops to open up yet another port</para>
  352. /// <para> in their firewalls.</para>
  353. /// <para> the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001</para>
  354. /// <para> These are used when you've elected to multiplex the game server's UDP socket</para>
  355. /// <para> rather than having the master server updater use its own sockets.</para>
  356. /// <para> Source games use this to simplify the job of the server admins, so they</para>
  357. /// <para> don't have to open up more ports on their firewalls.</para>
  358. /// <para> Call this when a packet that starts with 0xFFFFFFFF comes in. That means</para>
  359. /// <para> it's for us.</para>
  360. /// </summary>
  361. public static bool HandleIncomingPacket(byte[] pData, int cbData, uint srcIP, ushort srcPort) {
  362. InteropHelp.TestIfAvailableGameServer();
  363. return NativeMethods.ISteamGameServer_HandleIncomingPacket(CSteamGameServerAPIContext.GetSteamGameServer(), pData, cbData, srcIP, srcPort);
  364. }
  365. /// <summary>
  366. /// <para> AFTER calling HandleIncomingPacket for any packets that came in that frame, call this.</para>
  367. /// <para> This gets a packet that the master server updater needs to send out on UDP.</para>
  368. /// <para> It returns the length of the packet it wants to send, or 0 if there are no more packets to send.</para>
  369. /// <para> Call this each frame until it returns 0.</para>
  370. /// </summary>
  371. public static int GetNextOutgoingPacket(byte[] pOut, int cbMaxOut, out uint pNetAdr, out ushort pPort) {
  372. InteropHelp.TestIfAvailableGameServer();
  373. return NativeMethods.ISteamGameServer_GetNextOutgoingPacket(CSteamGameServerAPIContext.GetSteamGameServer(), pOut, cbMaxOut, out pNetAdr, out pPort);
  374. }
  375. /// <summary>
  376. /// <para> Control heartbeats / advertisement with master server</para>
  377. /// <para> Call this as often as you like to tell the master server updater whether or not</para>
  378. /// <para> you want it to be active (default: off).</para>
  379. /// </summary>
  380. public static void EnableHeartbeats(bool bActive) {
  381. InteropHelp.TestIfAvailableGameServer();
  382. NativeMethods.ISteamGameServer_EnableHeartbeats(CSteamGameServerAPIContext.GetSteamGameServer(), bActive);
  383. }
  384. /// <summary>
  385. /// <para> You usually don't need to modify this.</para>
  386. /// <para> Pass -1 to use the default value for iHeartbeatInterval.</para>
  387. /// <para> Some mods change this.</para>
  388. /// </summary>
  389. public static void SetHeartbeatInterval(int iHeartbeatInterval) {
  390. InteropHelp.TestIfAvailableGameServer();
  391. NativeMethods.ISteamGameServer_SetHeartbeatInterval(CSteamGameServerAPIContext.GetSteamGameServer(), iHeartbeatInterval);
  392. }
  393. /// <summary>
  394. /// <para> Force a heartbeat to steam at the next opportunity</para>
  395. /// </summary>
  396. public static void ForceHeartbeat() {
  397. InteropHelp.TestIfAvailableGameServer();
  398. NativeMethods.ISteamGameServer_ForceHeartbeat(CSteamGameServerAPIContext.GetSteamGameServer());
  399. }
  400. /// <summary>
  401. /// <para> associate this game server with this clan for the purposes of computing player compat</para>
  402. /// </summary>
  403. public static SteamAPICall_t AssociateWithClan(CSteamID steamIDClan) {
  404. InteropHelp.TestIfAvailableGameServer();
  405. return (SteamAPICall_t)NativeMethods.ISteamGameServer_AssociateWithClan(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDClan);
  406. }
  407. /// <summary>
  408. /// <para> ask if any of the current players dont want to play with this new player - or vice versa</para>
  409. /// </summary>
  410. public static SteamAPICall_t ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) {
  411. InteropHelp.TestIfAvailableGameServer();
  412. return (SteamAPICall_t)NativeMethods.ISteamGameServer_ComputeNewPlayerCompatibility(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDNewPlayer);
  413. }
  414. }
  415. }
  416. #endif // !DISABLESTEAMWORKS