Ejemplo n.º 1
0
        //実際にロードするパスを設定
        protected virtual string ParseLoadPath()
        {
            switch (FileInfo.StrageType)
            {
            case AssetFileStrageType.Server:
            case AssetFileStrageType.StreamingAssets:
            {
                if (this.FileInfo.AssetBundleInfo == null)
                {
                    Debug.LogError("Not found in assetbundle list " + FileName);
                    return(FilePathUtil.EncodeUrl(FileName));
                }
                string url = this.FileInfo.AssetBundleInfo.Url;
                url = FilePathUtil.ToCacheClearUrl(url);
                return(FilePathUtil.EncodeUrl(url));
            }

            case AssetFileStrageType.Resources:
            default:
                return(FileName);
            }
        }
Ejemplo n.º 2
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);

            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();
                }
            }
                       ));
        }