Example #1
0
    private IEnumerator WaitForRequest(UnityWebRequest request, WWWAction onComplete)
    {
        yield return(request.Send());

        // check for errors
        //this will return error on redirect limit right now
        if (!request.isError)
        {
            string results = request.downloadHandler.text;
            if (request.url.EndsWith(ERROR_PARAM))
            {
                ModalDialog tmp = new ModalDialog("Login Error", "Invalid username/password.", "OK", null);
                tmp.show();
            }
            else
            {
                onComplete(request);
            }
        }
        else
        {
            error = request.error;
            print(error + " resultCode=" + request.responseCode);
            //check for the redirect
            if (request.responseCode == REDIRECT_HTTP_STATUS)
            {
                Dictionary <string, string> headers = request.GetResponseHeaders();
                string location = headers [LOCATION_HEADER];
                if (!string.IsNullOrEmpty(location))
                {
                    if (location.EndsWith(ERROR_PARAM))
                    {
                        ModalDialog tmp = new ModalDialog("Login Error", "Invalid username/password.", "OK", null);
                        tmp.show();
                    }
                    else
                    {
                        onComplete(request);
                    }
                }
                else
                {
                    onComplete(request);
                }
            }
            else
            {
                ModalDialog tmp = new ModalDialog("Unknown Error", error, "OK", null);
                tmp.show();
            }
        }
    }
Example #2
0
    private IEnumerator WaitForRequest(UnityWebRequest request, WWWAction onComplete)
    {
        yield return(request.Send());

        print("Waiting for request");
        // check for errors
        //this will return error on redirect limit right now
        if (!request.isNetworkError)
        {
            if (request.url.EndsWith(ERROR_PARAM))
            {
                print("Login Error1");
            }
            else
            {
                onComplete(request);
            }
        }

        else
        {
            error = request.error;
            print(error + " resultCode=" + request.responseCode);
            //check for the redirect
            if (request.responseCode == REDIRECT_HTTP_STATUS)
            {
                Dictionary <string, string> headers = request.GetResponseHeaders();
                string location = headers[LOCATION_HEADER];
                if (!string.IsNullOrEmpty(location))
                {
                    if (location.EndsWith(ERROR_PARAM))
                    {
                        print("Login Error2");
                    }
                    else
                    {
                        onComplete(request);
                    }
                }
                else
                {
                    onComplete(request);
                }
            }
            else
            {
                print("Unknown. Not a REDIRECT_HTTP_STATUS error. This is a network error. ");
            }
        }
    }
Example #3
0
    private IEnumerator WaitForRequest2(UnityWebRequest request, WWWAction onComplete)
    {
        yield return(request.Send());

        // check for errors
        if (!request.isNetworkError)
        {
            onCompleteListing(request);
        }
        else
        {
            error = request.error;
            print(error + "This is the resultCode=" + request.responseCode);
        }
    }
Example #4
0
    private IEnumerator WaitForRequest2(UnityWebRequest request, WWWAction onComplete)
    {
        yield return(request.Send());

        // check for errors
        if (!request.isError)
        {
            string results = request.downloadHandler.text;
            onCompleteListing(request);
        }
        else
        {
            error = request.error;
            print(error + " resultCode=" + request.responseCode);
            ModalDialog tmp = new ModalDialog("Session Listing Error", error, "OK", null);
            tmp.show();
        }
    }