Esempio n. 1
0
    private IEnumerator ServerResponseTest()
    {
        for (;;)
        {
            yield return(null);

            if (BoltNetwork.isRunning && BoltNetwork.isClient && BoltNetwork.server != null)
            {
                if (BoltNetwork.server.DejitterFrames < -300)
                {
                    try
                    {
                        CoopClientCallbacks.invokedServerNotResponding = true;
                        if (CoopClientCallbacks.ServerNotResponding != null)
                        {
                            CoopClientCallbacks.ServerNotResponding();
                        }
                    }
                    catch (Exception exception)
                    {
                        Debug.LogException(exception);
                    }
                }
                else if (CoopClientCallbacks.invokedServerNotResponding)
                {
                    CoopClientCallbacks.invokedServerNotResponding = false;
                    if (CoopClientCallbacks.ServerIsResponding != null)
                    {
                        CoopClientCallbacks.ServerIsResponding();
                    }
                }
            }
        }
        yield break;
    }
Esempio n. 2
0
    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();
            }
        }
    }
Esempio n. 3
0
    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();
        }
    }