public IABManifestLoader()
        {
            assetManifeset  = null;
            manifesetLoader = null;
            loadState       = 0;

            manifestPath = null;


            //file:///E:/BaiduYunDownload/Assets/Assets/StreamingAssets/AssetBundles/Windows/Windows
            manifestPath = IPathTools.GetAssetBundleFilePath(IPathTools.GetRuntimeFolder());


            if (!IFileTools.IsExistFile(manifestPath))
            {
                isUsingWWW   = true;
                manifestPath = IPathTools.GetAssetBundleWWWStreamPath(IPathTools.GetRuntimeFolder());
            }

            Debuger.Log("manifestPath ===" + manifestPath);

            Debuger.Log("manifestPath 222===" + isUsingWWW.ToString());
            // manifestPath = "C:/Users/yujie/AppData/LocalLow/JFYD/Fish/AssetBundles/Android/Android";
            //  manifestPath =  Application.persistentDataPath + "/AssetBundles/Android/Android";
            //  Debug.Log("manifestPath =111=" + manifestPath);
        }
Beispiel #2
0
        /// <summary>
        /// 加载公共资源
        /// </summary>

        /// <summary>
        /// 开始载入,在Unity3d环境中用StartCoroutine()来开始一个资源的载入
        ///
        /// commonResourcesPath ==file:///E:/SVN/3DFish/Project/Fish/Assets/StreamingAssets/AssetBundles/Windows/scenceone/prefeb.ld
        /// </summary>
        /// <returns></returns>
        public IEnumerator CommonLoad()
        {
            commonResourcesDone = 0;



            string bundlePath = IPathTools.GetAssetBundleFilePath(bundleName);

            //  Debuger.Log("bundlePath =="+ bundlePath);
            //判断persistent是否存在
            if (!IFileTools.IsExistFile(bundlePath))
            {
                bundlePath = IPathTools.GetAssetBundleWWWStreamPath(bundleName);

                WWW bundle = WWW.LoadFromCacheOrDownload(bundlePath, FrameTools.VersionId);

                yield return(bundle);



                if (!string.IsNullOrEmpty(bundle.error))
                {
                    Debuger.Log(bundle.error);

                    //  yield break;
                }
                else
                {
                    // Debug.Log("manifestPath =777777=" + bundle.progress);

                    commonResourcesDone = 1.0f;


                    commonRes = new ResIndexers(bundle.assetBundle);

                    //    Debug.Log("commonResourcesPath load finish= 2222=" + tmpRequest.assetBundle);


                    this.loadFinish(bundleName);
                    loadPorgress(bundleName, commonResourcesDone);
                }
            }
            else
            {
                AssetBundleCreateRequest tmpRequest = AssetBundle.LoadFromFileAsync(bundlePath);

                yield return(tmpRequest);



                if (tmpRequest.assetBundle != null)
                {
                    commonResourcesDone = 1.0f;
                    //  Debug.Log("commonResourcesPath load finish= 2222=" + bundleName);



                    commonRes = new ResIndexers(tmpRequest.assetBundle);

                    //    Debug.Log("commonResourcesPath load finish= 2222=" + tmpRequest.assetBundle);


                    this.loadFinish(bundleName);
                    loadPorgress(bundleName, commonResourcesDone);
                }
                else
                {
                    Debuger.LogError(" bundleName is not finish ==" + bundleName);

                    //  yield break;
                }
            }
        }