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(); } } }
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(); } }