Пример #1
0
        /// <summary>
        /// 下载
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="sizeData"></param>
        /// <param name="finishCallBack"></param>
        public void BeginDownLoadAsset(DownLoadType type, AssetUpdateMgr parent, DownloadAssetSizeCaculate sizeData, FinishDelegate finishCallBack)
        {
            mDownloadType = type;
            mParent       = parent;
            mCurrentDownloadAssetSizeCaculate = sizeData;
            mFinishCallBack = finishCallBack;

            if (null == sizeData.mVersionDataConfig || 0 == sizeData.mVersionDataConfig.Count)
            {
                CallBackDownLoadSucess();

                return;
            }

            mNewVersionDataConfig = sizeData.mVersionDataConfig;
            mAllVersionDataDic.Clear();

            if (mDownloadType == DownLoadType.FIRST_PHASE && null != mParent)
            {
                mParent.UpdateProgress("开始下载更新资源文件", 0);
            }

            mMaxDownLoadCount = mDownloadType == DownLoadType.FIRST_PHASE ? 8 : 3;
            DownLoadAsset();
            mDownLoadAssetCount = mNewVersionDataConfig.Count;
        }
Пример #2
0
        public void GetVersion(DownLoadTxtFileCallBack finishCallback, AssetUpdateMgr parent)
        {
            mParent         = parent;
            mFinishCallback = finishCallback;

            new TextDownLoadTask(BundleCommon.RootUrl + BundleCommon.RootUrlVersionFileName, GetVersionCallback, UpdateGetVersionProgress);
        }
Пример #3
0
        /// <summary>
        /// 获取远程更新地址
        /// </summary>
        /// <param name="finishCallback"></param>
        /// <param name="parent"></param>
        public void GetRemoteDownloadUrl(DownLoadTxtFileCallBack finishCallback, AssetUpdateMgr parent)
        {
            mParent         = parent;
            mFinishCallback = finishCallback;

            new TextDownLoadTask(BundleCommon.RootUrl + BundleCommon.RootUrlFileName, GetUrlCallback, UpdateGetUrlProgress);
        }
Пример #4
0
        public void BeginCompare(AssetUpdateMgr parent, CompareBundleVersionCallBack callBack)
        {
            mParent         = parent;
            mFinishCallBack = callBack;

            mABFileMgr = ABFileMgr.Instance;

            mFValue = 0f;
            UpdateLoadCompressProgress(0f);
            DownloadManifest();
        }
Пример #5
0
        public void DoStreamAssetDecompress(AssetUpdateMgr parent, Action finishCallback)
        {
            LogMgr.UnityError(Time.realtimeSinceStartup.ToString());

            mParent         = parent;
            mFinishCallback = finishCallback;

            mParent.UpdateProgress("正从本地解压缩资源(此过程不消耗流量)", 0f);

            mStreamFiles.Clear();
            string abtoFile = string.Format("{0}/{1}/Inner/{2}", Application.persistentDataPath, BundleCommon.ResVersion, BundleCommon.AssetBundleManifest);

            if (!File.Exists(abtoFile))
            {
                mStreamFiles.Add("/" + BundleCommon.AssetBundleManifest);
            }

            List <AssetBundleConfig> streamConfigs = XMLTool.LoadAllABConfig(BundleCommon.StreamUserVersionPath, true);

            if (null != streamConfigs)
            {
                for (int i = 0; i < streamConfigs.Count; i++)
                {
                    string toFilePath = Application.persistentDataPath + "/" + BundleCommon.ResVersion + "/Inner" + streamConfigs[i].RelativePath;
                    string toFileDir  = toFilePath.Remove(toFilePath.LastIndexOf("/"));
                    if (!Directory.Exists(toFileDir))
                    {
                        Directory.CreateDirectory(toFileDir);
                    }

                    if (!File.Exists(toFilePath))
                    {
                        mStreamFiles.Add(streamConfigs[i].RelativePath);
                    }
                }
            }
            mCurCopyNum    = 0;
            mMaxCopyNum    = 5;
            mFinishCopyNum = 0;
            mTotalCopyNum  = mStreamFiles.Count;
            if (mTotalCopyNum != 0)
            {
                CopyAsset();
            }
            else
            {
                mParent.UpdateProgress("正从本地解压缩资源(此过程不消耗流量)", 1f);
                if (null != mFinishCallback)
                {
                    mFinishCallback();
                }
            }
        }