/// <summary> /// Finalize the removal of the player from the network /// </summary> /// <param name="player">Player to remove</param> /// <param name="forced">Was the removal forced or not?</param> private void FinalizeRemovePlayer(NetworkingPlayer player, bool forced) { steamPlayers.Remove(player.SteamID); OnPlayerDisconnected(player); // TESTING STEAM NETWORKING DISCONNECTION CODE HERE INSTEAD OF IN THE CACHED CLIENT if (!SteamNetworking.CloseP2PSessionWithUser(player.SteamID)) { if (player.SteamID != SteamClient.SteamId) { Logging.BMSLog.LogWarning("Could not close P2P Session with user: "******"Closed P2PSession with user: " + player.SteamID.Value.ToString()); } // END TEST ZONE if (forced) { ForcedDisconnectingPlayers.Remove(player); } else { DisconnectingPlayers.Remove(player); } }
private void FinalizeRemovePlayer(NetworkingPlayer player, bool forced) { OnPlayerDisconnected(player); player.TcpClientHandle.Close(); rawClients.Remove(player.TcpClientHandle); if (!forced) { //让所有事件侦听器知道客户端已经成功断开连接 // Let all of the event listeners know that the client has successfully disconnected if (rawClientDisconnected != null) { rawClientDisconnected(player.TcpClientHandle); } DisconnectingPlayers.Remove(player); } else { //让所有的事件监听器知道这是一个强制断开连接 // Let all of the event listeners know that this was a forced disconnect if (forced && rawClientForceClosed != null) { rawClientForceClosed(player.TcpClientHandle); } ForcedDisconnectingPlayers.Remove(player); } }
// 删除玩家 private void FinalizeRemovePlayer(NetworkingPlayer player, bool forced) { udpPlayers.Remove(player.Ip + "+" + player.Port); OnPlayerDisconnected(player); if (forced) { ForcedDisconnectingPlayers.Remove(player); } else { DisconnectingPlayers.Remove(player); } }
/// <summary> /// Finalize the removal of the player from the network /// </summary> /// <param name="player">Player to remove</param> /// <param name="forced">Was the removal forced or not?</param> private void FinalizeRemovePlayer(NetworkingPlayer player, bool forced) { steamPlayers.Remove(player.SteamID); OnPlayerDisconnected(player); if (forced) { ForcedDisconnectingPlayers.Remove(player); } else { DisconnectingPlayers.Remove(player); } }
private void FinalizeRemovePlayer(NetworkingPlayer player, bool forced) { Logging.BMSLog.LogFormat("SteamP2PServer:FinalizeRemovePlayer({0}:{1}, forced={2}", player.NetworkId, player.SteamID.m_SteamID, forced); steamPlayers.Remove(player.SteamID); OnPlayerDisconnected(player); if (forced) { ForcedDisconnectingPlayers.Remove(player); } else { DisconnectingPlayers.Remove(player); } }