public virtual void CancelRequest() { //var status = AsyncRequestOperation.Status; if (AsyncRequestOperation.Status != AsyncStatusEnum.Done) { AsyncRequestOperation.Status = AsyncStatusEnum.Cancelled; RequestStackManager.StopAllRequestsFromSender(this); } DestroyUtils.Destroy(this.gameObject); }
public virtual void StartRequest() { if (AsyncRequestOperation.Status != AsyncStatusEnum.Processing) { var enumerator = ProcessRequestInternal(); RequestStackManager.RequestRoutine(this, enumerator); AsyncRequestOperation.Status = RequestStackManager.IsRequesting(enumerator) ? AsyncStatusEnum.Processing : AsyncStatusEnum.Cancelled; if (AsyncRequestOperation.Status == AsyncStatusEnum.Processing) { MarkedToDestroy.RemoveMark(this.gameObject); RegisterEvents(); } } }