Example #1
0
    IEnumerator WaitForRegisterRequest(WWW request)
    {
        yield return(request);

        if (request.error == null)
        {
            ErrorResponse error = ErrorResponse.CreateFromJSON(request.text);
            if (error.status != "400")
            {
                Debug.Log("WWW Ok!: " + request.text);
                RegisterUser user = RegisterUser.CreateFromJSON(request.text);
                PlayerPrefs.SetString("UserName", user.username);
                PlayerPrefs.SetString("UserToken", user.token);

                go_to_AppCode();
            }
            else
            {
                show_notification("Error: " + error.error);
            }
        }
        else
        {
            show_notification("Error: " + request.error);
            Debug.Log("WWW Error: " + request.error);
        }
    }