Update runtime logic
This commit is contained in:
@@ -134,75 +134,15 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
internal sealed class HostPlayModeInitializationOperation : InitializationOperation
|
||||
{
|
||||
private enum ESteps
|
||||
internal HostPlayModeInitializationOperation()
|
||||
{
|
||||
None,
|
||||
LoadManifest,
|
||||
CopyManifest,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly HostPlayModeImpl _impl;
|
||||
private readonly string _buildinPackageName;
|
||||
private AppManifestLoader _appManifestLoader;
|
||||
private AppManifestCopyer _appManifestCopyer;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal HostPlayModeInitializationOperation(HostPlayModeImpl impl, string buildinPackageName)
|
||||
{
|
||||
_impl = impl;
|
||||
_buildinPackageName = buildinPackageName;
|
||||
_appManifestLoader = new AppManifestLoader(buildinPackageName);
|
||||
}
|
||||
internal override void Start()
|
||||
{
|
||||
_steps = ESteps.LoadManifest;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void Update()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.LoadManifest)
|
||||
{
|
||||
_appManifestLoader.Update();
|
||||
Progress = _appManifestLoader.Progress();
|
||||
if (_appManifestLoader.IsDone() == false)
|
||||
return;
|
||||
|
||||
if (_appManifestLoader.Result == null)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _appManifestLoader.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
_impl.SetAppPatchManifest(_appManifestLoader.Result);
|
||||
_impl.SetLocalPatchManifest(_appManifestLoader.Result);
|
||||
_appManifestCopyer = new AppManifestCopyer(_buildinPackageName, _appManifestLoader.BuildinPackageCRC);
|
||||
_steps = ESteps.CopyManifest;
|
||||
}
|
||||
}
|
||||
|
||||
if (_steps == ESteps.CopyManifest)
|
||||
{
|
||||
_appManifestCopyer.Update();
|
||||
if (_appManifestCopyer.IsDone() == false)
|
||||
return;
|
||||
|
||||
if (_appManifestCopyer.Result == false)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _appManifestCopyer.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.InitVerifyingCache)
|
||||
{
|
||||
_patchCacheVerifier.InitVerifier(_impl.AppPatchManifest, _impl.LocalPatchManifest, false);
|
||||
_patchCacheVerifier.InitVerifier(_impl, false);
|
||||
_verifyTime = UnityEngine.Time.realtimeSinceStartup;
|
||||
_steps = ESteps.UpdateVerifyingCache;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.InitVerifyingCache)
|
||||
{
|
||||
if (_patchCacheVerifier.InitVerifier(_impl.AppPatchManifest, _impl.LocalPatchManifest, true))
|
||||
if (_patchCacheVerifier.InitVerifier(_impl, true))
|
||||
{
|
||||
_verifyTime = UnityEngine.Time.realtimeSinceStartup;
|
||||
_steps = ESteps.UpdateVerifyingCache;
|
||||
|
||||
@@ -205,12 +205,8 @@ namespace YooAsset
|
||||
continue;
|
||||
|
||||
// 忽略APP资源
|
||||
// 注意:如果是APP资源并且哈希值相同,则不需要下载
|
||||
if (_impl.AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle))
|
||||
{
|
||||
if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle))
|
||||
continue;
|
||||
}
|
||||
if (_impl.IsBuildinPatchBundle(patchBundle))
|
||||
continue;
|
||||
|
||||
downloadList.Add(patchBundle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user