Exemple #1
0
        private void ProcessRequests()
        {
            IUnityHttpRequest unityHttpRequest = UnityRequestQueue.Instance.DequeueRequest();

            if (unityHttpRequest != null)
            {
                this.StartCoroutine(InvokeRequest(unityHttpRequest));
            }
            RuntimeAsyncResult runtimeAsyncResult = UnityRequestQueue.Instance.DequeueCallback();

            if (runtimeAsyncResult != null && runtimeAsyncResult.Action != null)
            {
                try
                {
                    runtimeAsyncResult.Action(runtimeAsyncResult.Request, runtimeAsyncResult.Response, runtimeAsyncResult.Exception, runtimeAsyncResult.AsyncOptions);
                }
                catch (Exception exception)
                {
                    _logger.Error(exception, "An unhandled exception was thrown from the callback method {0}.", runtimeAsyncResult.Request.ToString());
                }
            }
            Action action = UnityRequestQueue.Instance.DequeueMainThreadOperation();

            if (action != null)
            {
                try
                {
                    action();
                }
                catch (Exception exception2)
                {
                    _logger.Error(exception2, "An unhandled exception was thrown from the callback method");
                }
            }
            NetworkReachability networkReachability = ServiceFactory.Instance.GetService <INetworkReachability>() as NetworkReachability;

            if (_currentNetworkStatus != networkReachability.NetworkStatus)
            {
                _currentNetworkStatus = networkReachability.NetworkStatus;
                networkReachability.OnNetworkReachabilityChanged(_currentNetworkStatus);
            }
        }