Beispiel #1
0
        /// <summary>
        ///  res config 配置文件 和 资源文件不在同一目录下时使用该方法
        /// </summary>
        /// <param name="remoteConfigPath"></param>
        /// <param name="localConfigPath"></param>
        /// <param name="remoteResPath"></param>
        /// <param name="localResPath"></param>
        /// <param name="readyToDownload"></param>
        /// <param name="finishedOneItem"></param>
        /// <param name="updateFinish"></param>
        /// <param name="onDownloadProgress"></param>
        /// <param name="checkVersion">是否判断res config的版本号;false:忽略版本号对比;true:进行版本号对比</param>
        /// <param name="checkItemExist">文件如果存在就不下载,不存在的时候再下载</param>
        public void StartModuleUpdate(string remoteConfigPath, string localConfigPath, string remoteResPath, string localResPath,
                                      Action <int, float> readyToDownload, Action <int, int> finishedOneItem, Action <UpdateStatus, string, ResUpdateData> updateFinish,
                                      Action <float, float> onDownloadProgress, bool checkVersion, bool checkItemExist)
        {
            this.gameObject.AddSingleComponent <PTModuleUpdateDispatcher>();
            mResDown = this.gameObject.AddSingleComponent <PTModuleResDown>();

            Reset();

            this.mOnReadyToDownload  = readyToDownload;
            this.mOnFinishedOneItem  = finishedOneItem;
            this.mOnUpdateFinish     = updateFinish;
            this.mOnDownloadProgress = onDownloadProgress;


            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                OnResUpdateCallback(new ResUpdateData()
                {
                    status = UpdateStatus.Failed, msg = "没有网络"
                });
                return;
            }

            mResDown.StartResUpdate(remoteConfigPath, localConfigPath, remoteResPath, localResPath, OnResUpdateCallback, checkVersion, checkItemExist);
        }
Beispiel #2
0
 public DownloadThread(PTModuleResDown moduleResDown)
 {
     this.moduleResDown = moduleResDown;
 }