mirror of https://github.com/tuyoogame/YooAsset
Compare commits
No commits in common. "4e9c1955eb309fd1d3c211d830f4f41e7d97d7b4" and "4599ff098cc62237db5a0adf0e5d12fcfd64a8be" have entirely different histories.
4e9c1955eb
...
4599ff098c
|
@ -2,15 +2,6 @@
|
||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
## [2.3.5-preview] - 2025-03-14
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- (#502) 修复了原生缓存文件由于文件格式变动导致的加载本地缓存文件失败的问题。
|
|
||||||
- (#504) 修复了MacOS平台Offline Play Mode模式请求本地资源清单失败的问题。
|
|
||||||
- (#506) 修复了v2.3x版本LoadAllAssets方法计算依赖Bundle不完整的问题。
|
|
||||||
- (#506) 修复了微信小游戏文件系统,在启用加密算法后卸载bundle报错的问题。
|
|
||||||
|
|
||||||
## [2.3.4-preview] - 2025-03-08
|
## [2.3.4-preview] - 2025-03-08
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
|
||||||
{
|
|
||||||
public class TaskCreateCatalog
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 生成内置资源记录文件
|
|
||||||
/// </summary>
|
|
||||||
internal void CreateCatalogFile(BuildParametersContext buildParametersContext)
|
|
||||||
{
|
|
||||||
string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
|
|
||||||
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
|
||||||
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(buildPackageName, buildinRootDirectory);
|
|
||||||
|
|
||||||
// 刷新目录
|
|
||||||
AssetDatabase.Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 2d2c835e5e40ca34d93480587c8125df
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -30,7 +30,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 创建新补丁清单
|
// 创建新补丁清单
|
||||||
PackageManifest manifest = new PackageManifest();
|
PackageManifest manifest = new PackageManifest();
|
||||||
manifest.FileVersion = ManifestDefine.FileVersion;
|
manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
|
||||||
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||||
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||||
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
|
||||||
{
|
|
||||||
public class TaskCreateCatalog_BBP : TaskCreateCatalog, IBuildTask
|
|
||||||
{
|
|
||||||
void IBuildTask.Run(BuildContext context)
|
|
||||||
{
|
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
|
||||||
{
|
|
||||||
CreateCatalogFile(buildParametersContext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 8fe3d00b03dc9c64a96b7acfdf99b54c
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -36,7 +36,6 @@ namespace YooAsset.Editor
|
||||||
new TaskCreateReport_BBP(),
|
new TaskCreateReport_BBP(),
|
||||||
new TaskCreatePackage_BBP(),
|
new TaskCreatePackage_BBP(),
|
||||||
new TaskCopyBuildinFiles_BBP(),
|
new TaskCopyBuildinFiles_BBP(),
|
||||||
new TaskCreateCatalog_BBP()
|
|
||||||
};
|
};
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
|
||||||
{
|
|
||||||
public class TaskCreateCatalog_RFBP : TaskCreateCatalog, IBuildTask
|
|
||||||
{
|
|
||||||
void IBuildTask.Run(BuildContext context)
|
|
||||||
{
|
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
|
||||||
{
|
|
||||||
CreateCatalogFile(buildParametersContext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 563771ecaff17ee498b5fda7c1132e62
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -38,7 +38,6 @@ namespace YooAsset.Editor
|
||||||
new TaskCreateReport_RFBP(),
|
new TaskCreateReport_RFBP(),
|
||||||
new TaskCreatePackage_RFBP(),
|
new TaskCreatePackage_RFBP(),
|
||||||
new TaskCopyBuildinFiles_RFBP(),
|
new TaskCopyBuildinFiles_RFBP(),
|
||||||
new TaskCreateCatalog_RFBP()
|
|
||||||
};
|
};
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
|
||||||
{
|
|
||||||
public class TaskCreateCatalog_SBP : TaskCreateCatalog, IBuildTask
|
|
||||||
{
|
|
||||||
void IBuildTask.Run(BuildContext context)
|
|
||||||
{
|
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
|
||||||
{
|
|
||||||
CreateCatalogFile(buildParametersContext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: d8241b1eb8e22874b84d279dae9bbd1b
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -36,7 +36,6 @@ namespace YooAsset.Editor
|
||||||
new TaskCreateReport_SBP(),
|
new TaskCreateReport_SBP(),
|
||||||
new TaskCreatePackage_SBP(),
|
new TaskCreatePackage_SBP(),
|
||||||
new TaskCopyBuildinFiles_SBP(),
|
new TaskCopyBuildinFiles_SBP(),
|
||||||
new TaskCreateCatalog_SBP()
|
|
||||||
};
|
};
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal class CatalogDefine
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文件极限大小(100MB)
|
|
||||||
/// </summary>
|
|
||||||
public const int FileMaxSize = 104857600;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件头标记
|
|
||||||
/// </summary>
|
|
||||||
public const uint FileSign = 0x133C5EE;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件格式版本
|
|
||||||
/// </summary>
|
|
||||||
public const string FileVersion = "1.0.0";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: c6be7b8be0b51784997c959b370193e9
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,102 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal static class CatalogTools
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 序列化(JSON文件)
|
|
||||||
/// </summary>
|
|
||||||
public static void SerializeToJson(string savePath, DefaultBuildinFileCatalog catalog)
|
|
||||||
{
|
|
||||||
string json = JsonUtility.ToJson(catalog, true);
|
|
||||||
FileUtility.WriteAllText(savePath, json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 反序列化(JSON文件)
|
|
||||||
/// </summary>
|
|
||||||
public static DefaultBuildinFileCatalog DeserializeFromJson(string jsonContent)
|
|
||||||
{
|
|
||||||
return JsonUtility.FromJson<DefaultBuildinFileCatalog>(jsonContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 序列化(二进制文件)
|
|
||||||
/// </summary>
|
|
||||||
public static void SerializeToBinary(string savePath, DefaultBuildinFileCatalog catalog)
|
|
||||||
{
|
|
||||||
using (FileStream fs = new FileStream(savePath, FileMode.Create))
|
|
||||||
{
|
|
||||||
// 创建缓存器
|
|
||||||
BufferWriter buffer = new BufferWriter(CatalogDefine.FileMaxSize);
|
|
||||||
|
|
||||||
// 写入文件标记
|
|
||||||
buffer.WriteUInt32(CatalogDefine.FileSign);
|
|
||||||
|
|
||||||
// 写入文件版本
|
|
||||||
buffer.WriteUTF8(CatalogDefine.FileVersion);
|
|
||||||
|
|
||||||
// 写入文件头信息
|
|
||||||
buffer.WriteUTF8(catalog.PackageName);
|
|
||||||
buffer.WriteUTF8(catalog.PackageVersion);
|
|
||||||
|
|
||||||
// 写入资源包列表
|
|
||||||
buffer.WriteInt32(catalog.Wrappers.Count);
|
|
||||||
for (int i = 0; i < catalog.Wrappers.Count; i++)
|
|
||||||
{
|
|
||||||
var fileWrapper = catalog.Wrappers[i];
|
|
||||||
buffer.WriteUTF8(fileWrapper.BundleGUID);
|
|
||||||
buffer.WriteUTF8(fileWrapper.FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 写入文件流
|
|
||||||
buffer.WriteToStream(fs);
|
|
||||||
fs.Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 反序列化(二进制文件)
|
|
||||||
/// </summary>
|
|
||||||
public static DefaultBuildinFileCatalog DeserializeFromBinary(byte[] binaryData)
|
|
||||||
{
|
|
||||||
// 创建缓存器
|
|
||||||
BufferReader buffer = new BufferReader(binaryData);
|
|
||||||
|
|
||||||
// 读取文件标记
|
|
||||||
uint fileSign = buffer.ReadUInt32();
|
|
||||||
if (fileSign != CatalogDefine.FileSign)
|
|
||||||
throw new Exception("Invalid catalog file !");
|
|
||||||
|
|
||||||
// 读取文件版本
|
|
||||||
string fileVersion = buffer.ReadUTF8();
|
|
||||||
if (fileVersion != CatalogDefine.FileVersion)
|
|
||||||
throw new Exception($"The catalog file version are not compatible : {fileVersion} != {CatalogDefine.FileVersion}");
|
|
||||||
|
|
||||||
DefaultBuildinFileCatalog catalog = new DefaultBuildinFileCatalog();
|
|
||||||
{
|
|
||||||
// 读取文件头信息
|
|
||||||
catalog.FileVersion = fileVersion;
|
|
||||||
catalog.PackageName = buffer.ReadUTF8();
|
|
||||||
catalog.PackageVersion = buffer.ReadUTF8();
|
|
||||||
|
|
||||||
// 读取资源包列表
|
|
||||||
int fileCount = buffer.ReadInt32();
|
|
||||||
catalog.Wrappers = new List<DefaultBuildinFileCatalog.FileWrapper>(fileCount);
|
|
||||||
for (int i = 0; i < fileCount; i++)
|
|
||||||
{
|
|
||||||
var fileWrapper = new DefaultBuildinFileCatalog.FileWrapper();
|
|
||||||
fileWrapper.BundleGUID = buffer.ReadUTF8();
|
|
||||||
fileWrapper.FileName = buffer.ReadUTF8();
|
|
||||||
catalog.Wrappers.Add(fileWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return catalog;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: cf87ffe3b3de69942ac16640a330dd37
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,26 +1,26 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内置资源清单目录
|
/// 内置资源清单目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
internal class DefaultBuildinFileCatalog : ScriptableObject
|
||||||
internal class DefaultBuildinFileCatalog
|
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class FileWrapper
|
public class FileWrapper
|
||||||
{
|
{
|
||||||
public string BundleGUID;
|
public string BundleGUID;
|
||||||
public string FileName;
|
public string FileName;
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public FileWrapper(string bundleGUID, string fileName)
|
||||||
/// 文件版本
|
{
|
||||||
/// </summary>
|
BundleGUID = bundleGUID;
|
||||||
public string FileVersion;
|
FileName = fileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 包裹名称
|
/// 包裹名称
|
||||||
|
|
|
@ -336,9 +336,10 @@ namespace YooAsset
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
|
||||||
return PathUtility.Combine(_packageRoot, fileName);
|
return PathUtility.Combine(_packageRoot, fileName);
|
||||||
}
|
}
|
||||||
public string GetCatalogBinaryFileLoadPath()
|
public string GetCatalogFileLoadPath()
|
||||||
{
|
{
|
||||||
return PathUtility.Combine(_packageRoot, DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName);
|
string fileName = Path.GetFileNameWithoutExtension(DefaultBuildinFileSystemDefine.BuildinCatalogFileName);
|
||||||
|
return YooAssetSettingsData.GetYooResourcesLoadPath(PackageName, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -17,6 +17,10 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
YooLogger.Log("Begin to create catalog file !");
|
YooLogger.Log("Begin to create catalog file !");
|
||||||
|
|
||||||
|
string savePath = YooAssetSettingsData.GetYooResourcesFullPath();
|
||||||
|
if (UnityEditor.AssetDatabase.DeleteAsset(savePath))
|
||||||
|
UnityEditor.AssetDatabase.Refresh();
|
||||||
|
|
||||||
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
|
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
|
||||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
||||||
if (rootDirectory.Exists == false)
|
if (rootDirectory.Exists == false)
|
||||||
|
@ -83,25 +87,10 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建内置清单实例
|
// 创建内置清单实例
|
||||||
var buildinFileCatalog = new DefaultBuildinFileCatalog();
|
var buildinFileCatalog = ScriptableObject.CreateInstance<DefaultBuildinFileCatalog>();
|
||||||
buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
|
|
||||||
buildinFileCatalog.PackageName = packageName;
|
buildinFileCatalog.PackageName = packageName;
|
||||||
buildinFileCatalog.PackageVersion = packageVersion;
|
buildinFileCatalog.PackageVersion = packageVersion;
|
||||||
|
|
||||||
// 创建白名单查询集合
|
|
||||||
HashSet<string> whiteFileList = new HashSet<string>
|
|
||||||
{
|
|
||||||
"link.xml",
|
|
||||||
"buildlogtep.json",
|
|
||||||
$"{packageName}.version",
|
|
||||||
$"{packageName}_{packageVersion}.bytes",
|
|
||||||
$"{packageName}_{packageVersion}.hash",
|
|
||||||
$"{packageName}_{packageVersion}.json",
|
|
||||||
$"{packageName}_{packageVersion}.report",
|
|
||||||
DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName,
|
|
||||||
DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName
|
|
||||||
};
|
|
||||||
|
|
||||||
// 记录所有内置资源文件
|
// 记录所有内置资源文件
|
||||||
DirectoryInfo rootDirectory = new DirectoryInfo(pacakgeDirectory);
|
DirectoryInfo rootDirectory = new DirectoryInfo(pacakgeDirectory);
|
||||||
FileInfo[] fileInfos = rootDirectory.GetFiles();
|
FileInfo[] fileInfos = rootDirectory.GetFiles();
|
||||||
|
@ -110,15 +99,23 @@ namespace YooAsset
|
||||||
if (fileInfo.Extension == ".meta")
|
if (fileInfo.Extension == ".meta")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (whiteFileList.Contains(fileInfo.Name))
|
if (fileInfo.Name == "link.xml" || fileInfo.Name == "buildlogtep.json")
|
||||||
|
continue;
|
||||||
|
if (fileInfo.Name == $"{packageName}.version")
|
||||||
|
continue;
|
||||||
|
if (fileInfo.Name == $"{packageName}_{packageVersion}.bytes")
|
||||||
|
continue;
|
||||||
|
if (fileInfo.Name == $"{packageName}_{packageVersion}.hash")
|
||||||
|
continue;
|
||||||
|
if (fileInfo.Name == $"{packageName}_{packageVersion}.json")
|
||||||
|
continue;
|
||||||
|
if (fileInfo.Name == $"{packageName}_{packageVersion}.report")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string fileName = fileInfo.Name;
|
string fileName = fileInfo.Name;
|
||||||
if (fileMapping.TryGetValue(fileName, out string bundleGUID))
|
if (fileMapping.TryGetValue(fileName, out string bundleGUID))
|
||||||
{
|
{
|
||||||
var wrapper = new DefaultBuildinFileCatalog.FileWrapper();
|
var wrapper = new DefaultBuildinFileCatalog.FileWrapper(bundleGUID, fileName);
|
||||||
wrapper.BundleGUID = bundleGUID;
|
|
||||||
wrapper.FileName = fileName;
|
|
||||||
buildinFileCatalog.Wrappers.Add(wrapper);
|
buildinFileCatalog.Wrappers.Add(wrapper);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -127,20 +124,21 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建输出文件
|
// 创建输出目录
|
||||||
string jsonFilePath = $"{pacakgeDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
|
string fullPath = YooAssetSettingsData.GetYooResourcesFullPath();
|
||||||
if (File.Exists(jsonFilePath))
|
string saveFilePath = $"{fullPath}/{packageName}/{DefaultBuildinFileSystemDefine.BuildinCatalogFileName}";
|
||||||
File.Delete(jsonFilePath);
|
FileUtility.CreateFileDirectory(saveFilePath);
|
||||||
CatalogTools.SerializeToJson(jsonFilePath, buildinFileCatalog);
|
|
||||||
|
|
||||||
// 创建输出文件
|
// 创建输出文件
|
||||||
string binaryFilePath = $"{pacakgeDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
|
UnityEditor.AssetDatabase.CreateAsset(buildinFileCatalog, saveFilePath);
|
||||||
if (File.Exists(binaryFilePath))
|
UnityEditor.EditorUtility.SetDirty(buildinFileCatalog);
|
||||||
File.Delete(binaryFilePath);
|
#if UNITY_2019
|
||||||
CatalogTools.SerializeToBinary(binaryFilePath, buildinFileCatalog);
|
UnityEditor.AssetDatabase.SaveAssets();
|
||||||
|
#else
|
||||||
|
UnityEditor.AssetDatabase.SaveAssetIfDirty(buildinFileCatalog);
|
||||||
|
#endif
|
||||||
|
|
||||||
UnityEditor.AssetDatabase.Refresh();
|
Debug.Log($"Succeed to save buildin file catalog : {saveFilePath}");
|
||||||
Debug.Log($"Succeed to save buildin file catalog : {binaryFilePath}");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,8 @@ namespace YooAsset
|
||||||
internal class DefaultBuildinFileSystemDefine
|
internal class DefaultBuildinFileSystemDefine
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内置清单JSON文件名称
|
/// 内置清单文件名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string BuildinCatalogJsonFileName = "BuildinCatalog.json";
|
public const string BuildinCatalogFileName = "BuildinCatalog.asset";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 内置清单二进制文件名称
|
|
||||||
/// </summary>
|
|
||||||
public const string BuildinCatalogBinaryFileName = "BuildinCatalog.bytes";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
|
@ -7,84 +7,56 @@ namespace YooAsset
|
||||||
private enum ESteps
|
private enum ESteps
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
RequestData,
|
|
||||||
LoadCatalog,
|
LoadCatalog,
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly DefaultBuildinFileSystem _fileSystem;
|
private readonly DefaultBuildinFileSystem _fileSystem;
|
||||||
private UnityWebDataRequestOperation _webDataRequestOp;
|
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
|
||||||
internal LoadBuildinCatalogFileOperation(DefaultBuildinFileSystem fileSystem)
|
internal LoadBuildinCatalogFileOperation(DefaultBuildinFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
_steps = ESteps.RequestData;
|
_steps = ESteps.LoadCatalog;
|
||||||
}
|
}
|
||||||
internal override void InternalUpdate()
|
internal override void InternalUpdate()
|
||||||
{
|
{
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_steps == ESteps.RequestData)
|
|
||||||
{
|
|
||||||
if (_webDataRequestOp == null)
|
|
||||||
{
|
|
||||||
string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
|
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
|
||||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
|
||||||
_webDataRequestOp.StartOperation();
|
|
||||||
AddChildOperation(_webDataRequestOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_webDataRequestOp.UpdateOperation();
|
|
||||||
if (_webDataRequestOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_webDataRequestOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.LoadCatalog;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _webDataRequestOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.LoadCatalog)
|
if (_steps == ESteps.LoadCatalog)
|
||||||
{
|
{
|
||||||
try
|
string catalogFilePath = _fileSystem.GetCatalogFileLoadPath();
|
||||||
{
|
var catalog = Resources.Load<DefaultBuildinFileCatalog>(catalogFilePath);
|
||||||
var catalog = CatalogTools.DeserializeFromBinary(_webDataRequestOp.Result);
|
if (catalog == null)
|
||||||
if (catalog.PackageName != _fileSystem.PackageName)
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = $"Catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var wrapper in catalog.Wrappers)
|
|
||||||
{
|
|
||||||
var fileWrapper = new DefaultBuildinFileSystem.FileWrapper(wrapper.FileName);
|
|
||||||
_fileSystem.RecordCatalogFile(wrapper.BundleGUID, fileWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
YooLogger.Log($"Package '{_fileSystem.PackageName}' buildin catalog files count : {catalog.Wrappers.Count}");
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = $"Failed to load catalog file : {e.Message}";
|
Error = $"Failed to load catalog file : {catalogFilePath}";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (catalog.PackageName != _fileSystem.PackageName)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = $"Catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var wrapper in catalog.Wrappers)
|
||||||
|
{
|
||||||
|
var fileWrapper = new DefaultBuildinFileSystem.FileWrapper(wrapper.FileName);
|
||||||
|
_fileSystem.RecordCatalogFile(wrapper.BundleGUID, fileWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
YooLogger.Log($"Package '{_fileSystem.PackageName}' buildin catalog files count : {catalog.Wrappers.Count}");
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,13 +333,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
return _records.Keys.ToList();
|
return _records.Keys.ToList();
|
||||||
}
|
}
|
||||||
public RecordFileElement GetRecordFileElement(PackageBundle bundle)
|
|
||||||
{
|
|
||||||
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element))
|
|
||||||
return element;
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetTempFilePath(PackageBundle bundle)
|
public string GetTempFilePath(PackageBundle bundle)
|
||||||
{
|
{
|
||||||
|
@ -391,10 +384,10 @@ namespace YooAsset
|
||||||
|
|
||||||
public EFileVerifyResult VerifyCacheFile(PackageBundle bundle)
|
public EFileVerifyResult VerifyCacheFile(PackageBundle bundle)
|
||||||
{
|
{
|
||||||
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element) == false)
|
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement wrapper) == false)
|
||||||
return EFileVerifyResult.CacheNotFound;
|
return EFileVerifyResult.CacheNotFound;
|
||||||
|
|
||||||
EFileVerifyResult result = FileVerifyHelper.FileVerify(element.DataFilePath, element.DataFileSize, element.DataFileCRC, EFileVerifyLevel.High);
|
EFileVerifyResult result = FileVerifyHelper.FileVerify(wrapper.DataFilePath, wrapper.DataFileSize, wrapper.DataFileCRC, EFileVerifyLevel.High);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public bool WriteCacheBundleFile(PackageBundle bundle, string copyPath)
|
public bool WriteCacheBundleFile(PackageBundle bundle, string copyPath)
|
||||||
|
@ -434,10 +427,10 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
public bool DeleteCacheBundleFile(string bundleGUID)
|
public bool DeleteCacheBundleFile(string bundleGUID)
|
||||||
{
|
{
|
||||||
if (_records.TryGetValue(bundleGUID, out RecordFileElement element))
|
if (_records.TryGetValue(bundleGUID, out RecordFileElement wrapper))
|
||||||
{
|
{
|
||||||
_records.Remove(bundleGUID);
|
_records.Remove(bundleGUID);
|
||||||
return element.DeleteFolder();
|
return wrapper.DeleteFolder();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.IO;
|
||||||
using System.IO;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
|
@ -261,30 +260,9 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
if (_fileSystem.Exists(_bundle))
|
if (_fileSystem.Exists(_bundle))
|
||||||
{
|
{
|
||||||
// 注意:缓存的原生文件的格式,可能会在业务端根据需求发生变动!
|
DownloadProgress = 1f;
|
||||||
// 注意:这里需要校验文件格式,如果不一致对本地文件进行修正!
|
DownloadedBytes = _bundle.FileSize;
|
||||||
string filePath = _fileSystem.GetCacheBundleFileLoadPath(_bundle);
|
_steps = ESteps.LoadCacheRawBundle;
|
||||||
if (File.Exists(filePath) == false)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var recordFileElement = _fileSystem.GetRecordFileElement(_bundle);
|
|
||||||
File.Move(recordFileElement.DataFilePath, filePath);
|
|
||||||
_steps = ESteps.LoadCacheRawBundle;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = $"Faild rename raw data file : {e.Message}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DownloadProgress = 1f;
|
|
||||||
DownloadedBytes = _bundle.FileSize;
|
|
||||||
_steps = ESteps.LoadCacheRawBundle;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,12 @@ namespace YooAsset
|
||||||
if (_fileSystem.AppendFileExtension)
|
if (_fileSystem.AppendFileExtension)
|
||||||
{
|
{
|
||||||
string dataFileExtension = FindDataFileExtension(chidDirectory);
|
string dataFileExtension = FindDataFileExtension(chidDirectory);
|
||||||
if (string.IsNullOrEmpty(dataFileExtension) == false)
|
if (string.IsNullOrEmpty(dataFileExtension))
|
||||||
|
{
|
||||||
|
//注意:覆盖安装的情况下,缓存文件可能会没有后缀格式,需要删除重新下载!
|
||||||
|
dataFilePath = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
dataFilePath += dataFileExtension;
|
dataFilePath += dataFileExtension;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,9 +198,10 @@ namespace YooAsset
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
|
||||||
return PathUtility.Combine(FileRoot, fileName);
|
return PathUtility.Combine(FileRoot, fileName);
|
||||||
}
|
}
|
||||||
public string GetCatalogBinaryFileLoadPath()
|
public string GetCatalogFileLoadPath()
|
||||||
{
|
{
|
||||||
return PathUtility.Combine(_webPackageRoot, DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName);
|
string fileName = Path.GetFileNameWithoutExtension(DefaultBuildinFileSystemDefine.BuildinCatalogFileName);
|
||||||
|
return YooAssetSettingsData.GetYooResourcesLoadPath(PackageName, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
|
@ -10,84 +11,61 @@ namespace YooAsset
|
||||||
private enum ESteps
|
private enum ESteps
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
RequestData,
|
|
||||||
LoadCatalog,
|
LoadCatalog,
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly DefaultWebServerFileSystem _fileSystem;
|
private readonly DefaultWebServerFileSystem _fileSystem;
|
||||||
private UnityWebDataRequestOperation _webDataRequestOp;
|
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内置清单版本
|
||||||
|
/// </summary>
|
||||||
|
public string PackageVersion { private set; get; }
|
||||||
|
|
||||||
internal LoadWebServerCatalogFileOperation(DefaultWebServerFileSystem fileSystem)
|
internal LoadWebServerCatalogFileOperation(DefaultWebServerFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
_steps = ESteps.RequestData;
|
_steps = ESteps.LoadCatalog;
|
||||||
}
|
}
|
||||||
internal override void InternalUpdate()
|
internal override void InternalUpdate()
|
||||||
{
|
{
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_steps == ESteps.RequestData)
|
|
||||||
{
|
|
||||||
if (_webDataRequestOp == null)
|
|
||||||
{
|
|
||||||
string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
|
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
|
||||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
|
||||||
_webDataRequestOp.StartOperation();
|
|
||||||
AddChildOperation(_webDataRequestOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_webDataRequestOp.UpdateOperation();
|
|
||||||
if (_webDataRequestOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_webDataRequestOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.LoadCatalog;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _webDataRequestOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.LoadCatalog)
|
if (_steps == ESteps.LoadCatalog)
|
||||||
{
|
{
|
||||||
try
|
string catalogFilePath = _fileSystem.GetCatalogFileLoadPath();
|
||||||
{
|
var catalog = Resources.Load<DefaultBuildinFileCatalog>(catalogFilePath);
|
||||||
var catalog = CatalogTools.DeserializeFromBinary(_webDataRequestOp.Result);
|
if (catalog == null)
|
||||||
if (catalog.PackageName != _fileSystem.PackageName)
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = $"Catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var wrapper in catalog.Wrappers)
|
|
||||||
{
|
|
||||||
var fileWrapper = new DefaultWebServerFileSystem.FileWrapper(wrapper.FileName);
|
|
||||||
_fileSystem.RecordCatalogFile(wrapper.BundleGUID, fileWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
YooLogger.Log($"Package '{_fileSystem.PackageName}' buildin catalog files count : {catalog.Wrappers.Count}");
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = $"Failed to load catalog file : {e.Message}";
|
Error = $"Failed to load web server catalog file : {catalogFilePath}";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (catalog.PackageName != _fileSystem.PackageName)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = $"Web server catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PackageVersion = catalog.PackageVersion;
|
||||||
|
foreach (var wrapper in catalog.Wrappers)
|
||||||
|
{
|
||||||
|
var fileWrapper = new DefaultWebServerFileSystem.FileWrapper(wrapper.FileName);
|
||||||
|
_fileSystem.RecordCatalogFile(wrapper.BundleGUID, fileWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
YooLogger.Log($"Package '{_fileSystem.PackageName}' catalog files count : {catalog.Wrappers.Count}");
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
public class ManifestDefine
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文件极限大小(100MB)
|
|
||||||
/// </summary>
|
|
||||||
public const int FileMaxSize = 104857600;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件头标记
|
|
||||||
/// </summary>
|
|
||||||
public const uint FileSign = 0x594F4F;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件格式版本
|
|
||||||
/// </summary>
|
|
||||||
public const string FileVersion = "2.3.1";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 3282b72521a19144292a482e50ba0429
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -8,6 +8,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal static class ManifestTools
|
internal static class ManifestTools
|
||||||
{
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序列化(JSON文件)
|
/// 序列化(JSON文件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -25,10 +26,10 @@ namespace YooAsset
|
||||||
using (FileStream fs = new FileStream(savePath, FileMode.Create))
|
using (FileStream fs = new FileStream(savePath, FileMode.Create))
|
||||||
{
|
{
|
||||||
// 创建缓存器
|
// 创建缓存器
|
||||||
BufferWriter buffer = new BufferWriter(ManifestDefine.FileMaxSize);
|
BufferWriter buffer = new BufferWriter(YooAssetSettings.ManifestFileMaxSize);
|
||||||
|
|
||||||
// 写入文件标记
|
// 写入文件标记
|
||||||
buffer.WriteUInt32(ManifestDefine.FileSign);
|
buffer.WriteUInt32(YooAssetSettings.ManifestFileSign);
|
||||||
|
|
||||||
// 写入文件版本
|
// 写入文件版本
|
||||||
buffer.WriteUTF8(manifest.FileVersion);
|
buffer.WriteUTF8(manifest.FileVersion);
|
||||||
|
@ -96,13 +97,13 @@ namespace YooAsset
|
||||||
|
|
||||||
// 读取文件标记
|
// 读取文件标记
|
||||||
uint fileSign = buffer.ReadUInt32();
|
uint fileSign = buffer.ReadUInt32();
|
||||||
if (fileSign != ManifestDefine.FileSign)
|
if (fileSign != YooAssetSettings.ManifestFileSign)
|
||||||
throw new Exception("Invalid manifest file !");
|
throw new Exception("Invalid manifest file !");
|
||||||
|
|
||||||
// 读取文件版本
|
// 读取文件版本
|
||||||
string fileVersion = buffer.ReadUTF8();
|
string fileVersion = buffer.ReadUTF8();
|
||||||
if (fileVersion != ManifestDefine.FileVersion)
|
if (fileVersion != YooAssetSettings.ManifestFileVersion)
|
||||||
throw new Exception($"The manifest file version are not compatible : {fileVersion} != {ManifestDefine.FileVersion}");
|
throw new Exception($"The manifest file version are not compatible : {fileVersion} != {YooAssetSettings.ManifestFileVersion}");
|
||||||
|
|
||||||
PackageManifest manifest = new PackageManifest();
|
PackageManifest manifest = new PackageManifest();
|
||||||
{
|
{
|
||||||
|
@ -159,7 +160,7 @@ namespace YooAsset
|
||||||
InitManifest(manifest);
|
InitManifest(manifest);
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#region 解析资源清单辅助方法
|
#region 解析资源清单辅助方法
|
||||||
public static void InitManifest(PackageManifest manifest)
|
public static void InitManifest(PackageManifest manifest)
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace YooAsset
|
||||||
|
|
||||||
// 读取文件标记
|
// 读取文件标记
|
||||||
uint fileSign = _buffer.ReadUInt32();
|
uint fileSign = _buffer.ReadUInt32();
|
||||||
if (fileSign != ManifestDefine.FileSign)
|
if (fileSign != YooAssetSettings.ManifestFileSign)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
|
@ -67,11 +67,11 @@ namespace YooAsset
|
||||||
|
|
||||||
// 读取文件版本
|
// 读取文件版本
|
||||||
string fileVersion = _buffer.ReadUTF8();
|
string fileVersion = _buffer.ReadUTF8();
|
||||||
if (fileVersion != ManifestDefine.FileVersion)
|
if (fileVersion != YooAssetSettings.ManifestFileVersion)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = $"The manifest file version are not compatible : {fileVersion} != {ManifestDefine.FileVersion}";
|
Error = $"The manifest file version are not compatible : {fileVersion} != {YooAssetSettings.ManifestFileVersion}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,22 @@ namespace YooAsset
|
||||||
public string PackageManifestPrefix = string.Empty;
|
public string PackageManifestPrefix = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清单文件头标记
|
||||||
|
/// </summary>
|
||||||
|
public const uint ManifestFileSign = 0x594F4F;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清单文件极限大小(100MB)
|
||||||
|
/// </summary>
|
||||||
|
public const int ManifestFileMaxSize = 104857600;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清单文件格式版本
|
||||||
|
/// </summary>
|
||||||
|
public const string ManifestFileVersion = "2.3.1";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建输出文件夹名称
|
/// 构建输出文件夹名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -106,6 +106,28 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 路径相关
|
#region 路径相关
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的Resources目录的加载路径
|
||||||
|
/// </summary>
|
||||||
|
internal static string GetYooResourcesLoadPath(string packageName, string fileName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return PathUtility.Combine(packageName, fileName);
|
||||||
|
else
|
||||||
|
return PathUtility.Combine(Setting.DefaultYooFolderName, packageName, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的Resources目录的全路径
|
||||||
|
/// </summary>
|
||||||
|
internal static string GetYooResourcesFullPath()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return $"Assets/Resources";
|
||||||
|
else
|
||||||
|
return $"Assets/Resources/{Setting.DefaultYooFolderName}";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取YOO的编辑器下缓存文件根目录
|
/// 获取YOO的编辑器下缓存文件根目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -17,7 +17,7 @@ internal class WXFSClearUnusedBundleFilesAsync : FSClearCacheFilesOperation
|
||||||
|
|
||||||
private readonly WechatFileSystem _fileSystem;
|
private readonly WechatFileSystem _fileSystem;
|
||||||
private readonly PackageManifest _manifest;
|
private readonly PackageManifest _manifest;
|
||||||
private List<string> _unusedCacheFiles = new List<string>(1000);
|
private List<string> _unusedCacheFiles;
|
||||||
private int _unusedFileTotalCount = 0;
|
private int _unusedFileTotalCount = 0;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "com.tuyoogame.yooasset",
|
"name": "com.tuyoogame.yooasset",
|
||||||
"displayName": "YooAsset",
|
"displayName": "YooAsset",
|
||||||
"version": "2.3.5-preview",
|
"version": "2.3.4-preview",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"description": "unity3d resources management system.",
|
"description": "unity3d resources management system.",
|
||||||
"author": {
|
"author": {
|
||||||
|
|
Loading…
Reference in New Issue