private static void ShowDisplayDialogForFailedOp(AsyncOp op) { var message = BuildDisplayStringForAsyncOp(op); EditorUtility.ClearProgressBar(); EditorUtility.DisplayDialog( LocalizationManager.Instance.GetTranslation("languageUpdateProgressTitleFail"), message, LocalizationManager.Instance.GetTranslation("ok")); }
private static string BuildDisplayStringForAsyncOp(AsyncOp op) { string message = string.Empty; if (op.Status == AsyncStatus.Timeout) { message = LocalizationManager.Instance.GetTranslation("languageUpdateTimeout"); } else if (op.Status == AsyncStatus.Failed) { message = string.Format( LocalizationManager.Instance.GetTranslation("languageUpdateFail"), op.FailureCode, op.FailureMessage); } else { // Nothing to display for success or otherwise } return(message); }
/// <summary> /// Request the JSON from the web using the initialized uri. /// </summary> /// <param name="timeout">Timeout for the web request, which returns AsyncStatus of Timeout.</param> /// <returns>An AsyncOp. Query this for the status of the operation and for its results.</returns> public AsyncOp <T> GetJSON(int timeout) { this.outstandingOp = new AsyncOp <T>(); EditorCoroutineUtility.StartBackgroundTask(this.Post(requester, timeout)); return(this.outstandingOp); }