/// <inheritdoc /> public override void CloseConnection(string goodbye = "") { Player.Disconnected.Fire(goodbye); Player.Destroy(); SteamGameServer.EndAuthSession(SteamId); base.CloseConnection(goodbye); }
void RemovePlayerFromServer() { if (!ClientData.bActive) { Console.WriteLine("Trying to remove a player that does not exist."); return; } ClientData.bActive = false; SteamGameServer.EndAuthSession(ClientData.SteamIDUser); }
/// <summary> /// Ends the authentication session. /// </summary> public void End() { if (isClientSession) { SteamUser.EndAuthSession(User); } else { SteamGameServer.EndAuthSession(User); } }
void OnAuthCompleted(bool bAuthSeuccessful) { if (!ClientData.bActive) { Console.WriteLine("Goth authentication completed callback for non-active slot"); return; } if (!bAuthSeuccessful) { // Tell GS that user is leaving SteamGameServer.EndAuthSession(ClientData.SteamIDUser); // Send out deny to client MsgServerFailAuthentication msg = new MsgServerFailAuthentication(); byte[] msg_array = Converter.ObjectToByteArray(msg); uint size = (uint)(msg_array.Length * sizeof(byte)); // Another way to calculate size, dont know if it works SteamGameServerNetworking.SendP2PPacket(ClientData.SteamIDUser, msg_array, (uint)Marshal.SizeOf(msg_array), EP2PSend.k_EP2PSendReliable); // Clear out client data ClientData.bActive = false; return; } // The client has passes authentication, integrate it into game // For example setting up name and score and maybe even level // Also tell them they've joined MsgServerPassAuthentication pass_msg = new MsgServerPassAuthentication(); byte[] pass_array = Converter.ObjectToByteArray(pass_msg); SteamGameServerNetworking.SendP2PPacket(ClientData.SteamIDUser, pass_array, (uint)Marshal.SizeOf(pass_array), EP2PSend.k_EP2PSendReliable); // Check if there are two players, if there are we just need them to be reeady // and then the game will start. players will have a button to allow them to // denote if they are ready or not. need to add server states and change lobby // states to be able to accept server incoming messages // Basically Start the Game }
/// <summary> /// <para>Ends an auth session that was started with BeginAuthSession. This should be called when no longer playing with the specified entity.</para> /// <a href="https://partner.steamgames.com/doc/api/ISteamGameServer#EndAuthSession">https://partner.steamgames.com/doc/api/ISteamGameServer#EndAuthSession</a> /// </summary> /// <param name="user"></param> public static void ServerEndAuthSession(CSteamID user) { SteamGameServer.EndAuthSession(user); }
public override void EndAuthSession(Identity user) { SteamGameServer.EndAuthSession((CSteamID)(SteamIdentity)user); }