Exemplo n.º 1
0
        private void SyncRemoteBundlemap(Action syncRemoteBundlemapCallback)
        {
            string serverBundleMapInPersistentPath = Path.Combine(PathResolver.ApplicationPersistentDataPath, SysConf.SERVER_SQLITE_BUNDLE_MAP);

            if (File.Exists(serverBundleMapInPersistentPath))
            {
                this.m_remoteBundleIndicesMap = new BundleIndicesMap(serverBundleMapInPersistentPath);
                string localRemoteBundlemapIdentify = m_remoteBundleIndicesMap.GetBundleMapInfo(BundleIndicesMap.BundleMapKey.BUNDLEMAP_IDENTIFY);
                ResourceModule.Instance.DownloadBufferFromServer(SysConf.SQLITE_BUNDLE_MAP_HASH, (serverBundlemapHash) =>
                {
                    string latestBundlemapIdentify = Encoding.Default.GetString(serverBundlemapHash);
                    if (latestBundlemapIdentify == localRemoteBundlemapIdentify)
                    {
                        syncRemoteBundlemapCallback();
                    }
                    else
                    {
                        this.m_remoteBundleIndicesMap.Dispose();
                        DownloadRemoteBundleMap(syncRemoteBundlemapCallback);
                    }
                }, (bundlemap) =>
                {
                    SyncRemoteBundlemap(syncRemoteBundlemapCallback);
                });
            }
            else
            {
                DownloadRemoteBundleMap(syncRemoteBundlemapCallback);
            }
        }
Exemplo n.º 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);
            }
        }