Beispiel #1
0
        /// <summary>
        ///  res config配置文件 和 资源文件 位于 同一目录下时使用该方法
        /// </summary>
        /// <param name="remoteConfigFilePath">远程配置文件路径</param>
        /// <param name="localConfigFilePath">本地配置文件路径</param>
        /// <param name="callback"></param>
        /// <param name="checkVersion">是否判断res config的版本号,false:忽略版本号检测</param>
        /// <param name="checkItemExist">文件如果存在就不下载,不存在的时候再下载</param>
        public void StartResUpdate(string remoteConfigFilePath, string localConfigFilePath, Action <ResUpdateData> callback,
                                   bool checkVersion = true, bool checkItemExist = false)
        {
            mCheckVersion = checkVersion;

            mCheckItemExist = checkItemExist;

            onUpdateResCallback = callback;

            mRemoteResPath = remoteConfigFilePath.Substring(0, remoteConfigFilePath.LastIndexOf("/"));

            mLocalConfigFilePath = localConfigFilePath;

            mLocalResPath = Path.GetDirectoryName(localConfigFilePath);

            mResUpdateData = new ResUpdateData();

            mUpdateItems = new Queue <ResItem>();

            mLocalTempDir = Application.persistentDataPath + "/" + TempModuleResDir;

            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

            StartCoroutine(PTModuleUpdateUtil.GetTextFromServer(remoteConfigFilePath, 3, OnGetServerConfigCallback));
        }
Beispiel #2
0
 private void FinishDownLoadAll()
 {
     PTModuleUpdateUtil.DirectoryCopy(mLocalTempDir, mLocalResPath, true, true);             //从temp复制文件到最终assetbundle加载目录
     SaveServerConfig();
     //移除临时下载文件
     if (Directory.Exists(mLocalTempDir))
     {
         Directory.Delete(mLocalTempDir, true);
     }
     ResUpdateCallback(UpdateStatus.Success, "FinishDownloadRes");
 }