public override IEnumerator OnAlert(Exception ex) { WebAPIException exception = ex as WebAPIException; APIAlert apiAlert = new APIAlert(); if (!exception.IsBackTopScreenError()) { bool isDisplayRetryButton = this.isRequestRetry; if (APIUtil.Instance().alertOnlyCloseButton) { isDisplayRetryButton = false; } apiAlert.NetworkAPIError(exception, isDisplayRetryButton); while (apiAlert.IsOpen()) { yield return(null); } if (apiAlert.SelectedRetryButton) { this.requestStatus = WebAPI.RequestStatus.RETRY; this.afterAlertClosedBehavior = TaskBase.AfterAlertClosed.RETRY; } else { this.afterAlertClosedBehavior = TaskBase.AfterAlertClosed.RETURN; } yield break; } apiAlert.NetworkAPIException(exception); for (;;) { yield return(null); } }
public IEnumerator Exceution(WebAPI webApi, WebAPI.RequestStatus requestStatus) { this.param.requestStatus = (int)requestStatus; string sendJson = WebAPIJsonParse.CreateJsonData(this.apiId, this.param); WWWResponse response = new WWWResponse(); yield return webApi.StartCoroutine(webApi.StartAPIRequest(this.apiId, sendJson, response)); try { string responseJson = webApi.GetResponseJson(response); this.ToObject(responseJson, true); } catch (WebAPIException ex) { if (ex != null) { ex.apiId = this.apiId; } throw ex; } yield break; }