//アセットバンドルマニフェストをキャッシュからロードして追加する
        public IEnumerator LoadCacheManifestAsync(string rootUrl, string relativeUrl, Action onComplete, Action onFailed)
        {
            string url = GetCachePath(relativeUrl);

            url = FilePathUtil.AddFileProtocol(url);
            WWWEx wwwEx = new WWWEx(url);

            wwwEx.OnUpdate   = OnDownloadingManifest;
            wwwEx.RetryCount = 0;
            wwwEx.TimeOut    = 0.1f;
            return(wwwEx.LoadAssetBundleByNameAsync <AssetBundleManifest>(
                       AssetBundleManifestName,
                       false,
                       (manifest) =>
            {
                AddAssetBundleManifest(rootUrl, manifest);
                if (onComplete != null)
                {
                    onComplete();
                }
            },
                       () =>
            {
                if (onFailed != null)
                {
                    onFailed();
                }
            }
                       ));
        }
Example #2
0
        //ロードアセットバンドル
        IEnumerator LoadAssetBundleAsync(string path, Action onComplete, Action onFailed)
        {
            WWWEx wwwEx = MakeWWWEx(path);

            wwwEx.RetryCount = FileManager.AutoRetryCountOnDonwloadError;
            wwwEx.TimeOut    = FileManager.TimeOutDownload;

            this.AssetBundle = null;
            if (Priority == AssetFileLoadPriority.DownloadOnly)
            {
                yield return(wwwEx.DownLoadAssetBundleAsync(onComplete, onFailed));
            }
            else
            {
                AssetBundle assetBundle = null;
                yield return(wwwEx.LoadFromCacheOrDownloadAssetBundleAsync(
                                 (x) =>
                {
                    assetBundle = x;
                },
                                 onFailed));

                if (assetBundle != null)
                {
                    yield return(LoadAssetBundleAsync(assetBundle, onComplete, onFailed));
                }
            }
        }
Example #3
0
        //ロードアセットバンドル
        IEnumerator LoadAssetBundleAsync(string path, Action onComplete, Action onFailed)
        {
            //path = DLCManager.AddParamVersionURL(path); // Glareでのバージョン管理番号をURLに追加.
            path = DLCManager.CreateDLCUrlForUtage(path);
            WWWEx wwwEx = MakeWWWEx(path);

            wwwEx.RetryCount = FileManager.AutoRetryCountOnDonwloadError;
            wwwEx.TimeOut    = FileManager.TimeOutDownload;

            this.AssetBundle = null;
            AssetBundle assetBundle = null;

            yield return(wwwEx.LoadAsync(
                             //OnComplete
                             (www) =>
            {
                if (Priority == AssetFileLoadPriority.DownloadOnly)
                {
                    www.assetBundle.Unload(true);
                    onComplete();
                }
                else
                {
                    assetBundle = www.assetBundle;
                    if (assetBundle == null)
                    {
                        SetLoadError(www.url + " is not assetBundle");
                        onFailed();
                    }
                }
            },
                             //OnFailed
                             (www) =>
            {
                //失敗
                onFailed();
            }
                             ));

            if (assetBundle != null)
            {
                yield return(LoadAssetBundleAsync(assetBundle, onComplete, onFailed));
            }
        }
        //アセットバンドルマニフェストをDLして情報を追加
        public IEnumerator DownloadManifestAsync(string rootUrl, string relativeUrl, Action onComplete, Action onFailed)
        {
            string url = FilePathUtil.Combine(rootUrl, relativeUrl);

            url = DLCManager.CreateDLCUrlForUtage(url);  //url = FilePathUtil.ToVersionManagerUrl(url);
            WWWEx wwwEx = new WWWEx(url);

            wwwEx.StoreBytes = true;
            wwwEx.OnUpdate   = OnDownloadingManifest;
            wwwEx.RetryCount = retryCount;
            wwwEx.TimeOut    = timeOut;
//			Debug.Log("Load Start " + url);
            return(wwwEx.LoadAssetBundleByNameAsync <AssetBundleManifest>(
                       AssetBundleManifestName,
                       false,
                       (manifest) =>
            {
                AddAssetBundleManifest(rootUrl, manifest);
                if (UseCacheManifest)
                {
                    string path = GetCachePath(relativeUrl);
                    FileIOManager.CreateDirectory(FilePathUtil.GetDirectoryPath(path) + "/");
                    FileIOManager.Write(path, wwwEx.Bytes);
                }
                if (onComplete != null)
                {
                    onComplete();
                }
            },
                       () =>
            {
                if (onFailed != null)
                {
                    onFailed();
                }
            }
                       ));
        }
Example #5
0
        //アセットバンドルマニフェストをDLして情報を追加
        public IEnumerator DownloadManifestAsync(string rootUrl, string relativeUrl, Action onComplete, Action onFailed)
        {
            string url = FilePathUtil.Combine(rootUrl, relativeUrl);

            url = FilePathUtil.ToCacheClearUrl(url);
            WWWEx wwwEx = new WWWEx(url);

            if (UseCacheManifest)
            {
                wwwEx.IoManager  = FileIOManager;
                wwwEx.WriteLocal = true;
                wwwEx.WritePath  = GetCachePath(relativeUrl);
            }
            wwwEx.OnUpdate   = OnDownloadingManifest;
            wwwEx.RetryCount = retryCount;
            wwwEx.TimeOut    = timeOut;
//			Debug.Log("Load Start " + url);
            return(wwwEx.LoadAssetBundleByNameAsync <AssetBundleManifest>(
                       AssetBundleManifestName,
                       false,
                       (manifest) =>
            {
                AddAssetBundleManifest(rootUrl, manifest);
                if (onComplete != null)
                {
                    onComplete();
                }
            },
                       () =>
            {
                if (onFailed != null)
                {
                    onFailed();
                }
            }
                       ));
        }
        void OnDownloadingManifest(WWWEx wwwEx)
        {
//			Debug.Log(wwwEx.Progress);
        }