update patch system

UpdatePackageManifestOperation增加新方法FlushManifestVersionFile()
pull/86/head
hevinci 2023-03-22 18:48:52 +08:00
parent 027ae02aa0
commit 91fe51d10a
5 changed files with 23 additions and 11 deletions

View File

@ -9,6 +9,10 @@ namespace YooAsset
/// </summary> /// </summary>
public abstract class UpdatePackageManifestOperation : AsyncOperationBase public abstract class UpdatePackageManifestOperation : AsyncOperationBase
{ {
/// <summary>
/// 保存清单版本文件到沙盒
/// </summary>
public virtual void FlushManifestVersionFile() { }
} }
/// <summary> /// <summary>
@ -173,5 +177,10 @@ namespace YooAsset
} }
} }
} }
public override void FlushManifestVersionFile()
{
_impl.FlushManifestVersionFile();
}
} }
} }

View File

@ -33,9 +33,8 @@ namespace YooAsset
return _activeManifest; return _activeManifest;
} }
} }
public bool IsBuildinPackageBundle(PackageBundle packageBundle) public void FlushManifestVersionFile()
{ {
return true;
} }
UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout) UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout)

View File

@ -84,22 +84,27 @@ namespace YooAsset
{ {
_activeManifest = value; _activeManifest = value;
_activeManifest.InitAssetPathMapping(_locationToLower); _activeManifest.InitAssetPathMapping(_locationToLower);
PersistentHelper.SaveCachePackageVersionFile(_packageName, _activeManifest.PackageVersion);
} }
get get
{ {
return _activeManifest; return _activeManifest;
} }
} }
public bool IsBuildinPackageBundle(PackageBundle packageBundle) public void FlushManifestVersionFile()
{
if (_activeManifest != null)
PersistentHelper.SaveCachePackageVersionFile(_packageName, _activeManifest.PackageVersion);
}
private bool IsBuildinPackageBundle(PackageBundle packageBundle)
{ {
return _queryServices.QueryStreamingAssets(packageBundle.FileName); return _queryServices.QueryStreamingAssets(packageBundle.FileName);
} }
public bool IsCachedPackageBundle(PackageBundle packageBundle) private bool IsCachedPackageBundle(PackageBundle packageBundle)
{ {
return CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID); return CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID);
} }
UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout) UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout)
{ {
var operation = new HostPlayModeUpdatePackageVersionOperation(this, _packageName, appendTimeTicks, timeout); var operation = new HostPlayModeUpdatePackageVersionOperation(this, _packageName, appendTimeTicks, timeout);

View File

@ -33,9 +33,8 @@ namespace YooAsset
return _activeManifest; return _activeManifest;
} }
} }
public bool IsBuildinPackageBundle(PackageBundle packageBundle) public void FlushManifestVersionFile()
{ {
return true;
} }
UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout) UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout)

View File

@ -7,11 +7,11 @@ namespace YooAsset
/// 激活的清单 /// 激活的清单
/// </summary> /// </summary>
PackageManifest ActiveManifest { set; get; } PackageManifest ActiveManifest { set; get; }
/// <summary> /// <summary>
/// 是否为内置资源文件 /// 保存清单版本文件到沙盒
/// </summary> /// </summary>
bool IsBuildinPackageBundle(PackageBundle packageBundle); void FlushManifestVersionFile();
/// <summary> /// <summary>
/// 向网络端请求最新的资源版本 /// 向网络端请求最新的资源版本