internal PlayAssetBundleRequest RetrieveAssetBundleAsyncInternal(string assetBundleName)
        {
            if (_requestRepository.ContainsRequest(assetBundleName))
            {
                throw new ArgumentException(string.Format("There is already an active request for AssetBundle: {0}",
                                                          assetBundleName));
            }

            var request = CreateAssetBundleRequest(assetBundleName);

            if (IsDownloaded(assetBundleName))
            {
                StartLoadingAssetBundle(request);
                request.OnLoadingStarted();
            }
            else
            {
                var fetchTask = _assetPackManager.Fetch(assetBundleName);
                fetchTask.RegisterOnSuccessCallback(javaPackStates =>
                {
                    request.OnInitializedInPlayCore();
                    fetchTask.Dispose();
                });
                fetchTask.RegisterOnFailureCallback((reason, errorCode) =>
                {
                    Debug.LogErrorFormat("Failed to retrieve AssetBundle {0}: ", reason);
                    request.OnErrorOccured(PlayCoreTranslator.TranslatePlayCoreErrorCode(errorCode));
                    fetchTask.Dispose();
                });
            }

            return(request);
        }
 private void DeferCancelPlayCore()
 {
     _onInitializedInPlayCore = () =>
     {
         // Only cancel if a new request hasn't been started, to avoid cancelling the new request.
         if (_requestRepository.ContainsRequest(MainAssetBundleName))
         {
             Debug.LogFormat("Skip canceling {0}", MainAssetBundleName);
         }
         else
         {
             CancelPlayCore();
         }
     };
 }