Ejemplo n.º 1
0
        /// <summary>
        /// 以客户端安装包默认的资源版本配置为基准创建一个新的本地缓存
        /// </summary>
        /// <param name="remoteVersions"></param>
        public void CreateVersionsCached(ref ResDataVersion remoteVersions)
        {
            string path = AppPaths.PersistentResDataRoot.Append(ResDataVersion.FILE_RES_DATA_VERSIONS_NAME);
            string data = FileOperater.ReadUTF8Text(path);

            ResDataVersion temp = JsonUtility.FromJson <ResDataVersion>(data);

            if (temp == default || temp.IsVersionsEmpty())
            {
#if LOG_CLIENT_VERSIONING
                "log".Log("Verision data is empty, will create new one.");
#endif
                temp = new ResDataVersion
                {
                    res_gateway = remoteVersions.res_gateway,
                    app_version = remoteVersions.app_version,
                    res_version = remoteVersions.res_version
                };

                ResDataVersion client = Versions;
                temp.CloneVersionsFrom(ref client);
            }
            else
            {
            }

            CachedVersion = temp;
            CachedVersion.resVersionType = ResDataVersionType.Cached;
        }
Ejemplo n.º 2
0
 private void GetVersionDataFromRemote(ref ResDataVersion remoteVers, ref string versions, ref ResDataVersion resDataVersion)
 {
     if (remoteVers == default)
     {
         versions       = FileOperater.ReadUTF8Text(AppPaths.ABBuildOutputRoot.Append(ResDataVersion.FILE_RES_DATA_VERSIONS_NAME));
         resDataVersion = JsonUtility.FromJson <ResDataVersion>(versions);
         if (resDataVersion == default)
         {
             resDataVersion = new ResDataVersion
             {
                 app_version = Application.version,
                 res_version = remoteVers != default ? remoteVers.res_version : 0,//根据是否存在线上版本同步资源号
             };
         }
     }
     else
     {
         resDataVersion = new ResDataVersion();
         resDataVersion.CloneVersionsFrom(ref remoteVers);
     }
 }