mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-24 09:40:11 +00:00
update runtime code
This commit is contained in:
@@ -111,7 +111,7 @@ namespace YooAsset
|
|||||||
if (_steps == ESteps.Unpack)
|
if (_steps == ESteps.Unpack)
|
||||||
{
|
{
|
||||||
int failedTryAgain = Impl.DownloadFailedTryAgain;
|
int failedTryAgain = Impl.DownloadFailedTryAgain;
|
||||||
var bundleInfo = ManifestTools.GetUnpackInfo(MainBundleInfo.Bundle);
|
var bundleInfo = ManifestTools.ConvertToUnpackInfo(MainBundleInfo.Bundle);
|
||||||
_unpacker = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
|
_unpacker = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
|
||||||
_steps = ESteps.CheckUnpack;
|
_steps = ESteps.CheckUnpack;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace YooAsset
|
|||||||
if (_steps == ESteps.Unpack)
|
if (_steps == ESteps.Unpack)
|
||||||
{
|
{
|
||||||
int failedTryAgain = Impl.DownloadFailedTryAgain;
|
int failedTryAgain = Impl.DownloadFailedTryAgain;
|
||||||
var bundleInfo = ManifestTools.GetUnpackInfo(MainBundleInfo.Bundle);
|
var bundleInfo = ManifestTools.ConvertToUnpackInfo(MainBundleInfo.Bundle);
|
||||||
_unpacker = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
|
_unpacker = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
|
||||||
_steps = ESteps.CheckUnpack;
|
_steps = ESteps.CheckUnpack;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace YooAsset
|
|||||||
if (_steps == ESteps.Website)
|
if (_steps == ESteps.Website)
|
||||||
{
|
{
|
||||||
int failedTryAgain = Impl.DownloadFailedTryAgain;
|
int failedTryAgain = Impl.DownloadFailedTryAgain;
|
||||||
var bundleInfo = ManifestTools.GetUnpackInfo(MainBundleInfo.Bundle);
|
var bundleInfo = ManifestTools.ConvertToUnpackInfo(MainBundleInfo.Bundle);
|
||||||
_website = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
|
_website = DownloadSystem.BeginDownload(bundleInfo, failedTryAgain);
|
||||||
_steps = ESteps.CheckWebsite;
|
_steps = ESteps.CheckWebsite;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
internal static class ManifestTools
|
internal static class ManifestTools
|
||||||
{
|
{
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序列化(JSON文件)
|
/// 序列化(JSON文件)
|
||||||
@@ -188,14 +187,28 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取解压BundleInfo
|
/// 转换为解压BundleInfo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static BundleInfo GetUnpackInfo(PackageBundle packageBundle)
|
public static BundleInfo ConvertToUnpackInfo(PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
// 注意:我们把流加载路径指定为远端下载地址
|
// 注意:我们把流加载路径指定为远端下载地址
|
||||||
string streamingPath = PersistentTools.ConvertToWWWPath(packageBundle.StreamingFilePath);
|
string streamingPath = PersistentTools.ConvertToWWWPath(packageBundle.StreamingFilePath);
|
||||||
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromStreaming, streamingPath, streamingPath);
|
BundleInfo bundleInfo = new BundleInfo(packageBundle, BundleInfo.ELoadMode.LoadFromStreaming, streamingPath, streamingPath);
|
||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量转换解压为BundleInfo
|
||||||
|
/// </summary>
|
||||||
|
public static List<BundleInfo> ConvertToUnpackInfos(List<PackageBundle> unpackList)
|
||||||
|
{
|
||||||
|
List<BundleInfo> result = new List<BundleInfo>(unpackList.Count);
|
||||||
|
foreach (var packageBundle in unpackList)
|
||||||
|
{
|
||||||
|
var bundleInfo = ConvertToUnpackInfo(packageBundle);
|
||||||
|
result.Add(bundleInfo);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,22 +50,6 @@ namespace YooAsset
|
|||||||
return bundleInfo;
|
return bundleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解压相关
|
|
||||||
private List<BundleInfo> ConvertToUnpackList(List<PackageBundle> unpackList)
|
|
||||||
{
|
|
||||||
List<BundleInfo> result = new List<BundleInfo>(unpackList.Count);
|
|
||||||
foreach (var packageBundle in unpackList)
|
|
||||||
{
|
|
||||||
var bundleInfo = ConvertToUnpackInfo(packageBundle);
|
|
||||||
result.Add(bundleInfo);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
private BundleInfo ConvertToUnpackInfo(PackageBundle packageBundle)
|
|
||||||
{
|
|
||||||
return ManifestTools.GetUnpackInfo(packageBundle);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IRemoteServices接口
|
#region IRemoteServices接口
|
||||||
public string GetRemoteMainURL(string fileName)
|
public string GetRemoteMainURL(string fileName)
|
||||||
{
|
{
|
||||||
@@ -256,7 +240,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConvertToUnpackList(downloadList);
|
return ManifestTools.ConvertToUnpackInfos(downloadList);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
|
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
|
||||||
@@ -284,7 +268,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConvertToUnpackList(downloadList);
|
return ManifestTools.ConvertToUnpackInfos(downloadList);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -20,22 +20,6 @@ namespace YooAsset
|
|||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解压相关
|
|
||||||
private List<BundleInfo> ConvertToUnpackList(List<PackageBundle> unpackList)
|
|
||||||
{
|
|
||||||
List<BundleInfo> result = new List<BundleInfo>(unpackList.Count);
|
|
||||||
foreach (var packageBundle in unpackList)
|
|
||||||
{
|
|
||||||
var bundleInfo = ConvertToUnpackInfo(packageBundle);
|
|
||||||
result.Add(bundleInfo);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
private BundleInfo ConvertToUnpackInfo(PackageBundle packageBundle)
|
|
||||||
{
|
|
||||||
return ManifestTools.GetUnpackInfo(packageBundle);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IPlayModeServices接口
|
#region IPlayModeServices接口
|
||||||
public PackageManifest ActiveManifest
|
public PackageManifest ActiveManifest
|
||||||
{
|
{
|
||||||
@@ -108,7 +92,7 @@ namespace YooAsset
|
|||||||
downloadList.Add(packageBundle);
|
downloadList.Add(packageBundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConvertToUnpackList(downloadList);
|
return ManifestTools.ConvertToUnpackInfos(downloadList);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
|
ResourceUnpackerOperation IPlayModeServices.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain, int timeout)
|
||||||
@@ -133,7 +117,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConvertToUnpackList(downloadList);
|
return ManifestTools.ConvertToUnpackInfos(downloadList);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user