mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-27 03:00:17 +00:00
Compare commits
5 Commits
2.3.16
...
f3ebda0c04
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3ebda0c04 | ||
|
|
5602addaca | ||
|
|
c4ae67aa8e | ||
|
|
bbcc3bf971 | ||
|
|
8b0e75b9b3 |
@@ -32,17 +32,10 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// 开始扫描工作
|
// 开始扫描工作
|
||||||
ScanReport report = scanner.RunScanner();
|
ScanReport report = scanner.RunScanner();
|
||||||
|
|
||||||
// 检测报告合法性
|
|
||||||
report.CheckError();
|
report.CheckError();
|
||||||
|
|
||||||
// 保存扫描结果
|
// 返回扫描结果
|
||||||
string saveDirectory = scanner.SaveDirectory;
|
return new ScannerResult(report);
|
||||||
if (string.IsNullOrEmpty(saveDirectory))
|
|
||||||
saveDirectory = "Assets/";
|
|
||||||
string filePath = $"{saveDirectory}/{scanner.ScannerName}_{scanner.ScannerDesc}.json";
|
|
||||||
ScanReportConfig.ExportJsonConfig(filePath, report);
|
|
||||||
return new ScannerResult(filePath, report);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,6 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
public class ScannerResult
|
public class ScannerResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 生成的报告文件路径
|
|
||||||
/// </summary>
|
|
||||||
public string ReprotFilePath { private set; get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 报告对象
|
/// 报告对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -43,11 +38,9 @@ namespace YooAsset.Editor
|
|||||||
ErrorInfo = error;
|
ErrorInfo = error;
|
||||||
ErrorStack = stack;
|
ErrorStack = stack;
|
||||||
}
|
}
|
||||||
public ScannerResult(string filePath, ScanReport report)
|
public ScannerResult(ScanReport report)
|
||||||
{
|
{
|
||||||
ReprotFilePath = filePath;
|
|
||||||
Report = report;
|
Report = report;
|
||||||
ErrorInfo = string.Empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -61,5 +54,19 @@ namespace YooAsset.Editor
|
|||||||
reproterWindow.ImportSingleReprotFile(Report);
|
reproterWindow.ImportSingleReprotFile(Report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存报告文件
|
||||||
|
/// </summary>
|
||||||
|
public void SaveReportFile(string saveDirectory)
|
||||||
|
{
|
||||||
|
if (Report == null)
|
||||||
|
throw new System.Exception("Scan report is invalid !");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(saveDirectory))
|
||||||
|
saveDirectory = "Assets/";
|
||||||
|
string filePath = $"{saveDirectory}/{Report.ReportName}_{Report.ReportDesc}.json";
|
||||||
|
ScanReportConfig.ExportJsonConfig(filePath, Report);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ namespace YooAsset
|
|||||||
public string CopyBuildinPackageManifestDestRoot { private set; get; }
|
public string CopyBuildinPackageManifestDestRoot { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:解密方法类
|
/// 自定义参数:解密服务接口的实例类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDecryptionServices DecryptionServices { private set; get; }
|
public IDecryptionServices DecryptionServices { private set; get; }
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ namespace YooAsset
|
|||||||
public IManifestRestoreServices ManifestServices { private set; get; }
|
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:拷贝内置文件服务类
|
/// 自定义参数:拷贝内置文件接口的实例类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICopyLocalFileServices CopyLocalFileServices { private set; get; }
|
public ICopyLocalFileServices CopyLocalFileServices { private set; get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace YooAsset
|
|||||||
|
|
||||||
#region 自定义参数
|
#region 自定义参数
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:远程服务接口
|
/// 自定义参数:远程服务接口的实例类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IRemoteServices RemoteServices { private set; get; }
|
public IRemoteServices RemoteServices { private set; get; }
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ namespace YooAsset
|
|||||||
public List<long> ResumeDownloadResponseCodes { private set; get; } = null;
|
public List<long> ResumeDownloadResponseCodes { private set; get; } = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:解密方法类
|
/// 自定义参数:解密服务接口的实例类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDecryptionServices DecryptionServices { private set; get; }
|
public IDecryptionServices DecryptionServices { private set; get; }
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ namespace YooAsset
|
|||||||
public IManifestRestoreServices ManifestServices { private set; get; }
|
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:拷贝内置文件服务类
|
/// 自定义参数:拷贝内置文件接口的实例类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICopyLocalFileServices CopyLocalFileServices { private set; get; }
|
public ICopyLocalFileServices CopyLocalFileServices { private set; get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ namespace YooAsset
|
|||||||
public bool DisableUnityWebCache { private set; get; } = false;
|
public bool DisableUnityWebCache { private set; get; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:跨域下载服务接口
|
/// 自定义参数:远程服务接口的实例类(支持跨域下载)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IRemoteServices RemoteServices { private set; get; }
|
public IRemoteServices RemoteServices { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:解密方法类
|
/// 自定义参数:解密服务接口的实例类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IWebDecryptionServices DecryptionServices { private set; get; }
|
public IWebDecryptionServices DecryptionServices { private set; get; }
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace YooAsset
|
|||||||
public bool DisableUnityWebCache { private set; get; } = false;
|
public bool DisableUnityWebCache { private set; get; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:解密方法类
|
/// 自定义参数:解密服务接口的实例类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IWebDecryptionServices DecryptionServices { private set; get; }
|
public IWebDecryptionServices DecryptionServices { private set; get; }
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (_watch == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
// NOTE : 单次调用开销约1微秒
|
// NOTE : 单次调用开销约1微秒
|
||||||
return _watch.ElapsedMilliseconds - _frameTime >= MaxTimeSlice;
|
return _watch.ElapsedMilliseconds - _frameTime >= MaxTimeSlice;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,86 +119,13 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static PackageManifest DeserializeFromJson(string jsonContent)
|
public static PackageManifest DeserializeFromJson(string jsonContent)
|
||||||
{
|
{
|
||||||
return JsonUtility.FromJson<PackageManifest>(jsonContent);
|
var manifest = JsonUtility.FromJson<PackageManifest>(jsonContent);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
// 初始化资源包
|
||||||
/// 反序列化(二进制文件)
|
for (int i = 0; i < manifest.BundleList.Count; i++)
|
||||||
/// </summary>
|
|
||||||
public static PackageManifest DeserializeFromBinary(byte[] binaryData, IManifestRestoreServices services)
|
|
||||||
{
|
|
||||||
// 创建缓存器
|
|
||||||
BufferReader buffer;
|
|
||||||
if (services != null)
|
|
||||||
{
|
{
|
||||||
var resultBytes = services.RestoreManifest(binaryData);
|
var packageBundle = manifest.BundleList[i];
|
||||||
buffer = new BufferReader(resultBytes);
|
packageBundle.InitBundle(manifest);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buffer = new BufferReader(binaryData);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 读取文件标记
|
|
||||||
uint fileSign = buffer.ReadUInt32();
|
|
||||||
if (fileSign != ManifestDefine.FileSign)
|
|
||||||
throw new Exception("Invalid manifest file !");
|
|
||||||
|
|
||||||
// 读取文件版本
|
|
||||||
string fileVersion = buffer.ReadUTF8();
|
|
||||||
if (fileVersion != ManifestDefine.FileVersion)
|
|
||||||
throw new Exception($"The manifest file version are not compatible : {fileVersion} != {ManifestDefine.FileVersion}");
|
|
||||||
|
|
||||||
PackageManifest manifest = new PackageManifest();
|
|
||||||
{
|
|
||||||
// 读取文件头信息
|
|
||||||
manifest.FileVersion = fileVersion;
|
|
||||||
manifest.EnableAddressable = buffer.ReadBool();
|
|
||||||
manifest.SupportExtensionless = buffer.ReadBool();
|
|
||||||
manifest.LocationToLower = buffer.ReadBool();
|
|
||||||
manifest.IncludeAssetGUID = buffer.ReadBool();
|
|
||||||
manifest.OutputNameStyle = buffer.ReadInt32();
|
|
||||||
manifest.BuildBundleType = buffer.ReadInt32();
|
|
||||||
manifest.BuildPipeline = buffer.ReadUTF8();
|
|
||||||
manifest.PackageName = buffer.ReadUTF8();
|
|
||||||
manifest.PackageVersion = buffer.ReadUTF8();
|
|
||||||
manifest.PackageNote = buffer.ReadUTF8();
|
|
||||||
|
|
||||||
// 检测配置
|
|
||||||
if (manifest.EnableAddressable && manifest.LocationToLower)
|
|
||||||
throw new Exception("Addressable not support location to lower !");
|
|
||||||
|
|
||||||
// 读取资源列表
|
|
||||||
int packageAssetCount = buffer.ReadInt32();
|
|
||||||
CreateAssetCollection(manifest, packageAssetCount);
|
|
||||||
for (int i = 0; i < packageAssetCount; i++)
|
|
||||||
{
|
|
||||||
var packageAsset = new PackageAsset();
|
|
||||||
packageAsset.Address = buffer.ReadUTF8();
|
|
||||||
packageAsset.AssetPath = buffer.ReadUTF8();
|
|
||||||
packageAsset.AssetGUID = buffer.ReadUTF8();
|
|
||||||
packageAsset.AssetTags = buffer.ReadUTF8Array();
|
|
||||||
packageAsset.BundleID = buffer.ReadInt32();
|
|
||||||
packageAsset.DependBundleIDs = buffer.ReadInt32Array();
|
|
||||||
FillAssetCollection(manifest, packageAsset);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 读取资源包列表
|
|
||||||
int packageBundleCount = buffer.ReadInt32();
|
|
||||||
CreateBundleCollection(manifest, packageBundleCount);
|
|
||||||
for (int i = 0; i < packageBundleCount; i++)
|
|
||||||
{
|
|
||||||
var packageBundle = new PackageBundle();
|
|
||||||
packageBundle.BundleName = buffer.ReadUTF8();
|
|
||||||
packageBundle.UnityCRC = buffer.ReadUInt32();
|
|
||||||
packageBundle.FileHash = buffer.ReadUTF8();
|
|
||||||
packageBundle.FileCRC = buffer.ReadUInt32();
|
|
||||||
packageBundle.FileSize = buffer.ReadInt64();
|
|
||||||
packageBundle.Encrypted = buffer.ReadBool();
|
|
||||||
packageBundle.Tags = buffer.ReadUTF8Array();
|
|
||||||
packageBundle.DependBundleIDs = buffer.ReadInt32Array();
|
|
||||||
FillBundleCollection(manifest, packageBundle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化资源清单
|
// 初始化资源清单
|
||||||
@@ -206,8 +133,20 @@ namespace YooAsset
|
|||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 反序列化(二进制文件)
|
||||||
|
/// </summary>
|
||||||
|
public static PackageManifest DeserializeFromBinary(byte[] binaryData, IManifestRestoreServices services)
|
||||||
|
{
|
||||||
|
DeserializeManifestOperation operation = new DeserializeManifestOperation(services, binaryData);
|
||||||
|
operation.StartOperation();
|
||||||
|
operation.WaitForAsyncComplete();
|
||||||
|
return operation.Manifest;
|
||||||
|
}
|
||||||
|
|
||||||
#region 解析资源清单辅助方法
|
/// <summary>
|
||||||
|
/// 初始化资源清单
|
||||||
|
/// </summary>
|
||||||
public static void InitManifest(PackageManifest manifest)
|
public static void InitManifest(PackageManifest manifest)
|
||||||
{
|
{
|
||||||
// 填充资源包内包含的主资源列表
|
// 填充资源包内包含的主资源列表
|
||||||
@@ -237,108 +176,6 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateAssetCollection(PackageManifest manifest, int assetCount)
|
|
||||||
{
|
|
||||||
manifest.AssetList = new List<PackageAsset>(assetCount);
|
|
||||||
manifest.AssetDic = new Dictionary<string, PackageAsset>(assetCount);
|
|
||||||
|
|
||||||
if (manifest.EnableAddressable)
|
|
||||||
{
|
|
||||||
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (manifest.LocationToLower)
|
|
||||||
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 2, StringComparer.OrdinalIgnoreCase);
|
|
||||||
else
|
|
||||||
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (manifest.IncludeAssetGUID)
|
|
||||||
manifest.AssetPathMapping2 = new Dictionary<string, string>(assetCount);
|
|
||||||
else
|
|
||||||
manifest.AssetPathMapping2 = new Dictionary<string, string>();
|
|
||||||
}
|
|
||||||
public static void FillAssetCollection(PackageManifest manifest, PackageAsset packageAsset)
|
|
||||||
{
|
|
||||||
// 添加到列表集合
|
|
||||||
manifest.AssetList.Add(packageAsset);
|
|
||||||
|
|
||||||
// 注意:我们不允许原始路径存在重名
|
|
||||||
string assetPath = packageAsset.AssetPath;
|
|
||||||
if (manifest.AssetDic.ContainsKey(assetPath))
|
|
||||||
throw new System.Exception($"AssetPath have existed : {assetPath}");
|
|
||||||
else
|
|
||||||
manifest.AssetDic.Add(assetPath, packageAsset);
|
|
||||||
|
|
||||||
// 填充AssetPathMapping1
|
|
||||||
{
|
|
||||||
string location = packageAsset.AssetPath;
|
|
||||||
|
|
||||||
// 添加原生路径的映射
|
|
||||||
if (manifest.AssetPathMapping1.ContainsKey(location))
|
|
||||||
throw new System.Exception($"Location have existed : {location}");
|
|
||||||
else
|
|
||||||
manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
|
|
||||||
|
|
||||||
// 添加无后缀名路径的映射
|
|
||||||
if (manifest.SupportExtensionless)
|
|
||||||
{
|
|
||||||
string locationWithoutExtension = Path.ChangeExtension(location, null);
|
|
||||||
if (ReferenceEquals(location, locationWithoutExtension) == false)
|
|
||||||
{
|
|
||||||
if (manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
|
|
||||||
YooLogger.Warning($"Location have existed : {locationWithoutExtension}");
|
|
||||||
else
|
|
||||||
manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加可寻址地址
|
|
||||||
if (manifest.EnableAddressable)
|
|
||||||
{
|
|
||||||
string location = packageAsset.Address;
|
|
||||||
if (string.IsNullOrEmpty(location) == false)
|
|
||||||
{
|
|
||||||
if (manifest.AssetPathMapping1.ContainsKey(location))
|
|
||||||
throw new System.Exception($"Location have existed : {location}");
|
|
||||||
else
|
|
||||||
manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 填充AssetPathMapping2
|
|
||||||
if (manifest.IncludeAssetGUID)
|
|
||||||
{
|
|
||||||
if (manifest.AssetPathMapping2.ContainsKey(packageAsset.AssetGUID))
|
|
||||||
throw new System.Exception($"AssetGUID have existed : {packageAsset.AssetGUID}");
|
|
||||||
else
|
|
||||||
manifest.AssetPathMapping2.Add(packageAsset.AssetGUID, packageAsset.AssetPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CreateBundleCollection(PackageManifest manifest, int bundleCount)
|
|
||||||
{
|
|
||||||
manifest.BundleList = new List<PackageBundle>(bundleCount);
|
|
||||||
manifest.BundleDic1 = new Dictionary<string, PackageBundle>(bundleCount);
|
|
||||||
manifest.BundleDic2 = new Dictionary<string, PackageBundle>(bundleCount);
|
|
||||||
manifest.BundleDic3 = new Dictionary<string, PackageBundle>(bundleCount);
|
|
||||||
}
|
|
||||||
public static void FillBundleCollection(PackageManifest manifest, PackageBundle packageBundle)
|
|
||||||
{
|
|
||||||
// 初始化资源包
|
|
||||||
packageBundle.InitBundle(manifest);
|
|
||||||
|
|
||||||
// 添加到列表集合
|
|
||||||
manifest.BundleList.Add(packageBundle);
|
|
||||||
|
|
||||||
manifest.BundleDic1.Add(packageBundle.BundleName, packageBundle);
|
|
||||||
manifest.BundleDic2.Add(packageBundle.FileName, packageBundle);
|
|
||||||
manifest.BundleDic3.Add(packageBundle.BundleGUID, packageBundle);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源文件的后缀名
|
/// 获取资源文件的后缀名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
_packageAssetCount = _buffer.ReadInt32();
|
_packageAssetCount = _buffer.ReadInt32();
|
||||||
_progressTotalValue = _packageAssetCount;
|
_progressTotalValue = _packageAssetCount;
|
||||||
ManifestTools.CreateAssetCollection(Manifest, _packageAssetCount);
|
CreateAssetCollection(Manifest, _packageAssetCount);
|
||||||
_steps = ESteps.DeserializeAssetList;
|
_steps = ESteps.DeserializeAssetList;
|
||||||
}
|
}
|
||||||
if (_steps == ESteps.DeserializeAssetList)
|
if (_steps == ESteps.DeserializeAssetList)
|
||||||
@@ -131,7 +131,7 @@ namespace YooAsset
|
|||||||
packageAsset.AssetTags = _buffer.ReadUTF8Array();
|
packageAsset.AssetTags = _buffer.ReadUTF8Array();
|
||||||
packageAsset.BundleID = _buffer.ReadInt32();
|
packageAsset.BundleID = _buffer.ReadInt32();
|
||||||
packageAsset.DependBundleIDs = _buffer.ReadInt32Array();
|
packageAsset.DependBundleIDs = _buffer.ReadInt32Array();
|
||||||
ManifestTools.FillAssetCollection(Manifest, packageAsset);
|
FillAssetCollection(Manifest, packageAsset);
|
||||||
|
|
||||||
_packageAssetCount--;
|
_packageAssetCount--;
|
||||||
Progress = 1f - _packageAssetCount / _progressTotalValue;
|
Progress = 1f - _packageAssetCount / _progressTotalValue;
|
||||||
@@ -149,7 +149,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
_packageBundleCount = _buffer.ReadInt32();
|
_packageBundleCount = _buffer.ReadInt32();
|
||||||
_progressTotalValue = _packageBundleCount;
|
_progressTotalValue = _packageBundleCount;
|
||||||
ManifestTools.CreateBundleCollection(Manifest, _packageBundleCount);
|
CreateBundleCollection(Manifest, _packageBundleCount);
|
||||||
_steps = ESteps.DeserializeBundleList;
|
_steps = ESteps.DeserializeBundleList;
|
||||||
}
|
}
|
||||||
if (_steps == ESteps.DeserializeBundleList)
|
if (_steps == ESteps.DeserializeBundleList)
|
||||||
@@ -165,7 +165,7 @@ namespace YooAsset
|
|||||||
packageBundle.Encrypted = _buffer.ReadBool();
|
packageBundle.Encrypted = _buffer.ReadBool();
|
||||||
packageBundle.Tags = _buffer.ReadUTF8Array();
|
packageBundle.Tags = _buffer.ReadUTF8Array();
|
||||||
packageBundle.DependBundleIDs = _buffer.ReadInt32Array();
|
packageBundle.DependBundleIDs = _buffer.ReadInt32Array();
|
||||||
ManifestTools.FillBundleCollection(Manifest, packageBundle);
|
FillBundleCollection(Manifest, packageBundle);
|
||||||
|
|
||||||
_packageBundleCount--;
|
_packageBundleCount--;
|
||||||
Progress = 1f - _packageBundleCount / _progressTotalValue;
|
Progress = 1f - _packageBundleCount / _progressTotalValue;
|
||||||
@@ -194,5 +194,117 @@ namespace YooAsset
|
|||||||
Error = e.Message;
|
Error = e.Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
internal override void InternalWaitForAsyncComplete()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (ExecuteWhileDone())
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateAssetCollection(PackageManifest manifest, int assetCount)
|
||||||
|
{
|
||||||
|
manifest.AssetList = new List<PackageAsset>(assetCount);
|
||||||
|
manifest.AssetDic = new Dictionary<string, PackageAsset>(assetCount);
|
||||||
|
|
||||||
|
if (manifest.EnableAddressable)
|
||||||
|
{
|
||||||
|
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (manifest.LocationToLower)
|
||||||
|
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 2, StringComparer.OrdinalIgnoreCase);
|
||||||
|
else
|
||||||
|
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (manifest.IncludeAssetGUID)
|
||||||
|
manifest.AssetPathMapping2 = new Dictionary<string, string>(assetCount);
|
||||||
|
else
|
||||||
|
manifest.AssetPathMapping2 = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
private void FillAssetCollection(PackageManifest manifest, PackageAsset packageAsset)
|
||||||
|
{
|
||||||
|
// 添加到列表集合
|
||||||
|
manifest.AssetList.Add(packageAsset);
|
||||||
|
|
||||||
|
// 注意:我们不允许原始路径存在重名
|
||||||
|
string assetPath = packageAsset.AssetPath;
|
||||||
|
if (manifest.AssetDic.ContainsKey(assetPath))
|
||||||
|
throw new System.Exception($"AssetPath have existed : {assetPath}");
|
||||||
|
else
|
||||||
|
manifest.AssetDic.Add(assetPath, packageAsset);
|
||||||
|
|
||||||
|
// 填充AssetPathMapping1
|
||||||
|
{
|
||||||
|
string location = packageAsset.AssetPath;
|
||||||
|
|
||||||
|
// 添加原生路径的映射
|
||||||
|
if (manifest.AssetPathMapping1.ContainsKey(location))
|
||||||
|
throw new System.Exception($"Location have existed : {location}");
|
||||||
|
else
|
||||||
|
manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
|
||||||
|
|
||||||
|
// 添加无后缀名路径的映射
|
||||||
|
if (manifest.SupportExtensionless)
|
||||||
|
{
|
||||||
|
string locationWithoutExtension = Path.ChangeExtension(location, null);
|
||||||
|
if (ReferenceEquals(location, locationWithoutExtension) == false)
|
||||||
|
{
|
||||||
|
if (manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
|
||||||
|
YooLogger.Warning($"Location have existed : {locationWithoutExtension}");
|
||||||
|
else
|
||||||
|
manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 填充AssetPathMapping2
|
||||||
|
if (manifest.IncludeAssetGUID)
|
||||||
|
{
|
||||||
|
if (manifest.AssetPathMapping2.ContainsKey(packageAsset.AssetGUID))
|
||||||
|
throw new System.Exception($"AssetGUID have existed : {packageAsset.AssetGUID}");
|
||||||
|
else
|
||||||
|
manifest.AssetPathMapping2.Add(packageAsset.AssetGUID, packageAsset.AssetPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加可寻址地址
|
||||||
|
if (manifest.EnableAddressable)
|
||||||
|
{
|
||||||
|
string location = packageAsset.Address;
|
||||||
|
if (string.IsNullOrEmpty(location) == false)
|
||||||
|
{
|
||||||
|
if (manifest.AssetPathMapping1.ContainsKey(location))
|
||||||
|
throw new System.Exception($"Location have existed : {location}");
|
||||||
|
else
|
||||||
|
manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateBundleCollection(PackageManifest manifest, int bundleCount)
|
||||||
|
{
|
||||||
|
manifest.BundleList = new List<PackageBundle>(bundleCount);
|
||||||
|
manifest.BundleDic1 = new Dictionary<string, PackageBundle>(bundleCount);
|
||||||
|
manifest.BundleDic2 = new Dictionary<string, PackageBundle>(bundleCount);
|
||||||
|
manifest.BundleDic3 = new Dictionary<string, PackageBundle>(bundleCount);
|
||||||
|
}
|
||||||
|
private void FillBundleCollection(PackageManifest manifest, PackageBundle packageBundle)
|
||||||
|
{
|
||||||
|
// 初始化资源包
|
||||||
|
packageBundle.InitBundle(manifest);
|
||||||
|
|
||||||
|
// 添加到列表集合
|
||||||
|
manifest.BundleList.Add(packageBundle);
|
||||||
|
|
||||||
|
manifest.BundleDic1.Add(packageBundle.BundleName, packageBundle);
|
||||||
|
manifest.BundleDic2.Add(packageBundle.FileName, packageBundle);
|
||||||
|
manifest.BundleDic3.Add(packageBundle.BundleGUID, packageBundle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,6 +106,9 @@ public static class ShaderVariantCollector
|
|||||||
|
|
||||||
if (_steps == ESteps.CollectSleeping)
|
if (_steps == ESteps.CollectSleeping)
|
||||||
{
|
{
|
||||||
|
if (ShaderUtil.anythingCompiling)
|
||||||
|
return;
|
||||||
|
|
||||||
if (_elapsedTime.ElapsedMilliseconds > SleepMilliseconds)
|
if (_elapsedTime.ElapsedMilliseconds > SleepMilliseconds)
|
||||||
{
|
{
|
||||||
DestroyAllSpheres();
|
DestroyAllSpheres();
|
||||||
|
|||||||
@@ -8,10 +8,20 @@ using TapTapMiniGame;
|
|||||||
|
|
||||||
public static class TaptapFileSystemCreater
|
public static class TaptapFileSystemCreater
|
||||||
{
|
{
|
||||||
public static FileSystemParameters CreateFileSystemParameters(string packageRoot)
|
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices)
|
||||||
{
|
{
|
||||||
string fileSystemClass = $"{nameof(TaptapFileSystem)},YooAsset.MiniGame";
|
string fileSystemClass = $"{nameof(TaptapFileSystem)},YooAsset.MiniGame";
|
||||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
||||||
|
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
||||||
|
return fileSystemParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices, IWebDecryptionServices decryptionServices)
|
||||||
|
{
|
||||||
|
string fileSystemClass = $"{nameof(TaptapFileSystem)},YooAsset.MiniGame";
|
||||||
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
||||||
|
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
||||||
|
fileSystemParams.AddParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, decryptionServices);
|
||||||
return fileSystemParams;
|
return fileSystemParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user