コード例 #1
0
        /// <summary>
        /// 获取资源信息列表
        /// </summary>
        public static AssetInfo[] GetAssetsInfoByTags(PatchManifest patchManifest, string[] tags)
        {
            List <AssetInfo> result = new List <AssetInfo>(100);

            foreach (var patchAsset in patchManifest.AssetList)
            {
                if (patchAsset.HasTag(tags))
                {
                    AssetInfo assetInfo = new AssetInfo(patchAsset);
                    result.Add(assetInfo);
                }
            }
            return(result.ToArray());
        }
コード例 #2
0
        /// <summary>
        /// 解析并保存远端请求的补丁清单
        /// </summary>
        private bool ParseAndSaveRemotePatchManifest(int updateResourceVersion, string content)
        {
            try
            {
                var remotePatchManifest = PatchManifest.Deserialize(content);
                _impl.SetLocalPatchManifest(remotePatchManifest);

                YooLogger.Log("Save remote patch manifest file.");
                string savePath = PathHelper.MakePersistentLoadPath(YooAssetSettingsData.GetPatchManifestFileName(updateResourceVersion));
                PatchManifest.Serialize(savePath, remotePatchManifest);
                return(true);
            }
            catch (Exception e)
            {
                YooLogger.Error(e.ToString());
                return(false);
            }
        }
コード例 #3
0
 internal void SetLocalPatchManifest(PatchManifest patchManifest)
 {
     LocalPatchManifest = patchManifest;
     LocalPatchManifest.InitAssetPathMapping(_locationToLower);
 }
コード例 #4
0
 // 设置资源清单
 internal void SetAppPatchManifest(PatchManifest patchManifest)
 {
     AppPatchManifest = patchManifest;
 }
コード例 #5
0
 // 设置资源清单
 internal void SetSimulatePatchManifest(PatchManifest patchManifest)
 {
     _simulatePatchManifest = patchManifest;
     _simulatePatchManifest.InitAssetPathMapping(_locationToLower);
 }
コード例 #6
0
 // 设置资源清单
 internal void SetAppPatchManifest(PatchManifest patchManifest)
 {
     _appPatchManifest = patchManifest;
     _appPatchManifest.InitAssetPathMapping(_locationToLower);
 }
コード例 #7
0
        /// <summary>
        /// 序列化
        /// </summary>
        public static void Serialize(string savePath, PatchManifest patchManifest)
        {
            string json = JsonUtility.ToJson(patchManifest);

            FileUtility.CreateFile(savePath, json);
        }
コード例 #8
0
        public void Update()
        {
            if (IsDone())
            {
                return;
            }

            if (_steps == ESteps.LoadStaticVersion)
            {
                YooLogger.Log($"Load application static version.");
                string filePath = PathHelper.MakeStreamingLoadPath(YooAssetSettings.VersionFileName);
                string url      = PathHelper.ConvertToWWWPath(filePath);
                _downloader1 = new UnityWebDataRequester();
                _downloader1.SendRequest(url);
                _steps = ESteps.CheckStaticVersion;
            }

            if (_steps == ESteps.CheckStaticVersion)
            {
                if (_downloader1.IsDone() == false)
                {
                    return;
                }

                if (_downloader1.HasError())
                {
                    Error  = _downloader1.GetError();
                    _steps = ESteps.Failed;
                }
                else
                {
                    _staticVersion = int.Parse(_downloader1.GetText());
                    _steps         = ESteps.LoadAppManifest;
                }
                _downloader1.Dispose();
            }

            if (_steps == ESteps.LoadAppManifest)
            {
                YooLogger.Log($"Load application patch manifest.");
                string filePath = PathHelper.MakeStreamingLoadPath(YooAssetSettingsData.GetPatchManifestFileName(_staticVersion));
                string url      = PathHelper.ConvertToWWWPath(filePath);
                _downloader2 = new UnityWebDataRequester();
                _downloader2.SendRequest(url);
                _steps = ESteps.CheckAppManifest;
            }

            if (_steps == ESteps.CheckAppManifest)
            {
                if (_downloader2.IsDone() == false)
                {
                    return;
                }

                if (_downloader2.HasError())
                {
                    Error  = _downloader2.GetError();
                    _steps = ESteps.Failed;
                }
                else
                {
                    // 解析APP里的补丁清单
                    Result = PatchManifest.Deserialize(_downloader2.GetText());
                    _steps = ESteps.Succeed;
                }
                _downloader2.Dispose();
            }
        }