Esempio n. 1
0
        private void OnConnectionClosed(IDisconnectionInfo obj)
        {
            UpdateStatus(Status.Disconnected);
            ServerDisconnectionInfo serverDisconnectionInfo = obj as ServerDisconnectionInfo;

            if (serverDisconnectionInfo != null)
            {
                string formattedText = TextCollectionUtility.DisconnectionReasonKeys.GetFormattedText(serverDisconnectionInfo.reason);
                CreateDisconnectedPopup(formattedText, DisconnectionStrategy.ReturnToLogin);
            }
            else if (!(obj is ClientDisconnectionInfo))
            {
                if (obj is NetworkDisconnectionInfo)
                {
                    Reconnect();
                    return;
                }
                Log.Error($"Connection closed for unknown reason: {obj}. Leaving application.", 298, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Network\\ConnectionHandler.cs");
                string cause = RuntimeData.FormattedText(36698, obj.ToString());
                CreateDisconnectedPopup(cause, DisconnectionStrategy.QuitApplication);
            }
        }
Esempio n. 2
0
        private void OnOpenConnectionFailed(IConnectionError obj)
        {
            UpdateStatus(Status.Disconnected);
            SpinConnectionError spinConnectionError = obj as SpinConnectionError;

            if (spinConnectionError != null)
            {
                string formattedText = TextCollectionUtility.AuthenticationErrorKeys.GetFormattedText(spinConnectionError.error);
                switch (spinConnectionError.error)
                {
                case SpinProtocol.ConnectionErrors.NickNameRequired:
                    RequestNickname();
                    break;

                case SpinProtocol.ConnectionErrors.BadCredentials:
                case SpinProtocol.ConnectionErrors.InvalidAuthenticationInfo:
                case SpinProtocol.ConnectionErrors.SubscriptionRequired:
                case SpinProtocol.ConnectionErrors.AdminRightsRequired:
                case SpinProtocol.ConnectionErrors.AccountKnonwButBanned:
                case SpinProtocol.ConnectionErrors.AccountKnonwButBlocked:
                case SpinProtocol.ConnectionErrors.BetaAccessRequired:
                    CreateDisconnectedPopup(formattedText, DisconnectionStrategy.ReturnToLoginAndChangeAccount);
                    break;

                case SpinProtocol.ConnectionErrors.ServerTimeout:
                case SpinProtocol.ConnectionErrors.ServerError:
                case SpinProtocol.ConnectionErrors.AccountsBackendError:
                    CreateDisconnectedPopup(formattedText, DisconnectionStrategy.ReturnToLogin);
                    break;

                case SpinProtocol.ConnectionErrors.IpAddressRefused:
                    CreateDisconnectedPopup(formattedText, DisconnectionStrategy.QuitApplication);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                return;
            }
            ConnectionInterruptedError connectionInterruptedError = obj as ConnectionInterruptedError;

            if (connectionInterruptedError != null)
            {
                ServerDisconnectionInfo serverDisconnectionInfo = connectionInterruptedError.disconnectionInfo as ServerDisconnectionInfo;
                if (serverDisconnectionInfo != null)
                {
                    Log.Info($"Disconnection occured during authentication {connectionInterruptedError.disconnectionInfo}", 209, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Network\\ConnectionHandler.cs");
                    string formattedText2 = TextCollectionUtility.DisconnectionReasonKeys.GetFormattedText(serverDisconnectionInfo.reason);
                    CreateDisconnectedPopup(formattedText2, DisconnectionStrategy.ReturnToLogin);
                }
                else if (connectionInterruptedError.disconnectionInfo is NetworkDisconnectionInfo)
                {
                    if (m_autoReconnect)
                    {
                        Reconnect();
                        return;
                    }
                    Log.Info($"Disconnection occured during authentication {connectionInterruptedError.disconnectionInfo}", 224, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Network\\ConnectionHandler.cs");
                    string cause = RuntimeData.FormattedText(94930);
                    CreateDisconnectedPopup(cause, DisconnectionStrategy.ReturnToLogin);
                }
                return;
            }
            NetworkConnectionError networkConnectionError = obj as NetworkConnectionError;

            if (networkConnectionError != null)
            {
                if (m_autoReconnect)
                {
                    Reconnect();
                    return;
                }
                Log.Info($"Error occured during authentication {networkConnectionError.exception}", 244, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Network\\ConnectionHandler.cs");
                string cause2 = RuntimeData.FormattedText(34942);
                CreateDisconnectedPopup(cause2, DisconnectionStrategy.ReturnToLogin);
            }
            else
            {
                Log.Info($"Error while connecting: {obj}", 251, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Network\\ConnectionHandler.cs");
                string cause3 = RuntimeData.FormattedText(36698, obj.ToString());
                CreateDisconnectedPopup(cause3, DisconnectionStrategy.ReturnToLogin);
            }
        }