private void WebRequestOperationCompleted(AsyncOperation op)
        {
            UnityWebRequestAsyncOperation remoteReq = op as UnityWebRequestAsyncOperation;
            var webReq = remoteReq.webRequest;

            if (string.IsNullOrEmpty(webReq.error))
            {
                downloadHandler = webReq.downloadHandler as DownloadHandlerAssetBundle;
                provideHandle.Complete(this, true, null);
            }
            else
            {
                downloadHandler = webReq.downloadHandler as DownloadHandlerAssetBundle;
                downloadHandler.Dispose();
                downloadHandler = null;
                if (retries++ < options.RetryCount)
                {
                    UDebug.LogFormat("Web request {0} failed with error '{1}', retrying ({2}/{3})...", webReq.url, webReq.error, retries, options.RetryCount);
                    BeginOperation();
                }
                else
                {
                    var exception = new Exception(string.Format("RemoteAssetBundleProvider unable to load from url {0}, result='{1}'.", webReq.url, webReq.error));
                    CompletedEvent?.Invoke(null, false, exception);
                }
            }
            webReq.Dispose();
        }
Beispiel #2
0
        public void run(object item)
        {
            Download_Data_Info inf = item as Download_Data_Info;

            //Trend_Analyser_Connector.Trend_Analyser_Module_2_Download_Data(inf.symbol, inf.fYear, inf.fMonth, inf.fDay, inf.tYear, inf.tMonth, inf.tDay);

            if (UpdateEvent != null)
            {
                UpdateEvent.Invoke();
            }

            Interlocked.Increment(ref i);

            if (i == count)
            {
                prog.Close();

                if (CompletedEvent != null)
                {
                    CompletedEvent.Invoke();
                }
            }
            else
            {
                prog.setPercentage(i * 100 / count);
            }
        }
Beispiel #3
0
        private void OnComplete(AsyncOperationHandle <IList <object> > handle)
        {
            handle.Completed -= OnComplete;
            if (!_isDisposed && handle.Status == AsyncOperationStatus.Succeeded)
            {
                Assets = handle.Result.ToList();
            }

            CompletedEvent?.Invoke(this, handle.Status);
        }
Beispiel #4
0
        void Complete()
        {
            StopAllCoroutines();
            textTMP.text = current.Text;
            completed    = true;
            queue.Dequeue();
            CompletedEvent?.Invoke(this);

            if (queue.Count > 0)
            {
                ShowNext();
            }
            else
            {
                Hide();
            }
        }
Beispiel #5
0
        private void BeginOperation(string assetPackName)
        {
            Debug.LogFormat("[{0}.{1}] assetPackName={2}", nameof(AssetPackBundleSyncResource), nameof(BeginOperation), assetPackName);
            playAssetPackRequest = PlayAssetDelivery.RetrieveAssetPackAsync(assetPackName);
            Exception exception = null;

            if (playAssetPackRequest.IsDone)
            {
                var assetLocation = playAssetPackRequest.GetAssetLocation(assetPackName);
                assetBundle = AssetBundle.LoadFromFile(assetLocation.Path, /* crc= */ 0, assetLocation.Offset);
            }
            else
            {
                exception = new Exception($"Asset Pack was not retrieved Synchronously: '{assetPackName}'.");
            }
            CompletedEvent?.Invoke(this, assetBundle != null, exception);
        }
        private void OnPlayAssetPackRequestCompleted(string assetPackName, PlayAssetPackRequest request)
        {
            if (request.Error != AssetDeliveryErrorCode.NoError)
            {
                CompletedEvent?.Invoke(this, false, new Exception($"Error downloading error pack: {request.Error}"));
                return;
            }
            if (request.Status != AssetDeliveryStatus.Available)
            {
                CompletedEvent?.Invoke(this, false, new Exception($"Error downloading status: {request.Status}"));
                return;
            }
            var assetLocation = request.GetAssetLocation(assetPackName);

            requestOperation            = AssetBundle.LoadFromFileAsync(assetLocation.Path, /* crc= */ 0, assetLocation.Offset);
            requestOperation.completed += LocalRequestOperationCompleted;
        }
Beispiel #7
0
 IEnumerator OnNextCR()
 {
     storyIndex++;
     if (isShowing)
     {
         // Hide the old
         ShowHide(false);
         yield return(new WaitForSeconds(display.Animator.GetCurrentAnimatorStateInfo(0).length + timeBetweenPanels));
     }
     if (storyIndex < textImages.Count)
     {
         ShowHide(true);
     }
     else
     {
         // The end
         gameObject.SetActive(false);
         OnCompleted?.Invoke();
     }
 }
 public void OnRuneClicked(Rune aRune)
 {
     foreach (Rune rune in runesListInOrder)
     {
         if (rune == aRune)
         {
             rune.SetActivated(true);
             if (rune == runesListInOrder[runesListInOrder.Count - 1])
             {
                 onCompleted.Invoke();
             }
             break;
         }
         else if (rune.activeObject.activeSelf == false)
         {
             ResetAllRunes();
             break;
         }
     }
 }
Beispiel #9
0
 private void LocalRequestOperationCompleted(AsyncOperation operation)
 {
     assetBundle = (operation as AssetBundleCreateRequest)?.assetBundle;
     CompletedEvent?.Invoke(this, assetBundle != null, null);
 }
Beispiel #10
0
 protected void CompletedEventInvoker(object sender, CompletedEventArgs e)
 {
     CompletedEvent?.Invoke(sender, e);
 }
Beispiel #11
0
 private void BeginOperation(string path)
 {
     Debug.LogFormat("[{0}.{1}] path={2}", nameof(LocalBundleSyncResource), nameof(BeginOperation), path);
     assetBundle = AssetBundle.LoadFromFile(path, options?.Crc ?? 0);;
     CompletedEvent?.Invoke(this, assetBundle != null, null);
 }
Beispiel #12
0
 private void Actor_CompletedEvent(object sender, IActorMessage e)
 {
     CompletedEvent?.Invoke(sender, e);
 }