update runtime code

pull/62/head
hevinci 2022-12-17 18:13:08 +08:00
parent b287dfedcf
commit fc55b1be82
6 changed files with 65 additions and 65 deletions

View File

@ -71,7 +71,7 @@ namespace YooAsset
if (_steps == ESteps.CheckLoadedManifest)
{
if (_impl.LocalPatchManifest == null)
if (_impl.ActivePatchManifest == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
@ -88,7 +88,7 @@ namespace YooAsset
#if UNITY_WEBGL
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
#else
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices);
#endif
OperationSystem.StartOperation(_verifyOperation);

View File

@ -70,7 +70,7 @@ namespace YooAsset
{
var manifest = _deserializer.Manifest;
InitializedPackageVersion = manifest.PackageVersion;
_impl.SetSimulatePatchManifest(manifest);
_impl.SetActivePatchManifest(manifest);
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
@ -160,7 +160,7 @@ namespace YooAsset
else
{
InitializedPackageVersion = manifest.PackageVersion;
_impl.SetAppPatchManifest(manifest);
_impl.SetActivePatchManifest(manifest);
_steps = ESteps.StartVerifyOperation;
}
}
@ -170,7 +170,7 @@ namespace YooAsset
#if UNITY_WEBGL
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.AppPatchManifest, null);
#else
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.AppPatchManifest, null);
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, null);
#endif
OperationSystem.StartOperation(_verifyOperation);
@ -263,7 +263,7 @@ namespace YooAsset
if (manifest != null)
{
InitializedPackageVersion = manifest.PackageVersion;
_impl.SetLocalPatchManifest(manifest);
_impl.SetActivePatchManifest(manifest);
_steps = ESteps.StartVerifyOperation;
}
else
@ -332,7 +332,7 @@ namespace YooAsset
else
{
InitializedPackageVersion = manifest.PackageVersion;
_impl.SetLocalPatchManifest(manifest);
_impl.SetActivePatchManifest(manifest);
_steps = ESteps.StartVerifyOperation;
}
}
@ -342,7 +342,7 @@ namespace YooAsset
#if UNITY_WEBGL
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
#else
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices);
#endif
OperationSystem.StartOperation(_verifyOperation);

View File

@ -191,7 +191,7 @@ namespace YooAsset
{
if (_deserializer.Status == EOperationStatus.Succeed)
{
_impl.SetLocalPatchManifest(_deserializer.Manifest);
_impl.SetActivePatchManifest(_deserializer.Manifest);
FoundNewManifest = true;
_steps = ESteps.StartVerifyOperation;
}
@ -209,7 +209,7 @@ namespace YooAsset
#if UNITY_WEBGL
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
#else
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices);
#endif
OperationSystem.StartOperation(_verifyOperation);

View File

@ -6,7 +6,7 @@ namespace YooAsset
{
internal class EditorSimulateModeImpl : IBundleServices
{
private PatchManifest _simulatePatchManifest;
public PatchManifest ActivePatchManifest { private set; get; }
private bool _locationToLower;
/// <summary>
@ -25,15 +25,15 @@ namespace YooAsset
/// </summary>
public string GetPackageVersion()
{
if (_simulatePatchManifest == null)
if (ActivePatchManifest == null)
return string.Empty;
return _simulatePatchManifest.PackageVersion;
return ActivePatchManifest.PackageVersion;
}
internal void SetSimulatePatchManifest(PatchManifest patchManifest)
internal void SetActivePatchManifest(PatchManifest patchManifest)
{
_simulatePatchManifest = patchManifest;
_simulatePatchManifest.InitAssetPathMapping(_locationToLower);
ActivePatchManifest = patchManifest;
ActivePatchManifest.InitAssetPathMapping(_locationToLower);
}
#region IBundleServices接口
@ -43,7 +43,7 @@ namespace YooAsset
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
var patchBundle = _simulatePatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
var patchBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromEditor, assetInfo.AssetPath);
return bundleInfo;
}
@ -53,34 +53,34 @@ namespace YooAsset
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return _simulatePatchManifest.GetAssetsInfoByTags(tags);
return ActivePatchManifest.GetAssetsInfoByTags(tags);
}
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
{
if (_simulatePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
return patchAsset;
else
return null;
}
string IBundleServices.MappingToAssetPath(string location)
{
return _simulatePatchManifest.MappingToAssetPath(location);
return ActivePatchManifest.MappingToAssetPath(location);
}
string IBundleServices.TryMappingToAssetPath(string location)
{
return _simulatePatchManifest.TryMappingToAssetPath(location);
return ActivePatchManifest.TryMappingToAssetPath(location);
}
string IBundleServices.GetPackageName()
{
return _simulatePatchManifest.PackageName;
return ActivePatchManifest.PackageName;
}
bool IBundleServices.IsIncludeBundleFile(string fileName)
{
return _simulatePatchManifest.IsIncludeBundleFile(fileName);
return ActivePatchManifest.IsIncludeBundleFile(fileName);
}
bool IBundleServices.IsServicesValid()
{
return _simulatePatchManifest != null;
return ActivePatchManifest != null;
}
#endregion
}

View File

@ -8,7 +8,7 @@ namespace YooAsset
internal class HostPlayModeImpl : IBundleServices
{
// 补丁清单
internal PatchManifest LocalPatchManifest { private set; get; }
public PatchManifest ActivePatchManifest { private set; get; }
// 参数相关
private bool _locationToLower;
@ -36,9 +36,9 @@ namespace YooAsset
/// </summary>
public string GetPackageVersion()
{
if (LocalPatchManifest == null)
if (ActivePatchManifest == null)
return string.Empty;
return LocalPatchManifest.PackageVersion;
return ActivePatchManifest.PackageVersion;
}
/// <summary>
@ -86,7 +86,7 @@ namespace YooAsset
/// </summary>
public PatchDownloaderOperation CreatePatchDownloaderByAll(int fileLoadingMaxNumber, int failedTryAgain, int timeout)
{
YooLogger.Log($"Create patch downloader : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}");
YooLogger.Log($"Create patch downloader : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}");
List<BundleInfo> downloadList = GetDownloadListByAll();
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
return operation;
@ -94,7 +94,7 @@ namespace YooAsset
private List<BundleInfo> GetDownloadListByAll()
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in LocalPatchManifest.BundleList)
foreach (var patchBundle in ActivePatchManifest.BundleList)
{
// 忽略缓存文件
if (CacheSystem.IsCached(patchBundle))
@ -115,7 +115,7 @@ namespace YooAsset
/// </summary>
public PatchDownloaderOperation CreatePatchDownloaderByTags(string[] tags, int fileLoadingMaxNumber, int failedTryAgain, int timeout)
{
YooLogger.Log($"Create patch downloader : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}");
YooLogger.Log($"Create patch downloader : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}");
List<BundleInfo> downloadList = GetDownloadListByTags(tags);
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
return operation;
@ -123,7 +123,7 @@ namespace YooAsset
private List<BundleInfo> GetDownloadListByTags(string[] tags)
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in LocalPatchManifest.BundleList)
foreach (var patchBundle in ActivePatchManifest.BundleList)
{
// 忽略缓存文件
if (CacheSystem.IsCached(patchBundle))
@ -156,7 +156,7 @@ namespace YooAsset
/// </summary>
public PatchDownloaderOperation CreatePatchDownloaderByPaths(AssetInfo[] assetInfos, int fileLoadingMaxNumber, int failedTryAgain, int timeout)
{
YooLogger.Log($"Create patch downloader : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}");
YooLogger.Log($"Create patch downloader : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}");
List<BundleInfo> downloadList = GetDownloadListByPaths(assetInfos);
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
return operation;
@ -174,12 +174,12 @@ namespace YooAsset
}
// 注意:如果补丁清单里未找到资源包会抛出异常!
PatchBundle mainBundle = LocalPatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
PatchBundle mainBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
if (checkList.Contains(mainBundle) == false)
checkList.Add(mainBundle);
// 注意:如果补丁清单里未找到资源包会抛出异常!
PatchBundle[] dependBundles = LocalPatchManifest.GetAllDependencies(assetInfo.AssetPath);
PatchBundle[] dependBundles = ActivePatchManifest.GetAllDependencies(assetInfo.AssetPath);
foreach (var dependBundle in dependBundles)
{
if (checkList.Contains(dependBundle) == false)
@ -209,7 +209,7 @@ namespace YooAsset
/// </summary>
public PatchUnpackerOperation CreatePatchUnpackerByTags(string[] tags, int fileUpackingMaxNumber, int failedTryAgain, int timeout)
{
YooLogger.Log($"Create patch unpacker : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}");
YooLogger.Log($"Create patch unpacker : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}");
List<BundleInfo> unpcakList = GetUnpackListByTags(tags);
var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain, timeout);
return operation;
@ -217,7 +217,7 @@ namespace YooAsset
private List<BundleInfo> GetUnpackListByTags(string[] tags)
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in LocalPatchManifest.BundleList)
foreach (var patchBundle in ActivePatchManifest.BundleList)
{
// 忽略缓存文件
if (CacheSystem.IsCached(patchBundle))
@ -241,7 +241,7 @@ namespace YooAsset
/// </summary>
public PatchUnpackerOperation CreatePatchUnpackerByAll(int fileUpackingMaxNumber, int failedTryAgain, int timeout)
{
YooLogger.Log($"Create patch unpacker : {LocalPatchManifest.PackageName} {LocalPatchManifest.PackageVersion}");
YooLogger.Log($"Create patch unpacker : {ActivePatchManifest.PackageName} {ActivePatchManifest.PackageVersion}");
List<BundleInfo> unpcakList = GetUnpackListByAll();
var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain, timeout);
return operation;
@ -249,7 +249,7 @@ namespace YooAsset
private List<BundleInfo> GetUnpackListByAll()
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in LocalPatchManifest.BundleList)
foreach (var patchBundle in ActivePatchManifest.BundleList)
{
// 忽略缓存文件
if (CacheSystem.IsCached(patchBundle))
@ -312,10 +312,10 @@ namespace YooAsset
return bundleInfo;
}
internal void SetLocalPatchManifest(PatchManifest patchManifest)
internal void SetActivePatchManifest(PatchManifest patchManifest)
{
LocalPatchManifest = patchManifest;
LocalPatchManifest.InitAssetPathMapping(_locationToLower);
ActivePatchManifest = patchManifest;
ActivePatchManifest.InitAssetPathMapping(_locationToLower);
}
internal bool IsBuildinPatchBundle(PatchBundle patchBundle)
{
@ -351,7 +351,7 @@ namespace YooAsset
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
var patchBundle = LocalPatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
var patchBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
return CreateBundleInfo(patchBundle);
}
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
@ -360,7 +360,7 @@ namespace YooAsset
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
var depends = LocalPatchManifest.GetAllDependencies(assetInfo.AssetPath);
var depends = ActivePatchManifest.GetAllDependencies(assetInfo.AssetPath);
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
foreach (var patchBundle in depends)
{
@ -371,34 +371,34 @@ namespace YooAsset
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return LocalPatchManifest.GetAssetsInfoByTags(tags);
return ActivePatchManifest.GetAssetsInfoByTags(tags);
}
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
{
if (LocalPatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
return patchAsset;
else
return null;
}
string IBundleServices.MappingToAssetPath(string location)
{
return LocalPatchManifest.MappingToAssetPath(location);
return ActivePatchManifest.MappingToAssetPath(location);
}
string IBundleServices.TryMappingToAssetPath(string location)
{
return LocalPatchManifest.TryMappingToAssetPath(location);
return ActivePatchManifest.TryMappingToAssetPath(location);
}
string IBundleServices.GetPackageName()
{
return LocalPatchManifest.PackageName;
return ActivePatchManifest.PackageName;
}
bool IBundleServices.IsIncludeBundleFile(string fileName)
{
return LocalPatchManifest.IsIncludeBundleFile(fileName);
return ActivePatchManifest.IsIncludeBundleFile(fileName);
}
bool IBundleServices.IsServicesValid()
{
return LocalPatchManifest != null;
return ActivePatchManifest != null;
}
#endregion
}

View File

@ -7,7 +7,7 @@ namespace YooAsset
{
internal class OfflinePlayModeImpl : IBundleServices
{
public PatchManifest AppPatchManifest { private set; get; }
public PatchManifest ActivePatchManifest { private set; get; }
private bool _locationToLower;
/// <summary>
@ -26,15 +26,15 @@ namespace YooAsset
/// </summary>
public string GetPackageVersion()
{
if (AppPatchManifest == null)
if (ActivePatchManifest == null)
return string.Empty;
return AppPatchManifest.PackageVersion;
return ActivePatchManifest.PackageVersion;
}
internal void SetAppPatchManifest(PatchManifest patchManifest)
internal void SetActivePatchManifest(PatchManifest patchManifest)
{
AppPatchManifest = patchManifest;
AppPatchManifest.InitAssetPathMapping(_locationToLower);
ActivePatchManifest = patchManifest;
ActivePatchManifest.InitAssetPathMapping(_locationToLower);
}
#region IBundleServices接口
@ -62,7 +62,7 @@ namespace YooAsset
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
var patchBundle = AppPatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
var patchBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
return CreateBundleInfo(patchBundle);
}
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
@ -71,7 +71,7 @@ namespace YooAsset
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
var depends = AppPatchManifest.GetAllDependencies(assetInfo.AssetPath);
var depends = ActivePatchManifest.GetAllDependencies(assetInfo.AssetPath);
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
foreach (var patchBundle in depends)
{
@ -82,34 +82,34 @@ namespace YooAsset
}
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
{
return AppPatchManifest.GetAssetsInfoByTags(tags);
return ActivePatchManifest.GetAssetsInfoByTags(tags);
}
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
{
if (AppPatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
return patchAsset;
else
return null;
}
string IBundleServices.MappingToAssetPath(string location)
{
return AppPatchManifest.MappingToAssetPath(location);
return ActivePatchManifest.MappingToAssetPath(location);
}
string IBundleServices.TryMappingToAssetPath(string location)
{
return AppPatchManifest.TryMappingToAssetPath(location);
return ActivePatchManifest.TryMappingToAssetPath(location);
}
string IBundleServices.GetPackageName()
{
return AppPatchManifest.PackageName;
return ActivePatchManifest.PackageName;
}
bool IBundleServices.IsIncludeBundleFile(string fileName)
{
return AppPatchManifest.IsIncludeBundleFile(fileName);
return ActivePatchManifest.IsIncludeBundleFile(fileName);
}
bool IBundleServices.IsServicesValid()
{
return AppPatchManifest != null;
return ActivePatchManifest != null;
}
#endregion
}