public static void CreateDialog(ExampleAccountType exampleAccountType)
    {
        GameObject dialogObject           = new GameObject("Dialog");
        WrapperSwitchAccountDialog dialog = dialogObject.AddComponent <WrapperSwitchAccountDialog>();

        dialog.m_exampleAccountType = exampleAccountType;
    }
예제 #2
0
    public void OnError_Authenticate(int statusCode, int reasonCode, string statusMessage, object cbObject)
    {
        m_state    = ResponseState.Error;
        m_response = reasonCode + ":" + statusMessage;
        Debug.LogError("OnError_Authenticate: " + statusMessage);

        if (ErrorHandling.SharedErrorHandling(statusCode, reasonCode, statusMessage, cbObject, gameObject))
        {
            return;
        }

        switch (reasonCode)
        {
        case ReasonCodes.MISSING_IDENTITY_ERROR:
        {
            // User's identity doesn't match one existing on brainCloud
            // Clear the invalid Profile and Anon Id values, and reauthenticate

            App.Bc.ResetStoredProfileId();
            App.Bc.ResetStoredAnonymousId();

            ReAuthenticate();

            break;
        }

        case ReasonCodes.SWITCHING_PROFILES:
        {
            // User profile id doesn't match the identity they are attempting to authenticate
            // decide how this will be handled, such as with a switch account prompt, informing
            // them that they'll be switching profiles
            Destroy(gameObject);
            WrapperSwitchAccountDialog.CreateDialog(m_exampleAccountType);

            break;
        }

        case ReasonCodes.TOKEN_DOES_NOT_MATCH_USER:
        {
            // User is receiving  an error that they're username or password is wrong.
            // decide how this will be handled, such as prompting the user to re-enter
            // there login details
            Destroy(gameObject);
            ErrorDialog.DisplayErrorDialog(
                "Incorrect username or password. Please check your information and try again.", m_response);

            break;
        }


        case ReasonCodes.MISSING_PROFILE_ERROR:
        {
            // User is receiving an error that they're trying to authenticate an account that doesn't exist.
            // decide how this will be handled, such as creating the account by setting the forceCreate flag to true
            Destroy(gameObject);
            WrapperCreateAccountDialog.CreateDialog(m_exampleAccountType);

            break;
        }

        default:
        {
            // log the reasonCode to your own internal error checking
            ErrorHandling.UncaughtError(statusCode, reasonCode, statusMessage, cbObject, gameObject);

            break;
        }
        }
    }