Пример #1
0
        /// <summary>
        /// Callback method for when the client fails to connect.
        /// </summary>
        /// <param name="result">The result of the failed connection.</param>
        public void OnFailedConnect(ConnectFailedResult result)
        {
            // Let the user know that the connection failed based on the result
            switch (result.Type)
            {
            case ConnectFailedResult.FailType.NotWhiteListed:
                SetFeedbackText(Color.red, "Failed to connect:\nNot whitelisted");
                break;

            case ConnectFailedResult.FailType.Banned:
                SetFeedbackText(Color.red, "Failed to connect:\nBanned from server");
                break;

            case ConnectFailedResult.FailType.InvalidAddons:
                SetFeedbackText(Color.red, "Failed to connect:\nInvalid addons");
                break;

            case ConnectFailedResult.FailType.InvalidUsername:
                SetFeedbackText(Color.red, "Failed to connect:\nInvalid username");
                break;

            case ConnectFailedResult.FailType.SocketException:
                SetFeedbackText(Color.red, "Failed to connect:\nInternal error");
                break;

            case ConnectFailedResult.FailType.TimedOut:
                SetFeedbackText(Color.red, "Failed to connect:\nConnection timed out");
                break;

            case ConnectFailedResult.FailType.Unknown:
                SetFeedbackText(Color.red, "Failed to connect:\nUnknown reason");
                break;
            }

            // Enable the connect button again
            _connectionButton.SetText(ConnectText);
            _connectionButton.SetInteractable(true);
        }
Пример #2
0
 /// <summary>
 /// Callback method for when the client fails to connect.
 /// </summary>
 /// <param name="result">The result of the failed connection.</param>
 public void OnFailedConnect(ConnectFailedResult result)
 {
     ConnectInterface.OnFailedConnect(result);
 }