public void BeginLoad()
        {
            mRealName = mName;
#if DEBUG_BUNDLE_CACHE
            ResourceMgr.Instance().SampleLoadEvent(mName, 2);
#endif
            BundleInfoMapItem item = GetFinalBundle(mName, IsFromWeb);
            mRealName = item.FinalName;
            string name = WWWUtil.RES_BUNDLE_ORIGINAL_NAME ? mName : mRealName;

            if (ResourceModule.Instance.UseAssetBundleLoadFromFile && mWWWType == WWWType.AssetBundle)
            {
                abRequest = WWWUtil.CreateAssetbundleAsync(name, IsFromStream, IsFromWeb);
            }
            else
            {
                loadWWW = WWWUtil.CreateWWW(name, IsRawResource, IsFromStream, IsFromWeb);
            }
            mBeginLoadTime = 0;
        }
Beispiel #2
0
        private IEnumerator SyncBundleMapToPersistentPath(Action <string> callback)
        {
            //检查localBundlemap是否是之前安装包的
            string buildinBundlemapHashPath = WWWUtil.GetStreamingAssetsPath("bundlemap.hash");
            WWW    www = new WWW(buildinBundlemapHashPath);

            yield return(www);

            string buildinBundlemapSha = www.text;

            www.Dispose();

            string bundlemapInPersistenPath = Path.Combine(PathResolver.ApplicationPersistentDataPath, SysConf.SQLITE_BUNDLE_MAP);

            if (File.Exists(bundlemapInPersistenPath))
            {
                BundleIndicesMap bundleMapInPersistent = new BundleIndicesMap(bundlemapInPersistenPath);
                string           localBundleIdentify   = bundleMapInPersistent.GetBundleMapInfo(BundleIndicesMap.BundleMapKey.BUNDLEMAP_IDENTIFY);
                bundleMapInPersistent.Dispose();

                if (localBundleIdentify == buildinBundlemapSha)
                {
                    callback(bundlemapInPersistenPath);
                    yield break;
                }
                else
                {
                    SyncBuildinBundlemap();
                    callback(bundlemapInPersistenPath);
                }
            }

            else
            {
                SyncBuildinBundlemap();
                callback(bundlemapInPersistenPath);
            }
        }