mirror of https://github.com/tuyoogame/YooAsset
update runtime code
parent
b287dfedcf
commit
fc55b1be82
|
@ -71,7 +71,7 @@ namespace YooAsset
|
||||||
|
|
||||||
if (_steps == ESteps.CheckLoadedManifest)
|
if (_steps == ESteps.CheckLoadedManifest)
|
||||||
{
|
{
|
||||||
if (_impl.LocalPatchManifest == null)
|
if (_impl.ActivePatchManifest == null)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
|
@ -88,7 +88,7 @@ namespace YooAsset
|
||||||
#if UNITY_WEBGL
|
#if UNITY_WEBGL
|
||||||
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
||||||
#else
|
#else
|
||||||
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OperationSystem.StartOperation(_verifyOperation);
|
OperationSystem.StartOperation(_verifyOperation);
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
var manifest = _deserializer.Manifest;
|
var manifest = _deserializer.Manifest;
|
||||||
InitializedPackageVersion = manifest.PackageVersion;
|
InitializedPackageVersion = manifest.PackageVersion;
|
||||||
_impl.SetSimulatePatchManifest(manifest);
|
_impl.SetActivePatchManifest(manifest);
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ namespace YooAsset
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InitializedPackageVersion = manifest.PackageVersion;
|
InitializedPackageVersion = manifest.PackageVersion;
|
||||||
_impl.SetAppPatchManifest(manifest);
|
_impl.SetActivePatchManifest(manifest);
|
||||||
_steps = ESteps.StartVerifyOperation;
|
_steps = ESteps.StartVerifyOperation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ namespace YooAsset
|
||||||
#if UNITY_WEBGL
|
#if UNITY_WEBGL
|
||||||
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.AppPatchManifest, null);
|
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.AppPatchManifest, null);
|
||||||
#else
|
#else
|
||||||
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.AppPatchManifest, null);
|
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, null);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OperationSystem.StartOperation(_verifyOperation);
|
OperationSystem.StartOperation(_verifyOperation);
|
||||||
|
@ -263,7 +263,7 @@ namespace YooAsset
|
||||||
if (manifest != null)
|
if (manifest != null)
|
||||||
{
|
{
|
||||||
InitializedPackageVersion = manifest.PackageVersion;
|
InitializedPackageVersion = manifest.PackageVersion;
|
||||||
_impl.SetLocalPatchManifest(manifest);
|
_impl.SetActivePatchManifest(manifest);
|
||||||
_steps = ESteps.StartVerifyOperation;
|
_steps = ESteps.StartVerifyOperation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -332,7 +332,7 @@ namespace YooAsset
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InitializedPackageVersion = manifest.PackageVersion;
|
InitializedPackageVersion = manifest.PackageVersion;
|
||||||
_impl.SetLocalPatchManifest(manifest);
|
_impl.SetActivePatchManifest(manifest);
|
||||||
_steps = ESteps.StartVerifyOperation;
|
_steps = ESteps.StartVerifyOperation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ namespace YooAsset
|
||||||
#if UNITY_WEBGL
|
#if UNITY_WEBGL
|
||||||
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
||||||
#else
|
#else
|
||||||
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OperationSystem.StartOperation(_verifyOperation);
|
OperationSystem.StartOperation(_verifyOperation);
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
if (_deserializer.Status == EOperationStatus.Succeed)
|
if (_deserializer.Status == EOperationStatus.Succeed)
|
||||||
{
|
{
|
||||||
_impl.SetLocalPatchManifest(_deserializer.Manifest);
|
_impl.SetActivePatchManifest(_deserializer.Manifest);
|
||||||
FoundNewManifest = true;
|
FoundNewManifest = true;
|
||||||
_steps = ESteps.StartVerifyOperation;
|
_steps = ESteps.StartVerifyOperation;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ namespace YooAsset
|
||||||
#if UNITY_WEBGL
|
#if UNITY_WEBGL
|
||||||
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
_verifyOperation = new CacheFilesVerifyWithoutThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
||||||
#else
|
#else
|
||||||
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.LocalPatchManifest, _impl.QueryServices);
|
_verifyOperation = new CacheFilesVerifyWithThreadOperation(_impl.ActivePatchManifest, _impl.QueryServices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OperationSystem.StartOperation(_verifyOperation);
|
OperationSystem.StartOperation(_verifyOperation);
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class EditorSimulateModeImpl : IBundleServices
|
internal class EditorSimulateModeImpl : IBundleServices
|
||||||
{
|
{
|
||||||
private PatchManifest _simulatePatchManifest;
|
public PatchManifest ActivePatchManifest { private set; get; }
|
||||||
private bool _locationToLower;
|
private bool _locationToLower;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -25,15 +25,15 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetPackageVersion()
|
public string GetPackageVersion()
|
||||||
{
|
{
|
||||||
if (_simulatePatchManifest == null)
|
if (ActivePatchManifest == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
return _simulatePatchManifest.PackageVersion;
|
return ActivePatchManifest.PackageVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetSimulatePatchManifest(PatchManifest patchManifest)
|
internal void SetActivePatchManifest(PatchManifest patchManifest)
|
||||||
{
|
{
|
||||||
_simulatePatchManifest = patchManifest;
|
ActivePatchManifest = patchManifest;
|
||||||
_simulatePatchManifest.InitAssetPathMapping(_locationToLower);
|
ActivePatchManifest.InitAssetPathMapping(_locationToLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IBundleServices接口
|
#region IBundleServices接口
|
||||||
|
@ -43,7 +43,7 @@ namespace YooAsset
|
||||||
throw new Exception("Should never get here !");
|
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);
|
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromEditor, assetInfo.AssetPath);
|
||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
}
|
}
|
||||||
|
@ -53,34 +53,34 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
||||||
{
|
{
|
||||||
return _simulatePatchManifest.GetAssetsInfoByTags(tags);
|
return ActivePatchManifest.GetAssetsInfoByTags(tags);
|
||||||
}
|
}
|
||||||
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
|
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
|
||||||
{
|
{
|
||||||
if (_simulatePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
|
if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
|
||||||
return patchAsset;
|
return patchAsset;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
string IBundleServices.MappingToAssetPath(string location)
|
string IBundleServices.MappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
return _simulatePatchManifest.MappingToAssetPath(location);
|
return ActivePatchManifest.MappingToAssetPath(location);
|
||||||
}
|
}
|
||||||
string IBundleServices.TryMappingToAssetPath(string location)
|
string IBundleServices.TryMappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
return _simulatePatchManifest.TryMappingToAssetPath(location);
|
return ActivePatchManifest.TryMappingToAssetPath(location);
|
||||||
}
|
}
|
||||||
string IBundleServices.GetPackageName()
|
string IBundleServices.GetPackageName()
|
||||||
{
|
{
|
||||||
return _simulatePatchManifest.PackageName;
|
return ActivePatchManifest.PackageName;
|
||||||
}
|
}
|
||||||
bool IBundleServices.IsIncludeBundleFile(string fileName)
|
bool IBundleServices.IsIncludeBundleFile(string fileName)
|
||||||
{
|
{
|
||||||
return _simulatePatchManifest.IsIncludeBundleFile(fileName);
|
return ActivePatchManifest.IsIncludeBundleFile(fileName);
|
||||||
}
|
}
|
||||||
bool IBundleServices.IsServicesValid()
|
bool IBundleServices.IsServicesValid()
|
||||||
{
|
{
|
||||||
return _simulatePatchManifest != null;
|
return ActivePatchManifest != null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace YooAsset
|
||||||
internal class HostPlayModeImpl : IBundleServices
|
internal class HostPlayModeImpl : IBundleServices
|
||||||
{
|
{
|
||||||
// 补丁清单
|
// 补丁清单
|
||||||
internal PatchManifest LocalPatchManifest { private set; get; }
|
public PatchManifest ActivePatchManifest { private set; get; }
|
||||||
|
|
||||||
// 参数相关
|
// 参数相关
|
||||||
private bool _locationToLower;
|
private bool _locationToLower;
|
||||||
|
@ -36,9 +36,9 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetPackageVersion()
|
public string GetPackageVersion()
|
||||||
{
|
{
|
||||||
if (LocalPatchManifest == null)
|
if (ActivePatchManifest == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
return LocalPatchManifest.PackageVersion;
|
return ActivePatchManifest.PackageVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -86,7 +86,7 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PatchDownloaderOperation CreatePatchDownloaderByAll(int fileLoadingMaxNumber, int failedTryAgain, int timeout)
|
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();
|
List<BundleInfo> downloadList = GetDownloadListByAll();
|
||||||
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
|
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
|
||||||
return operation;
|
return operation;
|
||||||
|
@ -94,7 +94,7 @@ namespace YooAsset
|
||||||
private List<BundleInfo> GetDownloadListByAll()
|
private List<BundleInfo> GetDownloadListByAll()
|
||||||
{
|
{
|
||||||
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
|
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
|
||||||
foreach (var patchBundle in LocalPatchManifest.BundleList)
|
foreach (var patchBundle in ActivePatchManifest.BundleList)
|
||||||
{
|
{
|
||||||
// 忽略缓存文件
|
// 忽略缓存文件
|
||||||
if (CacheSystem.IsCached(patchBundle))
|
if (CacheSystem.IsCached(patchBundle))
|
||||||
|
@ -115,7 +115,7 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PatchDownloaderOperation CreatePatchDownloaderByTags(string[] tags, int fileLoadingMaxNumber, int failedTryAgain, int timeout)
|
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);
|
List<BundleInfo> downloadList = GetDownloadListByTags(tags);
|
||||||
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
|
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
|
||||||
return operation;
|
return operation;
|
||||||
|
@ -123,7 +123,7 @@ namespace YooAsset
|
||||||
private List<BundleInfo> GetDownloadListByTags(string[] tags)
|
private List<BundleInfo> GetDownloadListByTags(string[] tags)
|
||||||
{
|
{
|
||||||
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
|
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
|
||||||
foreach (var patchBundle in LocalPatchManifest.BundleList)
|
foreach (var patchBundle in ActivePatchManifest.BundleList)
|
||||||
{
|
{
|
||||||
// 忽略缓存文件
|
// 忽略缓存文件
|
||||||
if (CacheSystem.IsCached(patchBundle))
|
if (CacheSystem.IsCached(patchBundle))
|
||||||
|
@ -156,7 +156,7 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PatchDownloaderOperation CreatePatchDownloaderByPaths(AssetInfo[] assetInfos, int fileLoadingMaxNumber, int failedTryAgain, int timeout)
|
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);
|
List<BundleInfo> downloadList = GetDownloadListByPaths(assetInfos);
|
||||||
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
|
var operation = new PatchDownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain, timeout);
|
||||||
return operation;
|
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)
|
if (checkList.Contains(mainBundle) == false)
|
||||||
checkList.Add(mainBundle);
|
checkList.Add(mainBundle);
|
||||||
|
|
||||||
// 注意:如果补丁清单里未找到资源包会抛出异常!
|
// 注意:如果补丁清单里未找到资源包会抛出异常!
|
||||||
PatchBundle[] dependBundles = LocalPatchManifest.GetAllDependencies(assetInfo.AssetPath);
|
PatchBundle[] dependBundles = ActivePatchManifest.GetAllDependencies(assetInfo.AssetPath);
|
||||||
foreach (var dependBundle in dependBundles)
|
foreach (var dependBundle in dependBundles)
|
||||||
{
|
{
|
||||||
if (checkList.Contains(dependBundle) == false)
|
if (checkList.Contains(dependBundle) == false)
|
||||||
|
@ -209,7 +209,7 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PatchUnpackerOperation CreatePatchUnpackerByTags(string[] tags, int fileUpackingMaxNumber, int failedTryAgain, int timeout)
|
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);
|
List<BundleInfo> unpcakList = GetUnpackListByTags(tags);
|
||||||
var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain, timeout);
|
var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain, timeout);
|
||||||
return operation;
|
return operation;
|
||||||
|
@ -217,7 +217,7 @@ namespace YooAsset
|
||||||
private List<BundleInfo> GetUnpackListByTags(string[] tags)
|
private List<BundleInfo> GetUnpackListByTags(string[] tags)
|
||||||
{
|
{
|
||||||
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
|
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
|
||||||
foreach (var patchBundle in LocalPatchManifest.BundleList)
|
foreach (var patchBundle in ActivePatchManifest.BundleList)
|
||||||
{
|
{
|
||||||
// 忽略缓存文件
|
// 忽略缓存文件
|
||||||
if (CacheSystem.IsCached(patchBundle))
|
if (CacheSystem.IsCached(patchBundle))
|
||||||
|
@ -241,7 +241,7 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PatchUnpackerOperation CreatePatchUnpackerByAll(int fileUpackingMaxNumber, int failedTryAgain, int timeout)
|
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();
|
List<BundleInfo> unpcakList = GetUnpackListByAll();
|
||||||
var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain, timeout);
|
var operation = new PatchUnpackerOperation(unpcakList, fileUpackingMaxNumber, failedTryAgain, timeout);
|
||||||
return operation;
|
return operation;
|
||||||
|
@ -249,7 +249,7 @@ namespace YooAsset
|
||||||
private List<BundleInfo> GetUnpackListByAll()
|
private List<BundleInfo> GetUnpackListByAll()
|
||||||
{
|
{
|
||||||
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
|
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
|
||||||
foreach (var patchBundle in LocalPatchManifest.BundleList)
|
foreach (var patchBundle in ActivePatchManifest.BundleList)
|
||||||
{
|
{
|
||||||
// 忽略缓存文件
|
// 忽略缓存文件
|
||||||
if (CacheSystem.IsCached(patchBundle))
|
if (CacheSystem.IsCached(patchBundle))
|
||||||
|
@ -312,10 +312,10 @@ namespace YooAsset
|
||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetLocalPatchManifest(PatchManifest patchManifest)
|
internal void SetActivePatchManifest(PatchManifest patchManifest)
|
||||||
{
|
{
|
||||||
LocalPatchManifest = patchManifest;
|
ActivePatchManifest = patchManifest;
|
||||||
LocalPatchManifest.InitAssetPathMapping(_locationToLower);
|
ActivePatchManifest.InitAssetPathMapping(_locationToLower);
|
||||||
}
|
}
|
||||||
internal bool IsBuildinPatchBundle(PatchBundle patchBundle)
|
internal bool IsBuildinPatchBundle(PatchBundle patchBundle)
|
||||||
{
|
{
|
||||||
|
@ -351,7 +351,7 @@ namespace YooAsset
|
||||||
throw new Exception("Should never get here !");
|
throw new Exception("Should never get here !");
|
||||||
|
|
||||||
// 注意:如果补丁清单里未找到资源包会抛出异常!
|
// 注意:如果补丁清单里未找到资源包会抛出异常!
|
||||||
var patchBundle = LocalPatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
|
var patchBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
|
||||||
return CreateBundleInfo(patchBundle);
|
return CreateBundleInfo(patchBundle);
|
||||||
}
|
}
|
||||||
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
|
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
|
||||||
|
@ -360,7 +360,7 @@ namespace YooAsset
|
||||||
throw new Exception("Should never get here !");
|
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);
|
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
|
||||||
foreach (var patchBundle in depends)
|
foreach (var patchBundle in depends)
|
||||||
{
|
{
|
||||||
|
@ -371,34 +371,34 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
||||||
{
|
{
|
||||||
return LocalPatchManifest.GetAssetsInfoByTags(tags);
|
return ActivePatchManifest.GetAssetsInfoByTags(tags);
|
||||||
}
|
}
|
||||||
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
|
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
|
||||||
{
|
{
|
||||||
if (LocalPatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
|
if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
|
||||||
return patchAsset;
|
return patchAsset;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
string IBundleServices.MappingToAssetPath(string location)
|
string IBundleServices.MappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
return LocalPatchManifest.MappingToAssetPath(location);
|
return ActivePatchManifest.MappingToAssetPath(location);
|
||||||
}
|
}
|
||||||
string IBundleServices.TryMappingToAssetPath(string location)
|
string IBundleServices.TryMappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
return LocalPatchManifest.TryMappingToAssetPath(location);
|
return ActivePatchManifest.TryMappingToAssetPath(location);
|
||||||
}
|
}
|
||||||
string IBundleServices.GetPackageName()
|
string IBundleServices.GetPackageName()
|
||||||
{
|
{
|
||||||
return LocalPatchManifest.PackageName;
|
return ActivePatchManifest.PackageName;
|
||||||
}
|
}
|
||||||
bool IBundleServices.IsIncludeBundleFile(string fileName)
|
bool IBundleServices.IsIncludeBundleFile(string fileName)
|
||||||
{
|
{
|
||||||
return LocalPatchManifest.IsIncludeBundleFile(fileName);
|
return ActivePatchManifest.IsIncludeBundleFile(fileName);
|
||||||
}
|
}
|
||||||
bool IBundleServices.IsServicesValid()
|
bool IBundleServices.IsServicesValid()
|
||||||
{
|
{
|
||||||
return LocalPatchManifest != null;
|
return ActivePatchManifest != null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class OfflinePlayModeImpl : IBundleServices
|
internal class OfflinePlayModeImpl : IBundleServices
|
||||||
{
|
{
|
||||||
public PatchManifest AppPatchManifest { private set; get; }
|
public PatchManifest ActivePatchManifest { private set; get; }
|
||||||
private bool _locationToLower;
|
private bool _locationToLower;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -26,15 +26,15 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetPackageVersion()
|
public string GetPackageVersion()
|
||||||
{
|
{
|
||||||
if (AppPatchManifest == null)
|
if (ActivePatchManifest == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
return AppPatchManifest.PackageVersion;
|
return ActivePatchManifest.PackageVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetAppPatchManifest(PatchManifest patchManifest)
|
internal void SetActivePatchManifest(PatchManifest patchManifest)
|
||||||
{
|
{
|
||||||
AppPatchManifest = patchManifest;
|
ActivePatchManifest = patchManifest;
|
||||||
AppPatchManifest.InitAssetPathMapping(_locationToLower);
|
ActivePatchManifest.InitAssetPathMapping(_locationToLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IBundleServices接口
|
#region IBundleServices接口
|
||||||
|
@ -62,7 +62,7 @@ namespace YooAsset
|
||||||
throw new Exception("Should never get here !");
|
throw new Exception("Should never get here !");
|
||||||
|
|
||||||
// 注意:如果补丁清单里未找到资源包会抛出异常!
|
// 注意:如果补丁清单里未找到资源包会抛出异常!
|
||||||
var patchBundle = AppPatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
|
var patchBundle = ActivePatchManifest.GetMainPatchBundle(assetInfo.AssetPath);
|
||||||
return CreateBundleInfo(patchBundle);
|
return CreateBundleInfo(patchBundle);
|
||||||
}
|
}
|
||||||
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
|
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
|
||||||
|
@ -71,7 +71,7 @@ namespace YooAsset
|
||||||
throw new Exception("Should never get here !");
|
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);
|
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
|
||||||
foreach (var patchBundle in depends)
|
foreach (var patchBundle in depends)
|
||||||
{
|
{
|
||||||
|
@ -82,34 +82,34 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
AssetInfo[] IBundleServices.GetAssetInfos(string[] tags)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.GetAssetsInfoByTags(tags);
|
return ActivePatchManifest.GetAssetsInfoByTags(tags);
|
||||||
}
|
}
|
||||||
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
|
PatchAsset IBundleServices.TryGetPatchAsset(string assetPath)
|
||||||
{
|
{
|
||||||
if (AppPatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
|
if (ActivePatchManifest.TryGetPatchAsset(assetPath, out PatchAsset patchAsset))
|
||||||
return patchAsset;
|
return patchAsset;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
string IBundleServices.MappingToAssetPath(string location)
|
string IBundleServices.MappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.MappingToAssetPath(location);
|
return ActivePatchManifest.MappingToAssetPath(location);
|
||||||
}
|
}
|
||||||
string IBundleServices.TryMappingToAssetPath(string location)
|
string IBundleServices.TryMappingToAssetPath(string location)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.TryMappingToAssetPath(location);
|
return ActivePatchManifest.TryMappingToAssetPath(location);
|
||||||
}
|
}
|
||||||
string IBundleServices.GetPackageName()
|
string IBundleServices.GetPackageName()
|
||||||
{
|
{
|
||||||
return AppPatchManifest.PackageName;
|
return ActivePatchManifest.PackageName;
|
||||||
}
|
}
|
||||||
bool IBundleServices.IsIncludeBundleFile(string fileName)
|
bool IBundleServices.IsIncludeBundleFile(string fileName)
|
||||||
{
|
{
|
||||||
return AppPatchManifest.IsIncludeBundleFile(fileName);
|
return ActivePatchManifest.IsIncludeBundleFile(fileName);
|
||||||
}
|
}
|
||||||
bool IBundleServices.IsServicesValid()
|
bool IBundleServices.IsServicesValid()
|
||||||
{
|
{
|
||||||
return AppPatchManifest != null;
|
return ActivePatchManifest != null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue