/// <summary>
 /// <para> retrieves the ISteamGameServer interface associated with the handle</para>
 /// </summary>
 public static IntPtr GetISteamGameServer(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion)
 {
     InteropHelp.TestIfAvailableGameServer();
     using (var pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion)) {
         return(NativeMethods.ISteamClient_GetISteamGameServer(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2));
     }
 }
Пример #2
0
 public static void TestIfAvailableGameServer()
 {
     TestIfPlatformSupported();
     if (CSteamGameServerAPIContext.GetSteamClient() == IntPtr.Zero && !CSteamGameServerAPIContext.Init())
     {
         throw new InvalidOperationException("Steamworks GameServer is not initialized.");
     }
 }
 /// <summary>
 /// <para> set the local IP and Port to bind to</para>
 /// <para> this must be set before CreateLocalUser()</para>
 /// </summary>
 public static void SetLocalIPBinding(uint unIP, ushort usPort)
 {
     InteropHelp.TestIfAvailableGameServer();
     NativeMethods.ISteamClient_SetLocalIPBinding(CSteamGameServerAPIContext.GetSteamClient(), unIP, usPort);
 }
 /// <summary>
 /// <para> removes an allocated user</para>
 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
 /// </summary>
 public static void ReleaseUser(HSteamPipe hSteamPipe, HSteamUser hUser)
 {
     InteropHelp.TestIfAvailableGameServer();
     NativeMethods.ISteamClient_ReleaseUser(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe, hUser);
 }
 /// <summary>
 /// <para> used by game servers, create a steam user that won't be shared with anyone else</para>
 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
 /// </summary>
 public static HSteamUser CreateLocalUser(out HSteamPipe phSteamPipe, EAccountType eAccountType)
 {
     InteropHelp.TestIfAvailableGameServer();
     return((HSteamUser)NativeMethods.ISteamClient_CreateLocalUser(CSteamGameServerAPIContext.GetSteamClient(), out phSteamPipe, eAccountType));
 }
 /// <summary>
 /// <para> connects to an existing global user, failing if none exists</para>
 /// <para> used by the game to coordinate with the steamUI</para>
 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
 /// </summary>
 public static HSteamUser ConnectToGlobalUser(HSteamPipe hSteamPipe)
 {
     InteropHelp.TestIfAvailableGameServer();
     return((HSteamUser)NativeMethods.ISteamClient_ConnectToGlobalUser(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe));
 }
 /// <summary>
 /// <para> Releases a previously created communications pipe</para>
 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
 /// </summary>
 public static bool BReleaseSteamPipe(HSteamPipe hSteamPipe)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamClient_BReleaseSteamPipe(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe));
 }
 /// <summary>
 /// <para> Trigger global shutdown for the DLL</para>
 /// </summary>
 public static bool BShutdownIfAllPipesClosed()
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamClient_BShutdownIfAllPipesClosed(CSteamGameServerAPIContext.GetSteamClient()));
 }
 /// <summary>
 /// <para> API warning handling</para>
 /// <para> 'int' is the severity; 0 for msg, 1 for warning</para>
 /// <para> 'const char *' is the text of the message</para>
 /// <para> callbacks will occur directly after the API function is called that generated the warning or message.</para>
 /// </summary>
 public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction)
 {
     InteropHelp.TestIfAvailableGameServer();
     NativeMethods.ISteamClient_SetWarningMessageHook(CSteamGameServerAPIContext.GetSteamClient(), pFunction);
 }
 /// <summary>
 /// <para> returns the number of IPC calls made since the last time this function was called</para>
 /// <para> Used for perf debugging so you can understand how many IPC calls your game makes per frame</para>
 /// <para> Every IPC call is at minimum a thread context switch if not a process one so you want to rate</para>
 /// <para> control how often you do them.</para>
 /// </summary>
 public static uint GetIPCCallCount()
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamClient_GetIPCCallCount(CSteamGameServerAPIContext.GetSteamClient()));
 }
 /// <summary>
 /// <para> Creates a communication pipe to the Steam client.</para>
 /// <para> NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling</para>
 /// </summary>
 public static HSteamPipe CreateSteamPipe()
 {
     InteropHelp.TestIfAvailableGameServer();
     return((HSteamPipe)NativeMethods.ISteamClient_CreateSteamPipe(CSteamGameServerAPIContext.GetSteamClient()));
 }