update runtime code

代码里移除了Patch敏感字。
This commit is contained in:
hevinci
2023-03-11 00:06:40 +08:00
parent 10e04c7645
commit 67d09d95fa
38 changed files with 692 additions and 580 deletions
@@ -8,7 +8,7 @@ namespace YooAsset
private static System.Type _classType;
/// <summary>
/// 编辑器下模拟构建补丁清单
/// 编辑器下模拟构建清单
/// </summary>
public static string SimulateBuild(string packageName)
{
@@ -37,7 +37,7 @@ namespace YooAsset
public static class EditorSimulateModeHelper
{
/// <summary>
/// 编辑器下模拟构建补丁清单
/// 编辑器下模拟构建清单
/// </summary>
public static string SimulateBuild(string packageName) { throw new System.Exception("Only support in unity editor !"); }
}
@@ -6,22 +6,22 @@ namespace YooAsset
{
internal class EditorSimulateModeImpl : IPlayModeServices, IBundleServices
{
private PatchManifest _activeManifest;
private PackageManifest _activeManifest;
private bool _locationToLower;
/// <summary>
/// 异步初始化
/// </summary>
public InitializationOperation InitializeAsync(bool locationToLower, string simulatePatchManifestPath)
public InitializationOperation InitializeAsync(bool locationToLower, string simulateManifestFilePath)
{
_locationToLower = locationToLower;
var operation = new EditorSimulateModeInitializationOperation(this, simulatePatchManifestPath);
var operation = new EditorSimulateModeInitializationOperation(this, simulateManifestFilePath);
OperationSystem.StartOperation(operation);
return operation;
}
#region IPlayModeServices接口
public PatchManifest ActiveManifest
public PackageManifest ActiveManifest
{
set
{
@@ -33,7 +33,7 @@ namespace YooAsset
return _activeManifest;
}
}
public bool IsBuildinPatchBundle(PatchBundle patchBundle)
public bool IsBuildinPackageBundle(PackageBundle packageBundle)
{
return true;
}
@@ -50,33 +50,33 @@ namespace YooAsset
OperationSystem.StartOperation(operation);
return operation;
}
PreDownloadPackageOperation IPlayModeServices.PreDownloadPackageAsync(string packageVersion, int timeout)
PreDownloadContentOperation IPlayModeServices.PreDownloadContentAsync(string packageVersion, int timeout)
{
var operation = new EditorPlayModePreDownloadPackageOperation();
var operation = new EditorPlayModePreDownloadContentOperation();
OperationSystem.StartOperation(operation);
return operation;
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
{
return PatchDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
{
return PatchDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout)
{
return PatchDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
}
PatchUnpackerOperation IPlayModeServices.CreatePatchUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
{
return PatchUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
return ResourceUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
}
PatchUnpackerOperation IPlayModeServices.CreatePatchUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
{
return PatchUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
return ResourceUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
}
#endregion
@@ -86,9 +86,9 @@ namespace YooAsset
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
var patchBundle = _activeManifest.GetMainPatchBundle(assetInfo.AssetPath);
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromEditor, assetInfo.AssetPath);
// 注意:如果清单里未找到资源包会抛出异常!
var packageBundle = _activeManifest.GetMainPackageBundle(assetInfo.AssetPath);
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromEditor, assetInfo.AssetPath);
return bundleInfo;
}
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
@@ -6,7 +6,7 @@ namespace YooAsset
{
internal class HostPlayModeImpl : IPlayModeServices, IBundleServices, IRemoteServices
{
private PatchManifest _activeManifest;
private PackageManifest _activeManifest;
// 参数相关
private string _packageName;
@@ -32,38 +32,38 @@ namespace YooAsset
}
// 下载相关
private List<BundleInfo> ConvertToDownloadList(List<PatchBundle> downloadList)
private List<BundleInfo> ConvertToDownloadList(List<PackageBundle> downloadList)
{
List<BundleInfo> result = new List<BundleInfo>(downloadList.Count);
foreach (var patchBundle in downloadList)
foreach (var packageBundle in downloadList)
{
var bundleInfo = ConvertToDownloadInfo(patchBundle);
var bundleInfo = ConvertToDownloadInfo(packageBundle);
result.Add(bundleInfo);
}
return result;
}
private BundleInfo ConvertToDownloadInfo(PatchBundle patchBundle)
private BundleInfo ConvertToDownloadInfo(PackageBundle packageBundle)
{
string remoteMainURL = GetRemoteMainURL(patchBundle.FileName);
string remoteFallbackURL = GetRemoteFallbackURL(patchBundle.FileName);
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromRemote, remoteMainURL, remoteFallbackURL);
string remoteMainURL = GetRemoteMainURL(packageBundle.FileName);
string remoteFallbackURL = GetRemoteFallbackURL(packageBundle.FileName);
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromRemote, remoteMainURL, remoteFallbackURL);
return bundleInfo;
}
// 解压相关
private List<BundleInfo> ConvertToUnpackList(List<PatchBundle> unpackList)
private List<BundleInfo> ConvertToUnpackList(List<PackageBundle> unpackList)
{
List<BundleInfo> result = new List<BundleInfo>(unpackList.Count);
foreach (var patchBundle in unpackList)
foreach (var packageBundle in unpackList)
{
var bundleInfo = ConvertToUnpackInfo(patchBundle);
var bundleInfo = ConvertToUnpackInfo(packageBundle);
result.Add(bundleInfo);
}
return result;
}
private BundleInfo ConvertToUnpackInfo(PatchBundle patchBundle)
private BundleInfo ConvertToUnpackInfo(PackageBundle packageBundle)
{
return PatchManifestTools.GetUnpackInfo(patchBundle);
return ManifestTools.GetUnpackInfo(packageBundle);
}
#region IRemoteServices接口
@@ -78,7 +78,7 @@ namespace YooAsset
#endregion
#region IPlayModeServices接口
public PatchManifest ActiveManifest
public PackageManifest ActiveManifest
{
set
{
@@ -91,13 +91,13 @@ namespace YooAsset
return _activeManifest;
}
}
public bool IsBuildinPatchBundle(PatchBundle patchBundle)
public bool IsBuildinPackageBundle(PackageBundle packageBundle)
{
return _queryServices.QueryStreamingAssets(patchBundle.FileName);
return _queryServices.QueryStreamingAssets(packageBundle.FileName);
}
public bool IsCachedPatchBundle(PatchBundle patchBundle)
public bool IsCachedPackageBundle(PackageBundle packageBundle)
{
return CacheSystem.IsCached(patchBundle.PackageName, patchBundle.CacheGUID);
return CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID);
}
UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout)
@@ -112,68 +112,68 @@ namespace YooAsset
OperationSystem.StartOperation(operation);
return operation;
}
PreDownloadPackageOperation IPlayModeServices.PreDownloadPackageAsync(string packageVersion, int timeout)
PreDownloadContentOperation IPlayModeServices.PreDownloadContentAsync(string packageVersion, int timeout)
{
var operation = new HostPlayModePreDownloadPackageOperation(this, _packageName, packageVersion, timeout);
var operation = new HostPlayModePreDownloadContentOperation(this, _packageName, packageVersion, timeout);
OperationSystem.StartOperation(operation);
return operation;
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
{
List<BundleInfo> downloadList = GetDownloadListByAll(_activeManifest);
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
var operation = new ResourceDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
return operation;
}
public List<BundleInfo> GetDownloadListByAll(PatchManifest patchManifest)
public List<BundleInfo> GetDownloadListByAll(PackageManifest manifest)
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in patchManifest.BundleList)
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
foreach (var packageBundle in manifest.BundleList)
{
// 忽略缓存文件
if (IsCachedPatchBundle(patchBundle))
if (IsCachedPackageBundle(packageBundle))
continue;
// 忽略APP资源
if (IsBuildinPatchBundle(patchBundle))
if (IsBuildinPackageBundle(packageBundle))
continue;
downloadList.Add(patchBundle);
downloadList.Add(packageBundle);
}
return ConvertToDownloadList(downloadList);
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
{
List<BundleInfo> downloadList = GetDownloadListByTags(_activeManifest, tags);
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
var operation = new ResourceDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
return operation;
}
public List<BundleInfo> GetDownloadListByTags(PatchManifest patchManifest, string[] tags)
public List<BundleInfo> GetDownloadListByTags(PackageManifest manifest, string[] tags)
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in patchManifest.BundleList)
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
foreach (var packageBundle in manifest.BundleList)
{
// 忽略缓存文件
if (IsCachedPatchBundle(patchBundle))
if (IsCachedPackageBundle(packageBundle))
continue;
// 忽略APP资源
if (IsBuildinPatchBundle(patchBundle))
if (IsBuildinPackageBundle(packageBundle))
continue;
// 如果未带任何标记,则统一下载
if (patchBundle.HasAnyTags() == false)
if (packageBundle.HasAnyTags() == false)
{
downloadList.Add(patchBundle);
downloadList.Add(packageBundle);
}
else
{
// 查询DLC资源
if (patchBundle.HasTag(tags))
if (packageBundle.HasTag(tags))
{
downloadList.Add(patchBundle);
downloadList.Add(packageBundle);
}
}
}
@@ -181,16 +181,16 @@ namespace YooAsset
return ConvertToDownloadList(downloadList);
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout)
{
List<BundleInfo> downloadList = GetDownloadListByPaths(_activeManifest, assetInfos);
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
var operation = new ResourceDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
return operation;
}
public List<BundleInfo> GetDownloadListByPaths(PatchManifest patchManifest, AssetInfo[] assetInfos)
public List<BundleInfo> GetDownloadListByPaths(PackageManifest manifest, AssetInfo[] assetInfos)
{
// 获取资源对象的资源包和所有依赖资源包
List<PatchBundle> checkList = new List<PatchBundle>();
List<PackageBundle> checkList = new List<PackageBundle>();
foreach (var assetInfo in assetInfos)
{
if (assetInfo.IsInvalid)
@@ -199,13 +199,13 @@ namespace YooAsset
continue;
}
// 注意:如果补丁清单里未找到资源包会抛出异常!
PatchBundle mainBundle = patchManifest.GetMainPatchBundle(assetInfo.AssetPath);
// 注意:如果清单里未找到资源包会抛出异常!
PackageBundle mainBundle = manifest.GetMainPackageBundle(assetInfo.AssetPath);
if (checkList.Contains(mainBundle) == false)
checkList.Add(mainBundle);
// 注意:如果补丁清单里未找到资源包会抛出异常!
PatchBundle[] dependBundles = patchManifest.GetAllDependencies(assetInfo.AssetPath);
// 注意:如果清单里未找到资源包会抛出异常!
PackageBundle[] dependBundles = manifest.GetAllDependencies(assetInfo.AssetPath);
foreach (var dependBundle in dependBundles)
{
if (checkList.Contains(dependBundle) == false)
@@ -213,68 +213,68 @@ namespace YooAsset
}
}
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in checkList)
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
foreach (var packageBundle in checkList)
{
// 忽略缓存文件
if (IsCachedPatchBundle(patchBundle))
if (IsCachedPackageBundle(packageBundle))
continue;
// 忽略APP资源
if (IsBuildinPatchBundle(patchBundle))
if (IsBuildinPackageBundle(packageBundle))
continue;
downloadList.Add(patchBundle);
downloadList.Add(packageBundle);
}
return ConvertToDownloadList(downloadList);
}
PatchUnpackerOperation IPlayModeServices.CreatePatchUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
{
List<BundleInfo> unpcakList = GetUnpackListByAll(_activeManifest);
var operation = new PatchUnpackerOperation(unpcakList, upackingMaxNumber, failedTryAgain, timeout);
var operation = new ResourceUnpackerOperation(unpcakList, upackingMaxNumber, failedTryAgain, timeout);
return operation;
}
private List<BundleInfo> GetUnpackListByAll(PatchManifest patchManifest)
private List<BundleInfo> GetUnpackListByAll(PackageManifest manifest)
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in patchManifest.BundleList)
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
foreach (var packageBundle in manifest.BundleList)
{
// 忽略缓存文件
if (IsCachedPatchBundle(patchBundle))
if (IsCachedPackageBundle(packageBundle))
continue;
if (IsBuildinPatchBundle(patchBundle))
if (IsBuildinPackageBundle(packageBundle))
{
downloadList.Add(patchBundle);
downloadList.Add(packageBundle);
}
}
return ConvertToUnpackList(downloadList);
}
PatchUnpackerOperation IPlayModeServices.CreatePatchUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
{
List<BundleInfo> unpcakList = GetUnpackListByTags(_activeManifest, tags);
var operation = new PatchUnpackerOperation(unpcakList, upackingMaxNumber, failedTryAgain, timeout);
var operation = new ResourceUnpackerOperation(unpcakList, upackingMaxNumber, failedTryAgain, timeout);
return operation;
}
private List<BundleInfo> GetUnpackListByTags(PatchManifest patchManifest, string[] tags)
private List<BundleInfo> GetUnpackListByTags(PackageManifest manifest, string[] tags)
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in patchManifest.BundleList)
List<PackageBundle> downloadList = new List<PackageBundle>(1000);
foreach (var packageBundle in manifest.BundleList)
{
// 忽略缓存文件
if (IsCachedPatchBundle(patchBundle))
if (IsCachedPackageBundle(packageBundle))
continue;
// 查询DLC资源
if (IsBuildinPatchBundle(patchBundle))
if (IsBuildinPackageBundle(packageBundle))
{
if (patchBundle.HasTag(tags))
if (packageBundle.HasTag(tags))
{
downloadList.Add(patchBundle);
downloadList.Add(packageBundle);
}
}
}
@@ -284,48 +284,48 @@ namespace YooAsset
#endregion
#region IBundleServices接口
private BundleInfo CreateBundleInfo(PatchBundle patchBundle)
private BundleInfo CreateBundleInfo(PackageBundle packageBundle)
{
if (patchBundle == null)
if (packageBundle == null)
throw new Exception("Should never get here !");
// 查询沙盒资源
if (IsCachedPatchBundle(patchBundle))
if (IsCachedPackageBundle(packageBundle))
{
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromCache);
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromCache);
return bundleInfo;
}
// 查询APP资源
if (IsBuildinPatchBundle(patchBundle))
if (IsBuildinPackageBundle(packageBundle))
{
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromStreaming);
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromStreaming);
return bundleInfo;
}
// 从服务端下载
return ConvertToDownloadInfo(patchBundle);
return ConvertToDownloadInfo(packageBundle);
}
BundleInfo IBundleServices.GetBundleInfo(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
var patchBundle = _activeManifest.GetMainPatchBundle(assetInfo.AssetPath);
return CreateBundleInfo(patchBundle);
// 注意:如果清单里未找到资源包会抛出异常!
var packageBundle = _activeManifest.GetMainPackageBundle(assetInfo.AssetPath);
return CreateBundleInfo(packageBundle);
}
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
// 注意:如果清单里未找到资源包会抛出异常!
var depends = _activeManifest.GetAllDependencies(assetInfo.AssetPath);
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
foreach (var patchBundle in depends)
foreach (var packageBundle in depends)
{
BundleInfo bundleInfo = CreateBundleInfo(patchBundle);
BundleInfo bundleInfo = CreateBundleInfo(packageBundle);
result.Add(bundleInfo);
}
return result.ToArray();
@@ -6,7 +6,7 @@ namespace YooAsset
{
internal class OfflinePlayModeImpl : IPlayModeServices, IBundleServices
{
private PatchManifest _activeManifest;
private PackageManifest _activeManifest;
private bool _locationToLower;
/// <summary>
@@ -21,7 +21,7 @@ namespace YooAsset
}
#region IPlayModeServices接口
public PatchManifest ActiveManifest
public PackageManifest ActiveManifest
{
set
{
@@ -33,7 +33,7 @@ namespace YooAsset
return _activeManifest;
}
}
public bool IsBuildinPatchBundle(PatchBundle patchBundle)
public bool IsBuildinPackageBundle(PackageBundle packageBundle)
{
return true;
}
@@ -50,52 +50,52 @@ namespace YooAsset
OperationSystem.StartOperation(operation);
return operation;
}
PreDownloadPackageOperation IPlayModeServices.PreDownloadPackageAsync(string packageVersion, int timeout)
PreDownloadContentOperation IPlayModeServices.PreDownloadContentAsync(string packageVersion, int timeout)
{
var operation = new OfflinePlayModePreDownloadPackageOperation();
var operation = new OfflinePlayModePreDownloadContentOperation();
OperationSystem.StartOperation(operation);
return operation;
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout)
{
return PatchDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout)
{
return PatchDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
}
PatchDownloaderOperation IPlayModeServices.CreatePatchDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout)
ResourceDownloaderOperation IPlayModeServices.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout)
{
return PatchDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
return ResourceDownloaderOperation.CreateEmptyDownloader(downloadingMaxNumber, failedTryAgain, timeout);
}
PatchUnpackerOperation IPlayModeServices.CreatePatchUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain, int timeout)
{
return PatchUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
return ResourceUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
}
PatchUnpackerOperation IPlayModeServices.CreatePatchUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
{
return PatchUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
return ResourceUnpackerOperation.CreateEmptyUnpacker(upackingMaxNumber, failedTryAgain, timeout);
}
#endregion
#region IBundleServices接口
private BundleInfo CreateBundleInfo(PatchBundle patchBundle)
private BundleInfo CreateBundleInfo(PackageBundle packageBundle)
{
if (patchBundle == null)
if (packageBundle == null)
throw new Exception("Should never get here !");
// 查询沙盒资源
if (CacheSystem.IsCached(patchBundle.PackageName, patchBundle.CacheGUID))
if (CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID))
{
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromCache);
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromCache);
return bundleInfo;
}
// 查询APP资源
{
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromStreaming);
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromStreaming);
return bundleInfo;
}
}
@@ -104,21 +104,21 @@ namespace YooAsset
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
var patchBundle = _activeManifest.GetMainPatchBundle(assetInfo.AssetPath);
return CreateBundleInfo(patchBundle);
// 注意:如果清单里未找到资源包会抛出异常!
var packageBundle = _activeManifest.GetMainPackageBundle(assetInfo.AssetPath);
return CreateBundleInfo(packageBundle);
}
BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
{
if (assetInfo.IsInvalid)
throw new Exception("Should never get here !");
// 注意:如果补丁清单里未找到资源包会抛出异常!
// 注意:如果清单里未找到资源包会抛出异常!
var depends = _activeManifest.GetAllDependencies(assetInfo.AssetPath);
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
foreach (var patchBundle in depends)
foreach (var packageBundle in depends)
{
BundleInfo bundleInfo = CreateBundleInfo(patchBundle);
BundleInfo bundleInfo = CreateBundleInfo(packageBundle);
result.Add(bundleInfo);
}
return result.ToArray();