public override void Disconnected(BoltConnection connection) { CoopKickToken coopKickToken = connection.DisconnectToken as CoopKickToken; if (coopKickToken != null) { CoopKick.Client_Banned = coopKickToken.Banned; CoopKick.Client_KickMessage = coopKickToken.KickMessage; UnityEngine.Object.FindObjectOfType <CoopSteamClientStarter>().CancelInvoke("OnDisconnected"); CoopClientCallbacks.OnDisconnected = null; } else { CoopKick.Client_Banned = false; CoopKick.Client_KickMessage = string.Empty; if (CoopClientCallbacks.OnDisconnected != null) { CoopClientCallbacks.OnDisconnected(); } } }
public override void Disconnected(BoltConnection connection) { CoopKickToken coopKickToken = connection.DisconnectToken as CoopKickToken; if (coopKickToken != null) { SteamClientConfig.Banned = coopKickToken.Banned; SteamClientConfig.KickMessage = UiTranslationDatabase.TranslateKey(coopKickToken.KickMessage, "Kicked/Banned", false); CoopSteamClientStarter coopSteamClientStarter = UnityEngine.Object.FindObjectOfType <CoopSteamClientStarter>(); if (coopSteamClientStarter) { coopSteamClientStarter.CancelInvoke("OnDisconnected"); } CoopClientCallbacks.OnDisconnected = null; if (SteamClientDSConfig.isDedicatedClient) { BoltLauncher.Shutdown(); UnityEngine.Object.Destroy(base.gameObject); SteamUser.TerminateGameConnection(SteamClientDSConfig.EndPoint.Address.Packed, SteamClientDSConfig.EndPoint.Port); this.ReturnToTitle(); } else if (!TheForest.Utils.Scene.FinishGameLoad) { this.ReturnToTitle(); } } else { SteamClientConfig.Banned = false; SteamClientConfig.KickMessage = string.Empty; if (SteamClientDSConfig.isDedicatedClient) { CoopJoinDedicatedServerFailed coopJoinDedicatedServerFailed = connection.DisconnectToken as CoopJoinDedicatedServerFailed; if (coopJoinDedicatedServerFailed != null) { CoopClientCallbacks.OnDisconnected = null; CoopPlayerCallbacks.WasDisconnectedFromServer = true; CoopSteamClientStarter coopSteamClientStarter2 = UnityEngine.Object.FindObjectOfType <CoopSteamClientStarter>(); if (coopSteamClientStarter2) { coopSteamClientStarter2._connectionAttempts = 3; coopSteamClientStarter2.CancelInvoke("OnDisconnected"); UnityEngine.Object.Destroy(coopSteamClientStarter2.gameObject); } BoltLauncher.Shutdown(); SteamClientConfig.KickMessage = "Incorrect password"; UnityEngine.Object.Destroy(base.gameObject); this.ReturnToTitle(); } } if (CoopClientCallbacks.OnDisconnected != null) { CoopClientCallbacks.OnDisconnected(); } } if (SteamClientDSConfig.isDedicatedClient) { SteamUser.TerminateGameConnection(SteamClientDSConfig.EndPoint.Address.Packed, SteamClientDSConfig.EndPoint.Port); this.ReturnToTitle(); } }