void IModule.OnCreate(System.Object param) { CreateParameters createParam = param as CreateParameters; if (createParam == null) { throw new Exception($"{nameof(PatchManager)} create param is invalid."); } if (createParam.ServerInfo == null) { throw new Exception("ServerInfo is null"); } // 注册变体规则 if (createParam.VariantRules != null) { _variantCollector = new VariantCollector(); foreach (var variantRule in createParam.VariantRules) { _variantCollector.RegisterVariantRule(variantRule.VariantGroup, variantRule.TargetVariant); } } // 创建补丁管理器实现类 _patcher = new PatchManagerImpl(); _patcher.Create(createParam); }
internal PatchDownloader(PatchManagerImpl patcher, List <PatchBundle> downloadList, int maxNumberOnLoad) { _patcher = patcher; _downloadList = downloadList; _maxNumberOnLoad = UnityEngine.Mathf.Clamp(maxNumberOnLoad, 1, MAX_LOADER_COUNT);; DownloadStates = EDownloaderStates.None; TotalDownloadCount = downloadList.Count; foreach (var element in downloadList) { TotalDownloadBytes += element.SizeBytes; } }
internal PatchDownloader(PatchManagerImpl patcherMgr, List <PatchBundle> downloadList, int maxNumberOnLoad, int failedTryAgain) { _patcherMgr = patcherMgr; _downloadList = downloadList; _maxNumberOnLoad = UnityEngine.Mathf.Clamp(maxNumberOnLoad, 1, MAX_LOADER_COUNT);; _failedTryAgain = failedTryAgain; DownloadStates = EDownloaderStates.None; TotalDownloadCount = downloadList.Count; foreach (var patchBundle in downloadList) { TotalDownloadBytes += patchBundle.SizeBytes; } }
void IModule.OnCreate(System.Object param) { CreateParameters createParam = param as CreateParameters; if (createParam == null) { throw new Exception($"{nameof(PatchManager)} create param is invalid."); } _patcher = new PatchManagerImpl(); _patcher.Initialize(createParam); _variantCollector = new VariantCollector(); if (createParam.VariantRules != null) { foreach (var variantRule in createParam.VariantRules) { _variantCollector.RegisterVariantRule(variantRule.VariantGroup, variantRule.TargetVariant); } } }
void IModule.OnCreate(System.Object param) { CreateParameters createParam = param as CreateParameters; if (createParam == null) { throw new Exception($"{nameof(PatchManager)} create param is invalid."); } if (createParam.ServerInfo == null) { throw new Exception("ServerInfo is null"); } if (createParam.GameVersionParser == null) { throw new Exception($"{nameof(IGameVersionParser)} is null."); } // 创建补丁管理器实现类 _patcher = new PatchManagerImpl(); _patcher.Create(createParam); }
/// <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); } }
public FsmDownloadWebFiles(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.DownloadWebFiles.ToString(); }
public FsmRequestGameVersion(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.RequestGameVersion.ToString(); }
public FsmGetDonwloadList(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.GetDonwloadList.ToString(); }
public FsmInitiationBegin(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.InitiationBegin.ToString(); }
public FsmGetWebPatchManifest(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.GetWebPatchManifest.ToString(); }
public FsmDownloadOver(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.DownloadOver.ToString(); }
public FsmParseAppPatchManifest(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.ParseAppPatchManifest.ToString(); }
public FsmDownloadWebPatchManifest(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.DownloadWebPatchManifest.ToString(); }
public FsmRequestPatchManifest(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.RequestPatchManifest.ToString(); }
public FsmCheckSandboxDirty(PatchManagerImpl patcher) { _patcher = patcher; Name = EPatchStates.CheckSandboxDirty.ToString(); }