public void RemovePlayer(NetworkPlayer player, string reason, NetworkDisconnectType type = NetworkDisconnectType.Kick, bool deleteObjects = false) { List <GameObject> objects = player.GetOwnedObjects(); if (deleteObjects) { objects.ForEach(x => DestroyNetworkedObject(x.GetComponent <NetworkIdentity>().m_NetworkId)); } else { objects.ForEach(x => x.GetComponent <NetworkObjectServerInfo>().RemoveAuthority(player)); } NetworkManager.Instance.RemovePlayer(player.m_Id); if (m_AuthorizedUsers.Contains(player.m_Id)) { m_AuthorizedUsers.Remove(player.m_Id); } if (m_Heartbeats.ContainsKey(player.m_Id)) { m_Heartbeats.Remove(player.m_Id); } NetworkPlayerDisconnctRPC disconnectRPC = new NetworkPlayerDisconnctRPC(player, type, reason, player.m_NetworkId); SendRPC(disconnectRPC, player); // TODO: Look into how this works OnPlayerDisconnected(player, type, reason); }
public override void OnPlayerDisconnected(NetworkPlayer player, NetworkDisconnectType type, string reason) { base.OnPlayerDisconnected(player, type, reason); }
/// <summary> /// Called when a player has disconnected from the server /// </summary> /// <param name="player">The player that was disconnected</param> /// <param name="type">The type of disconnection it was</param> /// <param name="reason">The reason the player was disconnected</param> public virtual void OnPlayerDisconnected(NetworkPlayer player, NetworkDisconnectType type, string reason) { ELogger.Log($"A player has disconnected from the server: {player.m_Name}|{type}|{reason}", ELogger.LogType.Server); }
public virtual void OnPlayerDisconnected(NetworkPlayer player, NetworkDisconnectType type, string reason) { }
public NetworkPlayerDisconnctRPC(NetworkPlayer player, NetworkDisconnectType type, string reason, int id) : base(id, NetworkRPCType.RPC_LIB_DISCONNECTED) { m_Player = player; m_DisconnectType = type; m_Reason = reason; }