Beispiel #1
0
    public void OnLoginResponse(string responseData)
    {
        var root = JsonMapper.ToObject(responseData);
        var data = root["data"];

        try
        {
            var newUser = bool.Parse(data["newUser"].ToString());
            if (newUser)
            {
                // Perform any logic needed for new users
                App.Bc.Client
                .PlayerStateService.UpdateUserName(m_userData.m_screenName, OnSuccess_UpdatePlayerName,
                                                   OnFailed_UpdatePlayerName);
                ErrorHandlingApp.getInstance().m_user.m_userData.m_screenName = "";

                App.Bc.Client.IdentityService.GetIdentities(OnSuccess_GetIdentities, OnFailed_GetIdentities);
            }
            else
            {
                // Load any content on brainCloud that is needed for preexisting users
                App.Bc.Client
                .PlayerStateService.ReadUserState(OnSuccess_ReadPlayerState, OnFailed_ReadPlayerState);
                App.Bc.Client
                .PlayerStateService.GetAttributes(OnSuccess_GetAttributes, OnFailed_GetAttributes);
                App.Bc.Client.IdentityService.GetIdentities(OnSuccess_GetIdentities, OnFailed_GetIdentities);
            }
        }
        catch (Exception e)
        {
            Debug.Log(e.Message);
        }
    }
Beispiel #2
0
    public void OnSuccess_Authenticate(string responseData, object cbObject)
    {
        ErrorHandlingApp.getInstance().m_user.OnLoginResponse(responseData);

        m_state    = ResponseState.Success;
        m_response = responseData;
        Debug.Log("OnSuccess_Authenticate: " + responseData);
    }
Beispiel #3
0
    public void OnSuccess_AttachIndentity(string responseData, object cbObject)
    {
        ErrorHandlingApp.getInstance().m_user.OnIdentitiesChangedResponse(responseData);

        m_state    = ResponseState.Success;
        m_response = responseData;

        Debug.Log("OnSuccess_AttachIndentity: " + responseData);
    }
Beispiel #4
0
    private void DoAuthWindow(int windowId)
    {
        GUILayout.BeginVertical();

        GUILayout.Label(string.Format("Removing this the identity {0} will make you anonymous. Are you sure?",
                                      ErrorHandlingApp.getInstance().m_user.m_userData.m_screenName));

        GUILayout.BeginHorizontal();

        if (Util.Button("Yes"))
        {
            switch (m_exampleAccountType)
            {
            case ExampleAccountType.Universal_1:
            {
                DetachIdentityDialog.DetachIdentityUniversal_1(true);

                break;
            }

            case ExampleAccountType.Universal_2:
            {
                DetachIdentityDialog.DetachIdentityUniversal_2(true);

                break;
            }

            case ExampleAccountType.Email:
            {
                DetachIdentityDialog.DetachIdentityEmail(true);

                break;
            }

            case ExampleAccountType.GooglePlay:
            {
                DetachIdentityDialog.DetachIdentityGooglePlay();

                break;
            }
            }

            Destroy(gameObject);
            return;
        }

        if (Util.Button("No"))
        {
            Destroy(gameObject);
        }

        GUILayout.EndHorizontal();

        GUILayout.EndVertical();
    }
Beispiel #5
0
    public void OnSuccess_Authenticate(string responseData, object cbObject)
    {
        ErrorHandlingApp.getInstance().m_user.OnLoginResponse(responseData);

        m_state    = ResponseState.Success;
        m_response = responseData;
        Debug.Log("OnSuccess_Authenticate: " + responseData);

        App.Bc
        .SetStoredAuthenticationType(UtilExampleAccountType.getTypeName(m_exampleAccountType));
    }
    private void DoAuthWindow(int windowId)
    {
        GUILayout.BeginVertical();

        GUILayout.Label(string.Format("Your already logged in as {0}. Do you want to switch accounts?",
                                      ErrorHandlingApp.getInstance().m_user.m_userData.m_screenName));

        GUILayout.BeginHorizontal();


        if (Util.Button("Yes"))
        {
            App.Bc.ResetStoredAnonymousId();
            App.Bc.ResetStoredAuthenticationType();
            App.Bc.ResetStoredProfileId();

            switch (m_exampleAccountType)
            {
            case ExampleAccountType.Universal_1:
            {
                WrapperAuthenticateDialog.AuthenticateAsUniversal_1();

                break;
            }

            case ExampleAccountType.Universal_2:
            {
                WrapperAuthenticateDialog.AuthenticateAsUniversal_2();

                break;
            }

            case ExampleAccountType.Email:
            {
                WrapperAuthenticateDialog.AuthenticateAsEmail();

                break;
            }
            }

            Destroy(gameObject);
            return;
        }

        if (Util.Button("No"))
        {
            Destroy(gameObject);
        }

        GUILayout.EndHorizontal();

        GUILayout.EndVertical();
    }
Beispiel #7
0
    void OnGUI()
    {
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.MinWidth(SIZE.FullScreen().width));

        GUI.enabled = !ErrorHandlingApp.getInstance().hasDialog();

        App.Bc.Client.RegisterGlobalErrorCallback(failureCallBack);


        GUILayout.BeginVertical("debugInfo", GUI.skin.box);

        GUILayout.Label("---");
        GUILayout.FlexibleSpace();

        if (!lastErrorMessage.Equals(""))
        {
            GUILayout.Label("Last Error Code: " + lastErrorMessage, GUI.skin.box);
        }


        m_loginValueSection.Display();

        GUILayout.EndVertical();

        GUILayout.BeginVertical("brainCloudWrapper", GUI.skin.box);
        GUILayout.Label("---");
        GUILayout.FlexibleSpace();
        m_wrapperInformationSection.Display();
        m_wrapperIdValuesSection.Display();
        m_wrapperLoginSection.Display();
        GUILayout.EndVertical();

        GUILayout.BeginVertical("brainCloud", GUI.skin.box);
        GUILayout.Label("---");
        GUILayout.FlexibleSpace();
        m_informationSection.Display();
        m_idValuesSection.Display();
        m_loginSection.Display();
        m_attachIdentitySection.Display();
        m_detachIdentitySection.Display();
        m_mergeIdentitySection.Display();
        m_screenNameSection.Display();
        GUILayout.EndVertical();

        GUILayout.EndScrollView();

        GUI.enabled = true;
    }
Beispiel #8
0
 public static string getIdentities()
 {
     return(ErrorHandlingApp.getInstance().m_user.m_userData.m_identities);
 }
Beispiel #9
0
 public static string getScreeName()
 {
     return(ErrorHandlingApp.getInstance().m_user.m_userData.m_screenName);
 }
 public static string getPassword()
 {
     return(ErrorHandlingApp.getInstance().m_mainPage.m_loginValueSection.m_password);
 }
 public static string getEmail()
 {
     return(ErrorHandlingApp.getInstance().m_mainPage.m_loginValueSection.m_email);
 }
 public static string getUniversal_2()
 {
     return(ErrorHandlingApp.getInstance().m_mainPage.m_loginValueSection.m_universal_2);
 }
Beispiel #13
0
 void Start()
 {
     ErrorHandlingApp.getInstance().attachDialog(gameObject);
 }
Beispiel #14
0
 protected void Detach()
 {
     ErrorHandlingApp.getInstance().detachDialog(gameObject);
 }