void IFsmNode.OnEnter()
        {
            PatchEventDispatcher.SendPatchStatesChangeMsg(EPatchStates.ParseSandboxPatchManifest);

            // 读取并解析沙盒内的补丁清单
            if (PatchHelper.CheckSandboxPatchManifestFileExist())
            {
                string filePath    = AssetPathHelper.MakePersistentLoadPath(PatchDefine.PatchManifestFileName);
                string fileContent = PatchHelper.ReadFile(filePath);

                PatchHelper.Log(ELogLevel.Log, $"Parse sandbox patch file.");
                _patcher.ParseSandboxPatchManifest(fileContent);
            }
            else
            {
                _patcher.ParseSandboxPatchManifest(_patcher.AppPatchManifest);
            }

            _patcher.SwitchNext();
        }
예제 #2
0
        /// <summary>
        /// 异步初始化
        /// </summary>
        public IEnumerator InitializeAync(PatchManagerImpl patcher)
        {
            // 处理沙盒被污染
            ProcessSandboxDirty();

            // 分析APP内的补丁清单
            {
                string         filePath   = AssetPathHelper.MakeStreamingLoadPath(PatchDefine.PatchManifestBytesFileName);
                string         url        = AssetPathHelper.ConvertToWWWPath(filePath);
                WebDataRequest downloader = new WebDataRequest(url);
                yield return(downloader.DownLoad());

                if (downloader.States == EWebRequestStates.Success)
                {
                    MotionLog.Log("Parse app patch manifest.");
                    patcher.ParseAppPatchManifest(downloader.GetData());
                    downloader.Dispose();
                }
                else
                {
                    throw new System.Exception($"Fatal error : Failed download file : {url}");
                }
            }

            // 分析沙盒内的补丁清单
            if (PatchHelper.CheckSandboxPatchManifestFileExist())
            {
                string filePath = AssetPathHelper.MakePersistentLoadPath(PatchDefine.PatchManifestBytesFileName);
                byte[] fileData = File.ReadAllBytes(filePath);
                MotionLog.Log($"Parse sandbox patch file.");
                patcher.ParseSandboxPatchManifest(fileData);
            }
            else
            {
                patcher.ParseSandboxPatchManifest(patcher.AppPatchManifest);
            }
        }