Пример #1
0
        private IEnumerator SendRequestWithTimer <T>(RequestBase <T> request, Action compliteCallback, Action timeoutCallback)
            where T : RequestBase <T>, new()
        {
            Cookies.Instance.TrySetCookieInRequest(request.UnityWebRequest);
            var   asyncOperation = request.Send();
            float timer          = _requestTimeout;

            while (!asyncOperation.isDone)
            {
                if (timer <= 0)
                {
                    request.Abort();
                    timeoutCallback.Invoke();
                    yield break;
                }
                timer -= Time.fixedDeltaTime;
                yield return(null);
            }
            compliteCallback.Invoke();
        }