mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-30 13:38:46 +00:00
Compare commits
133 Commits
2.3.10
...
1918c1f216
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1918c1f216 | ||
|
|
4caf733ac6 | ||
|
|
014b17f5cb | ||
|
|
f3ebda0c04 | ||
|
|
96b33f5816 | ||
|
|
9ad572c7a4 | ||
|
|
5602addaca | ||
|
|
c4ae67aa8e | ||
|
|
bbcc3bf971 | ||
|
|
8b0e75b9b3 | ||
|
|
b1f02049cc | ||
|
|
512886cdf6 | ||
|
|
0c3ccc5c2f | ||
|
|
b0ea03170f | ||
|
|
2c3b890329 | ||
|
|
0f39cb9444 | ||
|
|
8acc16d3f6 | ||
|
|
fd1715a89b | ||
|
|
0934c813d1 | ||
|
|
be71d38cd8 | ||
|
|
4cdfde31da | ||
|
|
0133549ef8 | ||
|
|
81d9eb47c8 | ||
|
|
5fde689f1f | ||
|
|
5d51bfe751 | ||
|
|
ed86edd2b0 | ||
|
|
f627b5b59a | ||
|
|
549ec74519 | ||
|
|
247ee31348 | ||
|
|
90d3a53bc3 | ||
|
|
19f1d67a61 | ||
|
|
a71c46d1c4 | ||
|
|
82d7bc8fef | ||
|
|
cc85099253 | ||
|
|
d392b02bd4 | ||
|
|
a5138b9846 | ||
|
|
e1b6458c26 | ||
|
|
0f73dc3047 | ||
|
|
a85e49c22a | ||
|
|
6b291de922 | ||
|
|
a4b1300195 | ||
|
|
6f34951a74 | ||
|
|
c798250258 | ||
|
|
6fc82bb55a | ||
|
|
c22cf5ffeb | ||
|
|
36bc24f9fd | ||
|
|
addb0ecdfe | ||
|
|
89e23e0df8 | ||
|
|
e2f582834e | ||
|
|
d2c2844f61 | ||
|
|
1de64278ad | ||
|
|
227f2332a9 | ||
|
|
131614687c | ||
|
|
b8ec902f60 | ||
|
|
eb3e29b6ad | ||
|
|
11ed9d391a | ||
|
|
9cd50bc7f3 | ||
|
|
e92505ba88 | ||
|
|
06a670730c | ||
|
|
ccd21e56cb | ||
|
|
522bcc529a | ||
|
|
2254ac9f5e | ||
|
|
956b3db71d | ||
|
|
fb56959c61 | ||
|
|
b9b9f4e37d | ||
|
|
c050d6d172 | ||
|
|
baf76a454b | ||
|
|
385d343262 | ||
|
|
1f5ad24d44 | ||
|
|
fefc0043cf | ||
|
|
f49143d4f7 | ||
|
|
fd760b12a3 | ||
|
|
14cf8e9ca3 | ||
|
|
3595219a71 | ||
|
|
a4c7d4b8f5 | ||
|
|
43c5c7fb53 | ||
|
|
48d2b36d4e | ||
|
|
2fd87f4d4b | ||
|
|
0fd75b835a | ||
|
|
4489ca570b | ||
|
|
268792b576 | ||
|
|
33907ea967 | ||
|
|
5d7afff3e4 | ||
|
|
fa15f83d85 | ||
|
|
1801974c8a | ||
|
|
bfd476d59c | ||
|
|
7dd08e9634 | ||
|
|
b2776b933a | ||
|
|
9f09b6c526 | ||
|
|
01f6103b48 | ||
|
|
053b4a00d7 | ||
|
|
db159428c6 | ||
|
|
ac7ee16017 | ||
|
|
c2fb7c3cbb | ||
|
|
e70b0d37cd | ||
|
|
53db012fc8 | ||
|
|
b3622167da | ||
|
|
dd6fab46f9 | ||
|
|
f0796dccc9 | ||
|
|
f383c59327 | ||
|
|
e34b9270d2 | ||
|
|
b90ab01fe9 | ||
|
|
236468b4a8 | ||
|
|
6f5fcd55b1 | ||
|
|
4b8f2e3acc | ||
|
|
090e4f4b15 | ||
|
|
53163a75ae | ||
|
|
273401cb20 | ||
|
|
97fe3b0681 | ||
|
|
d401086fd1 | ||
|
|
e3a12ef361 | ||
|
|
1b0288fcd0 | ||
|
|
3ee94fb3b9 | ||
|
|
a0ea80c158 | ||
|
|
264415b362 | ||
|
|
6a76d44c38 | ||
|
|
cebfd57851 | ||
|
|
60eb1c3522 | ||
|
|
40c82835bf | ||
|
|
a13913f572 | ||
|
|
150b46a0a7 | ||
|
|
ebde5a52d3 | ||
|
|
e57466e9e2 | ||
|
|
6f7fca7b34 | ||
|
|
756331fe0b | ||
|
|
5139e2f3a7 | ||
|
|
1c4aba6db5 | ||
|
|
44faa0c5e6 | ||
|
|
72c97341b1 | ||
|
|
9acc240b5a | ||
|
|
ed89e73d26 | ||
|
|
9e33df0375 | ||
|
|
6c98f9a09d |
@@ -2,6 +2,301 @@
|
|||||||
|
|
||||||
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.16] - 2025-09-17
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- (#638) 优化了Provider加载机制,引用计数为零时自动挂起!
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#644) [**严重**] 修复了2.3.15版本,资产量巨大的情况下,编辑器下模拟模式初始化耗时很久的问题。
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- (#639) 新增了文件系统参数:VIRTUAL_DOWNLOAD_MODE 和 VIRTUAL_DOWNLOAD_SPEED
|
||||||
|
|
||||||
|
编辑器下不需要构建AB,也可以模拟远端资源下载,等同真机运行环境。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
class DefaultEditorFIleSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 模拟虚拟下载模式
|
||||||
|
/// </summary>
|
||||||
|
public bool VirtualDownloadMode { private set; get; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模拟虚拟下载的网速(单位:字节)
|
||||||
|
/// </summary>
|
||||||
|
public int VirtualDownloadSpeed { private set; get; } = 1024;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- (#640) 新增了文件系统参数:VIRTUAL_WEBGL_MODE
|
||||||
|
|
||||||
|
编辑器下不需要构建AB,也可以模拟小游戏开发环境,等同真机运行环境。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
class DefaultEditorFIleSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 模拟WebGL平台模式
|
||||||
|
/// </summary>
|
||||||
|
public bool VirtualWebGLMode { private set; get; } = false;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- (#642) 新增了文件系统参数:DOWNLOAD_WATCH_DOG_TIME
|
||||||
|
|
||||||
|
监控时间范围内,如果没有接收到任何下载数据,那么直接终止任务!
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
class DefaultCacheFIleSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义参数:下载任务的看门狗机制监控时间
|
||||||
|
/// </summary>
|
||||||
|
public int DownloadWatchDogTime { private set; get; } = int.MaxValue;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 下载器参数timeout移除。
|
||||||
|
|
||||||
|
可以使用文件系统的看门狗机制代替。
|
||||||
|
|
||||||
|
- (#632) IFilterRule接口变动。
|
||||||
|
|
||||||
|
收集器可以指定搜寻的资源类型,在收集目录资产量巨大的情况下,可以极大加快打包速度!
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public interface IFilterRule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 搜寻的资源类型
|
||||||
|
/// 说明:使用引擎方法搜索获取所有资源列表
|
||||||
|
/// </summary>
|
||||||
|
string FindAssetType { get; }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.15] - 2025-09-09
|
||||||
|
|
||||||
|
**重要**:升级了资源清单版本,不兼容老版本。建议重新提审安装包。
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- 重构了UniTask扩展库的目录结构和说明文档。
|
||||||
|
- 重构了内置文件系统类的加载和拷贝逻辑,解决在一些特殊机型上遇到的偶发性拷贝失败问题。
|
||||||
|
- 增加了生成内置清单文件的窗口工具,详情见扩展工程里CreateBuildinCatalog目录。
|
||||||
|
- 优化了异步操作系统的繁忙检测机制。
|
||||||
|
- (#621) 资源配置页面可以展示DependCollector和StaticCollector包含的文件列表内容。
|
||||||
|
- (#627) 优化了资源清单部分字段类型,CRC字段从字符串类型调整为整形,可以降低清单尺寸。
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复了构建页面扩展类缺少指定属性报错的问题。
|
||||||
|
- (#611) 修复了资源扫描器配置页面,修改备注信息后会丢失焦点的问题。
|
||||||
|
- (#622) 修复了纯鸿蒙系统读取内置加密文件失败的问题。
|
||||||
|
- (#620) 修复了LINUX系统URL地址转换失败的问题。
|
||||||
|
- (#631) 修复了NET 4.x程序集库Math.Clamp导致的编译错误。
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 新增了支持支付宝小游戏的文件系统扩展类。
|
||||||
|
|
||||||
|
- 新增了支持Taptap小游戏的文件系统扩展类。
|
||||||
|
|
||||||
|
- 新增了资源系统初始化参数:UseWeakReferenceHandle
|
||||||
|
|
||||||
|
目前处于预览版,可以在引擎设置页面开启宏:YOOASSET_EXPERIMENTAL
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
/// <summary>
|
||||||
|
/// 启用弱引用资源句柄
|
||||||
|
/// </summary>
|
||||||
|
public bool UseWeakReferenceHandle = false;
|
||||||
|
```
|
||||||
|
|
||||||
|
- 内置文件系统和缓存文件系统新增初始化参数:FILE_VERIFY_MAX_CONCURRENCY
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义参数:初始化的时候缓存文件校验最大并发数
|
||||||
|
/// </summary>
|
||||||
|
public int FileVerifyMaxConcurrency { private set; get; }
|
||||||
|
```
|
||||||
|
|
||||||
|
- (#623) 内置构建管线新增构建参数:StripUnityVersion
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
/// <summary>
|
||||||
|
/// 从文件头里剥离Unity版本信息
|
||||||
|
/// </summary>
|
||||||
|
public bool StripUnityVersion = false;
|
||||||
|
```
|
||||||
|
|
||||||
|
- 可编程构建管线新增构建参数:TrackSpriteAtlasDependencies
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
/// <summary>
|
||||||
|
/// 自动建立资源对象对图集的依赖关系
|
||||||
|
/// </summary>
|
||||||
|
public bool TrackSpriteAtlasDependencies = false;
|
||||||
|
```
|
||||||
|
|
||||||
|
- (#617) 新增资源收集配置参数:SupportExtensionless
|
||||||
|
|
||||||
|
在不需要模糊加载模式的前提下,关闭此选项,可以降低运行时内存大小。
|
||||||
|
|
||||||
|
该选项默认开启!
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public class CollectCommand
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 支持无后缀名的资源定位地址
|
||||||
|
/// </summary>
|
||||||
|
public bool SupportExtensionless { set; get; }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- (#625) 异步操作系统类新增监听方法。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
class OperationSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 监听任务开始
|
||||||
|
/// </summary>
|
||||||
|
public static void RegisterStartCallback(Action<string, AsyncOperationBase> callback);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 监听任务结束
|
||||||
|
/// </summary>
|
||||||
|
public static void RegisterFinishCallback(Action<string, AsyncOperationBase> callback);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.14] - 2025-07-23
|
||||||
|
|
||||||
|
**重要**:**所有下载相关的超时参数(timeout)已更新判定逻辑**
|
||||||
|
|
||||||
|
超时不再以‘指定时间内未接收到任何数据’为判定条件,而是以‘指定时间内未完成整个下载任务’为判定条件。
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- 重构了核心代码的下载逻辑,解决了同步加载触发的下载任务没有完成的问题。
|
||||||
|
- 扩展工程里新增了PreprocessBuildCatalog类,用于处理在构建应用程序前自动生成内置资源目录文件。
|
||||||
|
- (#592) 优化了资源清单逻辑里不必要产生的GC逻辑。
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#590) 修复了TryUnloadUnusedAsset方法,在依赖嵌套层数过深导致没有卸载的问题。
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 新增了支持Google Play的文件系统扩展示例。
|
||||||
|
|
||||||
|
- 新增了支持DefaultCacheFileSystem的单元测试用例。
|
||||||
|
|
||||||
|
- 新增了文件系统配置参数:DISABLE_ONDEMAND_DOWNLOAD
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public class FileSystemParametersDefine
|
||||||
|
{
|
||||||
|
// 禁用边玩边下机制
|
||||||
|
public const string DISABLE_ONDEMAND_DOWNLOAD = "DISABLE_ONDEMAND_DOWNLO";
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- IManifestServices接口拆分为了IManifestProcessServices和IManifestRestoreServices
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public interface IManifestProcessServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 处理资源清单(压缩或加密)
|
||||||
|
/// </summary>
|
||||||
|
byte[] ProcessManifest(byte[] fileData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IManifestRestoreServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 还原资源清单(解压或解密)
|
||||||
|
/// </summary>
|
||||||
|
byte[] RestoreManifest(byte[] fileData);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## [2.3.12] - 2025-07-01
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- 优化了同步接口导致的资源拷贝和资源验证性能开销高的现象。
|
||||||
|
- 微信小游戏和抖音小游戏支持资源清单加密。
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#579) 修复了2.3.10版本资源包构建页面里CopyBuildinFileParam无法编辑问题。
|
||||||
|
- (#572) 修复了资源收集页面指定收集的预制体名称变动的问题。
|
||||||
|
- (#582) 修复了非递归收集依赖时,依赖列表中才包含主资源的问题。
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 新增初始化参数:WebGLForceSyncLoadAsset
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public abstract class InitializeParameters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// WebGL平台强制同步加载资源对象
|
||||||
|
/// </summary>Add commentMore actions
|
||||||
|
public bool WebGLForceSyncLoadAsset = false;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- (#576) 新增了资源清单服务类:IManifestServices
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
/// <summary>
|
||||||
|
/// 资源清单文件处理服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IManifestServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 处理资源清单(压缩和加密)
|
||||||
|
/// </summary>
|
||||||
|
byte[] ProcessManifest(byte[] fileData);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 还原资源清单(解压和解密)
|
||||||
|
/// </summary>
|
||||||
|
byte[] RestoreManifest(byte[] fileData);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- (#585) 新增了本地文件拷贝服务类:ICopyLocalFileServices
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
/// <summary>
|
||||||
|
/// 本地文件拷贝服务类
|
||||||
|
/// </summary>
|
||||||
|
public interface ICopyLocalFileServices
|
||||||
|
{
|
||||||
|
void CopyFile(LocalFileInfo sourceFileInfo, string destFilePath);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## [2.3.10] - 2025-06-17
|
## [2.3.10] - 2025-06-17
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|||||||
@@ -32,21 +32,14 @@ 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)
|
||||||
{
|
{
|
||||||
return new ScannerResult(e.StackTrace);
|
return new ScannerResult(e.Message, e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -294,6 +294,11 @@ namespace YooAsset.Editor
|
|||||||
_scannerListView.itemsSource = filterItems;
|
_scannerListView.itemsSource = filterItems;
|
||||||
_scannerListView.Rebuild();
|
_scannerListView.Rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_lastModifyScannerIndex >= 0 && _lastModifyScannerIndex < _scannerListView.itemsSource.Count)
|
||||||
|
{
|
||||||
|
_scannerListView.selectedIndex = _lastModifyScannerIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private List<AssetArtScanner> FilterScanners()
|
private List<AssetArtScanner> FilterScanners()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -18,6 +13,11 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string ErrorInfo { private set; get; }
|
public string ErrorInfo { private set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误堆栈
|
||||||
|
/// </summary>
|
||||||
|
public string ErrorStack { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否成功
|
/// 是否成功
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -33,15 +33,14 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ScannerResult(string error)
|
public ScannerResult(string error, string stack)
|
||||||
{
|
{
|
||||||
ErrorInfo = error;
|
ErrorInfo = error;
|
||||||
|
ErrorStack = stack;
|
||||||
}
|
}
|
||||||
public ScannerResult(string filePath, ScanReport report)
|
public ScannerResult(ScanReport report)
|
||||||
{
|
{
|
||||||
ReprotFilePath = filePath;
|
|
||||||
Report = report;
|
Report = report;
|
||||||
ErrorInfo = string.Empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -55,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetStreamingAssetsRoot()
|
public static string GetStreamingAssetsRoot()
|
||||||
{
|
{
|
||||||
return YooAssetSettingsData.GetYooDefaultBuildinRoot();
|
return YooAssetSettingsData.GetYooDefaultBuiltinRoot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,39 +43,63 @@ namespace YooAsset.Editor
|
|||||||
EditorPrefs.SetInt(key, (int)fileNameStyle);
|
EditorPrefs.SetInt(key, (int)fileNameStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// EBuildinFileCopyOption
|
// EBuiltinFileCopyOption
|
||||||
public static EBuildinFileCopyOption GetPackageBuildinFileCopyOption(string packageName, string buildPipeline)
|
public static EBuiltinFileCopyOption GetPackageBuiltinFileCopyOption(string packageName, string buildPipeline)
|
||||||
{
|
{
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildinFileCopyOption)}";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuiltinFileCopyOption)}";
|
||||||
return (EBuildinFileCopyOption)EditorPrefs.GetInt(key, (int)EBuildinFileCopyOption.None);
|
return (EBuiltinFileCopyOption)EditorPrefs.GetInt(key, (int)EBuiltinFileCopyOption.None);
|
||||||
}
|
}
|
||||||
public static void SetPackageBuildinFileCopyOption(string packageName, string buildPipeline, EBuildinFileCopyOption buildinFileCopyOption)
|
public static void SetPackageBuiltinFileCopyOption(string packageName, string buildPipeline, EBuiltinFileCopyOption builtinFileCopyOption)
|
||||||
{
|
{
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildinFileCopyOption)}";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuiltinFileCopyOption)}";
|
||||||
EditorPrefs.SetInt(key, (int)buildinFileCopyOption);
|
EditorPrefs.SetInt(key, (int)builtinFileCopyOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildFileCopyParams
|
// BuildFileCopyParams
|
||||||
public static string GetPackageBuildinFileCopyParams(string packageName, string buildPipeline)
|
public static string GetPackageBuiltinFileCopyParams(string packageName, string buildPipeline)
|
||||||
{
|
{
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_BuildFileCopyParams";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_BuildFileCopyParams";
|
||||||
return EditorPrefs.GetString(key, string.Empty);
|
return EditorPrefs.GetString(key, string.Empty);
|
||||||
}
|
}
|
||||||
public static void SetPackageBuildinFileCopyParams(string packageName, string buildPipeline, string buildinFileCopyParams)
|
public static void SetPackageBuiltinFileCopyParams(string packageName, string buildPipeline, string builtinFileCopyParams)
|
||||||
{
|
{
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_BuildFileCopyParams";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_BuildFileCopyParams";
|
||||||
EditorPrefs.SetString(key, buildinFileCopyParams);
|
EditorPrefs.SetString(key, builtinFileCopyParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncyptionClassName
|
// EncyptionServicesClassName
|
||||||
public static string GetPackageEncyptionClassName(string packageName, string buildPipeline)
|
public static string GetPackageEncyptionServicesClassName(string packageName, string buildPipeline)
|
||||||
{
|
{
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionServicesClassName";
|
||||||
return EditorPrefs.GetString(key, string.Empty);
|
return EditorPrefs.GetString(key, $"{typeof(EncryptionNone).FullName}");
|
||||||
}
|
}
|
||||||
public static void SetPackageEncyptionClassName(string packageName, string buildPipeline, string encyptionClassName)
|
public static void SetPackageEncyptionServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
||||||
{
|
{
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionServicesClassName";
|
||||||
|
EditorPrefs.SetString(key, encyptionClassName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ManifestProcessServicesClassName
|
||||||
|
public static string GetPackageManifestProcessServicesClassName(string packageName, string buildPipeline)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestProcessServicesClassName";
|
||||||
|
return EditorPrefs.GetString(key, $"{typeof(ManifestProcessNone).FullName}");
|
||||||
|
}
|
||||||
|
public static void SetPackageManifestProcessServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestProcessServicesClassName";
|
||||||
|
EditorPrefs.SetString(key, encyptionClassName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ManifestRestoreServicesClassName
|
||||||
|
public static string GetPackageManifestRestoreServicesClassName(string packageName, string buildPipeline)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestRestoreServicesClassName";
|
||||||
|
return EditorPrefs.GetString(key, $"{typeof(ManifestRestoreNone).FullName}");
|
||||||
|
}
|
||||||
|
public static void SetPackageManifestRestoreServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestRestoreServicesClassName";
|
||||||
EditorPrefs.SetString(key, encyptionClassName);
|
EditorPrefs.SetString(key, encyptionClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ namespace YooAsset.Editor
|
|||||||
foreach (var classType in viewerClassTypes)
|
foreach (var classType in viewerClassTypes)
|
||||||
{
|
{
|
||||||
var buildPipelineAttribute = EditorTools.GetAttribute<BuildPipelineAttribute>(classType);
|
var buildPipelineAttribute = EditorTools.GetAttribute<BuildPipelineAttribute>(classType);
|
||||||
|
if (buildPipelineAttribute == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"The class {classType.FullName} need attribute {nameof(BuildPipelineAttribute)}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
string pipelineName = buildPipelineAttribute.PipelineName;
|
string pipelineName = buildPipelineAttribute.PipelineName;
|
||||||
if (_viewClassDic.ContainsKey(pipelineName))
|
if (_viewClassDic.ContainsKey(pipelineName))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,15 +17,15 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
var buildParameters = new EditorSimulateBuildParameters();
|
var buildParameters = new EditorSimulateBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuiltinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = EBuildPipeline.EditorSimulateBuildPipeline.ToString();
|
buildParameters.BuildPipeline = EBuildPipeline.EditorSimulateBuildPipeline.ToString();
|
||||||
buildParameters.BuildBundleType = (int)EBuildBundleType.VirtualBundle;
|
buildParameters.BuildBundleType = (int)EBuildBundleType.VirtualBundle;
|
||||||
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
||||||
buildParameters.PackageName = packageName;
|
buildParameters.PackageName = packageName;
|
||||||
buildParameters.PackageVersion = "Simulate";
|
buildParameters.PackageVersion = "Simulate";
|
||||||
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
||||||
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
|
buildParameters.BuiltinFileCopyOption = EBuiltinFileCopyOption.None;
|
||||||
buildParameters.BuildinFileCopyParams = string.Empty;
|
buildParameters.BuiltinFileCopyParams = string.Empty;
|
||||||
buildParameters.UseAssetDependencyDB = true;
|
buildParameters.UseAssetDependencyDB = true;
|
||||||
|
|
||||||
var pipeline = new EditorSimulateBuildPipeline();
|
var pipeline = new EditorSimulateBuildPipeline();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件哈希值
|
/// 文件哈希值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PackageFileCRC { set; get; }
|
public uint PackageFileCRC { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件哈希值
|
/// 文件哈希值
|
||||||
@@ -106,7 +106,27 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] GetAllPackAssetPaths()
|
public string[] GetAllPackAssetPaths()
|
||||||
{
|
{
|
||||||
return AllPackAssets.Select(t => t.AssetInfo.AssetPath).ToArray();
|
List<string> results = new List<string>(AllPackAssets.Count);
|
||||||
|
for (int i = 0; i < AllPackAssets.Count; i++)
|
||||||
|
{
|
||||||
|
var packAsset = AllPackAssets[i];
|
||||||
|
results.Add(packAsset.AssetInfo.AssetPath);
|
||||||
|
}
|
||||||
|
return results.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取构建的资源可寻址列表
|
||||||
|
/// </summary>
|
||||||
|
public string[] GetAllPackAssetAddress()
|
||||||
|
{
|
||||||
|
List<string> results = new List<string>(AllPackAssets.Count);
|
||||||
|
for (int i = 0; i < AllPackAssets.Count; i++)
|
||||||
|
{
|
||||||
|
var packAsset = AllPackAssets[i];
|
||||||
|
results.Add(packAsset.Address);
|
||||||
|
}
|
||||||
|
return results.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -153,13 +173,15 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建AssetBundleBuild类
|
/// 创建AssetBundleBuild类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UnityEditor.AssetBundleBuild CreatePipelineBuild()
|
public UnityEditor.AssetBundleBuild CreatePipelineBuild(bool replaceAssetPathWithAddress)
|
||||||
{
|
{
|
||||||
// 注意:我们不再支持AssetBundle的变种机制
|
// 注意:我们不再支持AssetBundle的变种机制
|
||||||
AssetBundleBuild build = new AssetBundleBuild();
|
AssetBundleBuild build = new AssetBundleBuild();
|
||||||
build.assetBundleName = BundleName;
|
build.assetBundleName = BundleName;
|
||||||
build.assetBundleVariant = string.Empty;
|
build.assetBundleVariant = string.Empty;
|
||||||
build.assetNames = GetAllPackAssetPaths();
|
build.assetNames = GetAllPackAssetPaths();
|
||||||
|
if (replaceAssetPathWithAddress)
|
||||||
|
build.addressableNames = GetAllPackAssetAddress();
|
||||||
return build;
|
return build;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<string, BuildBundleInfo> _bundleInfoDic = new Dictionary<string, BuildBundleInfo>(10000);
|
private readonly Dictionary<string, BuildBundleInfo> _bundleInfoDic = new Dictionary<string, BuildBundleInfo>(10000);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图集资源集合
|
||||||
|
/// </summary>
|
||||||
|
public readonly List<BuildAssetInfo> SpriteAtlasAssetList = new List<BuildAssetInfo>(10000);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 未被依赖的资源列表
|
/// 未被依赖的资源列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -60,6 +65,12 @@ namespace YooAsset.Editor
|
|||||||
newBundleInfo.PackAsset(assetInfo);
|
newBundleInfo.PackAsset(assetInfo);
|
||||||
_bundleInfoDic.Add(bundleName, newBundleInfo);
|
_bundleInfoDic.Add(bundleName, newBundleInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 统计所有的精灵图集
|
||||||
|
if (assetInfo.AssetInfo.IsSpriteAtlas())
|
||||||
|
{
|
||||||
|
SpriteAtlasAssetList.Add(assetInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -85,12 +96,12 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取构建管线里需要的数据
|
/// 获取构建管线里需要的数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UnityEditor.AssetBundleBuild[] GetPipelineBuilds()
|
public UnityEditor.AssetBundleBuild[] GetPipelineBuilds(bool replaceAssetPathWithAddres)
|
||||||
{
|
{
|
||||||
List<UnityEditor.AssetBundleBuild> builds = new List<UnityEditor.AssetBundleBuild>(_bundleInfoDic.Count);
|
List<UnityEditor.AssetBundleBuild> builds = new List<UnityEditor.AssetBundleBuild>(_bundleInfoDic.Count);
|
||||||
foreach (var bundleInfo in _bundleInfoDic.Values)
|
foreach (var bundleInfo in _bundleInfoDic.Values)
|
||||||
{
|
{
|
||||||
builds.Add(bundleInfo.CreatePipelineBuild());
|
builds.Add(bundleInfo.CreatePipelineBuild(replaceAssetPathWithAddres));
|
||||||
}
|
}
|
||||||
return builds.ToArray();
|
return builds.ToArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内置文件的根目录
|
/// 内置文件的根目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BuildinFileRoot;
|
public string BuiltinFileRoot;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建管线名称
|
/// 构建管线名称
|
||||||
@@ -86,23 +86,32 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内置文件的拷贝选项
|
/// 内置文件的拷贝选项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EBuildinFileCopyOption BuildinFileCopyOption = EBuildinFileCopyOption.None;
|
public EBuiltinFileCopyOption BuiltinFileCopyOption = EBuiltinFileCopyOption.None;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内置文件的拷贝参数
|
/// 内置文件的拷贝参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BuildinFileCopyParams;
|
public string BuiltinFileCopyParams;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源包加密服务类
|
/// 资源包加密服务类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEncryptionServices EncryptionServices;
|
public IEncryptionServices EncryptionServices;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源清单加密服务类
|
||||||
|
/// </summary>
|
||||||
|
public IManifestProcessServices ManifestProcessServices;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源清单解密服务类
|
||||||
|
/// </summary>
|
||||||
|
public IManifestRestoreServices ManifestRestoreServices;
|
||||||
|
|
||||||
private string _pipelineOutputDirectory = string.Empty;
|
private string _pipelineOutputDirectory = string.Empty;
|
||||||
private string _packageOutputDirectory = string.Empty;
|
private string _packageOutputDirectory = string.Empty;
|
||||||
private string _packageRootDirectory = string.Empty;
|
private string _packageRootDirectory = string.Empty;
|
||||||
private string _buildinRootDirectory = string.Empty;
|
private string _builtinRootDirectory = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检测构建参数是否合法
|
/// 检测构建参数是否合法
|
||||||
@@ -127,9 +136,9 @@ namespace YooAsset.Editor
|
|||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildOutputRootIsNullOrEmpty, "Build output root is null or empty !");
|
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildOutputRootIsNullOrEmpty, "Build output root is null or empty !");
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(BuildinFileRoot))
|
if (string.IsNullOrEmpty(BuiltinFileRoot))
|
||||||
{
|
{
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildinFileRootIsNullOrEmpty, "Buildin file root is null or empty !");
|
string message = BuildLogger.GetErrorMessage(ErrorCode.BuiltinFileRootIsNullOrEmpty, "Builtin file root is null or empty !");
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(BuildPipeline))
|
if (string.IsNullOrEmpty(BuildPipeline))
|
||||||
@@ -201,13 +210,13 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取内置资源的根目录
|
/// 获取内置资源的根目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string GetBuildinRootDirectory()
|
public virtual string GetBuiltinRootDirectory()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_buildinRootDirectory))
|
if (string.IsNullOrEmpty(_builtinRootDirectory))
|
||||||
{
|
{
|
||||||
_buildinRootDirectory = $"{BuildinFileRoot}/{PackageName}";
|
_builtinRootDirectory = $"{BuiltinFileRoot}/{PackageName}";
|
||||||
}
|
}
|
||||||
return _buildinRootDirectory;
|
return _builtinRootDirectory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,9 +55,9 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取内置资源的根目录
|
/// 获取内置资源的根目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetBuildinRootDirectory()
|
public string GetBuiltinRootDirectory()
|
||||||
{
|
{
|
||||||
return Parameters.GetBuildinRootDirectory();
|
return Parameters.GetBuiltinRootDirectory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,30 +6,30 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public class TaskCopyBuildinFiles
|
public class TaskCopyBuiltinFiles
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拷贝首包资源文件
|
/// 拷贝首包资源文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal void CopyBuildinFilesToStreaming(BuildParametersContext buildParametersContext, PackageManifest manifest)
|
internal void CopyBuiltinFilesToStreaming(BuildParametersContext buildParametersContext, PackageManifest manifest)
|
||||||
{
|
{
|
||||||
EBuildinFileCopyOption copyOption = buildParametersContext.Parameters.BuildinFileCopyOption;
|
EBuiltinFileCopyOption copyOption = buildParametersContext.Parameters.BuiltinFileCopyOption;
|
||||||
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
||||||
string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
|
string builtinRootDirectory = buildParametersContext.GetBuiltinRootDirectory();
|
||||||
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
||||||
string buildPackageVersion = buildParametersContext.Parameters.PackageVersion;
|
string buildPackageVersion = buildParametersContext.Parameters.PackageVersion;
|
||||||
|
|
||||||
// 清空内置文件的目录
|
// 清空内置文件的目录
|
||||||
if (copyOption == EBuildinFileCopyOption.ClearAndCopyAll || copyOption == EBuildinFileCopyOption.ClearAndCopyByTags)
|
if (copyOption == EBuiltinFileCopyOption.ClearAndCopyAll || copyOption == EBuiltinFileCopyOption.ClearAndCopyByTags)
|
||||||
{
|
{
|
||||||
EditorTools.ClearFolder(buildinRootDirectory);
|
EditorTools.ClearFolder(builtinRootDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拷贝补丁清单文件
|
// 拷贝补丁清单文件
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildPackageName, buildPackageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildPackageName, buildPackageVersion);
|
||||||
string sourcePath = $"{packageOutputDirectory}/{fileName}";
|
string sourcePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
string destPath = $"{buildinRootDirectory}/{fileName}";
|
string destPath = $"{builtinRootDirectory}/{fileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(buildPackageName, buildPackageVersion);
|
string fileName = YooAssetSettingsData.GetPackageHashFileName(buildPackageName, buildPackageVersion);
|
||||||
string sourcePath = $"{packageOutputDirectory}/{fileName}";
|
string sourcePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
string destPath = $"{buildinRootDirectory}/{fileName}";
|
string destPath = $"{builtinRootDirectory}/{fileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,38 +45,38 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(buildPackageName);
|
string fileName = YooAssetSettingsData.GetPackageVersionFileName(buildPackageName);
|
||||||
string sourcePath = $"{packageOutputDirectory}/{fileName}";
|
string sourcePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
string destPath = $"{buildinRootDirectory}/{fileName}";
|
string destPath = $"{builtinRootDirectory}/{fileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拷贝文件列表(所有文件)
|
// 拷贝文件列表(所有文件)
|
||||||
if (copyOption == EBuildinFileCopyOption.ClearAndCopyAll || copyOption == EBuildinFileCopyOption.OnlyCopyAll)
|
if (copyOption == EBuiltinFileCopyOption.ClearAndCopyAll || copyOption == EBuiltinFileCopyOption.OnlyCopyAll)
|
||||||
{
|
{
|
||||||
foreach (var packageBundle in manifest.BundleList)
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
{
|
{
|
||||||
string sourcePath = $"{packageOutputDirectory}/{packageBundle.FileName}";
|
string sourcePath = $"{packageOutputDirectory}/{packageBundle.FileName}";
|
||||||
string destPath = $"{buildinRootDirectory}/{packageBundle.FileName}";
|
string destPath = $"{builtinRootDirectory}/{packageBundle.FileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拷贝文件列表(带标签的文件)
|
// 拷贝文件列表(带标签的文件)
|
||||||
if (copyOption == EBuildinFileCopyOption.ClearAndCopyByTags || copyOption == EBuildinFileCopyOption.OnlyCopyByTags)
|
if (copyOption == EBuiltinFileCopyOption.ClearAndCopyByTags || copyOption == EBuiltinFileCopyOption.OnlyCopyByTags)
|
||||||
{
|
{
|
||||||
string[] tags = buildParametersContext.Parameters.BuildinFileCopyParams.Split(';');
|
string[] tags = buildParametersContext.Parameters.BuiltinFileCopyParams.Split(';');
|
||||||
foreach (var packageBundle in manifest.BundleList)
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
{
|
{
|
||||||
if (packageBundle.HasTag(tags) == false)
|
if (packageBundle.HasTag(tags) == false)
|
||||||
continue;
|
continue;
|
||||||
string sourcePath = $"{packageOutputDirectory}/{packageBundle.FileName}";
|
string sourcePath = $"{packageOutputDirectory}/{packageBundle.FileName}";
|
||||||
string destPath = $"{buildinRootDirectory}/{packageBundle.FileName}";
|
string destPath = $"{builtinRootDirectory}/{packageBundle.FileName}";
|
||||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 刷新目录
|
// 刷新目录
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
BuildLogger.Log($"Buildin files copy complete: {buildinRootDirectory}");
|
BuildLogger.Log($"Builtin files copy complete: {builtinRootDirectory}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,9 +12,10 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal void CreateCatalogFile(BuildParametersContext buildParametersContext)
|
internal void CreateCatalogFile(BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
|
string builtinRootDirectory = buildParametersContext.GetBuiltinRootDirectory();
|
||||||
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
||||||
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(buildPackageName, buildinRootDirectory);
|
var manifestServices = buildParametersContext.Parameters.ManifestRestoreServices;
|
||||||
|
CatalogTools.CreateCatalogFile(manifestServices, buildPackageName, builtinRootDirectory);
|
||||||
|
|
||||||
// 刷新目录
|
// 刷新目录
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建补丁清单文件到输出目录
|
/// 创建补丁清单文件到输出目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void CreateManifestFile(bool processBundleDepends, bool processBundleTags, BuildContext context)
|
protected void CreateManifestFile(bool processBundleDepends, bool processBundleTags, bool replaceAssetPathWithAddress, BuildContext context)
|
||||||
{
|
{
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
@@ -32,8 +33,10 @@ namespace YooAsset.Editor
|
|||||||
PackageManifest manifest = new PackageManifest();
|
PackageManifest manifest = new PackageManifest();
|
||||||
manifest.FileVersion = ManifestDefine.FileVersion;
|
manifest.FileVersion = ManifestDefine.FileVersion;
|
||||||
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||||
|
manifest.SupportExtensionless = buildMapContext.Command.SupportExtensionless;
|
||||||
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||||
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||||
|
manifest.ReplaceAssetPathWithAddress = replaceAssetPathWithAddress;
|
||||||
manifest.OutputNameStyle = (int)buildParameters.FileNameStyle;
|
manifest.OutputNameStyle = (int)buildParameters.FileNameStyle;
|
||||||
manifest.BuildBundleType = buildParameters.BuildBundleType;
|
manifest.BuildBundleType = buildParameters.BuildBundleType;
|
||||||
manifest.BuildPipeline = buildParameters.BuildPipeline;
|
manifest.BuildPipeline = buildParameters.BuildPipeline;
|
||||||
@@ -56,9 +59,15 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// 4. 处理内置资源包
|
// 4. 处理内置资源包
|
||||||
if (processBundleDepends)
|
if (processBundleDepends)
|
||||||
ProcessBuiltinBundleDependency(context, manifest);
|
{
|
||||||
|
// 注意:初始化资源清单建立引用关系
|
||||||
|
manifest.Initialize();
|
||||||
|
|
||||||
// 创建补丁清单文本文件
|
ProcessBuiltinBundleDependency(context, manifest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 创建资源清单文本文件
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
string fileName = YooAssetSettingsData.GetManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
string filePath = $"{packageOutputDirectory}/{fileName}";
|
string filePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
@@ -66,18 +75,18 @@ namespace YooAsset.Editor
|
|||||||
BuildLogger.Log($"Create package manifest file: {filePath}");
|
BuildLogger.Log($"Create package manifest file: {filePath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建补丁清单二进制文件
|
// 创建资源清单二进制文件
|
||||||
string packageHash;
|
string packageHash;
|
||||||
string packagePath;
|
string packagePath;
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
packagePath = $"{packageOutputDirectory}/{fileName}";
|
packagePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
ManifestTools.SerializeToBinary(packagePath, manifest);
|
ManifestTools.SerializeToBinary(packagePath, manifest, buildParameters.ManifestProcessServices);
|
||||||
packageHash = HashUtility.FileCRC32(packagePath);
|
packageHash = HashUtility.FileCRC32(packagePath);
|
||||||
BuildLogger.Log($"Create package manifest file: {packagePath}");
|
BuildLogger.Log($"Create package manifest file: {packagePath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建补丁清单哈希文件
|
// 创建资源清单哈希文件
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
string fileName = YooAssetSettingsData.GetPackageHashFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
string filePath = $"{packageOutputDirectory}/{fileName}";
|
string filePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
@@ -85,7 +94,7 @@ namespace YooAsset.Editor
|
|||||||
BuildLogger.Log($"Create package manifest hash file: {filePath}");
|
BuildLogger.Log($"Create package manifest hash file: {filePath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建补丁清单版本文件
|
// 创建资源清单版本文件
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(buildParameters.PackageName);
|
string fileName = YooAssetSettingsData.GetPackageVersionFileName(buildParameters.PackageName);
|
||||||
string filePath = $"{packageOutputDirectory}/{fileName}";
|
string filePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
@@ -97,7 +106,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
ManifestContext manifestContext = new ManifestContext();
|
ManifestContext manifestContext = new ManifestContext();
|
||||||
byte[] bytesData = FileUtility.ReadAllBytes(packagePath);
|
byte[] bytesData = FileUtility.ReadAllBytes(packagePath);
|
||||||
manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData);
|
manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData, buildParameters.ManifestRestoreServices);
|
||||||
context.SetContextObject(manifestContext);
|
context.SetContextObject(manifestContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -303,15 +312,34 @@ namespace YooAsset.Editor
|
|||||||
// 注意:如果是可编程构建管线,需要补充内置资源包
|
// 注意:如果是可编程构建管线,需要补充内置资源包
|
||||||
// 注意:该步骤依赖前面的操作!
|
// 注意:该步骤依赖前面的操作!
|
||||||
var buildResultContext = context.TryGetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
var buildResultContext = context.TryGetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
||||||
|
|
||||||
if (buildResultContext != null)
|
if (buildResultContext != null)
|
||||||
{
|
{
|
||||||
// 注意:初始化资源清单建立引用关系
|
ProcessBuiltinBundleReference(manifest, buildResultContext.BuiltinShadersBundleName);
|
||||||
ManifestTools.InitManifest(manifest);
|
ProcessBuiltinBundleReference(manifest, buildResultContext.MonoScriptsBundleName);
|
||||||
ProcessBuiltinBundleReference(context, manifest, buildResultContext.BuiltinShadersBundleName);
|
|
||||||
ProcessBuiltinBundleReference(context, manifest, buildResultContext.MonoScriptsBundleName);
|
var buildParametersContext = context.TryGetContextObject<BuildParametersContext>();
|
||||||
|
var buildParameters = buildParametersContext.Parameters;
|
||||||
|
if (buildParameters is ScriptableBuildParameters scriptableBuildParameters)
|
||||||
|
{
|
||||||
|
if (scriptableBuildParameters.TrackSpriteAtlasDependencies)
|
||||||
|
{
|
||||||
|
// 注意:检测是否开启图集模式
|
||||||
|
// 说明:需要记录主资源对象对图集的依赖关系!
|
||||||
|
if (EditorSettings.spritePackerMode != SpritePackerMode.Disabled)
|
||||||
|
{
|
||||||
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
foreach (var spriteAtlasAsset in buildMapContext.SpriteAtlasAssetList)
|
||||||
|
{
|
||||||
|
string spriteAtlasBundleName = spriteAtlasAsset.BundleName;
|
||||||
|
ProcessBuiltinBundleReference(manifest, spriteAtlasBundleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ProcessBuiltinBundleReference(BuildContext context, PackageManifest manifest, string builtinBundleName)
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ProcessBuiltinBundleReference(PackageManifest manifest, string builtinBundleName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(builtinBundleName))
|
if (string.IsNullOrEmpty(builtinBundleName))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace YooAsset.Editor
|
|||||||
// 收集器配置
|
// 收集器配置
|
||||||
buildReport.Summary.UniqueBundleName = buildMapContext.Command.UniqueBundleName;
|
buildReport.Summary.UniqueBundleName = buildMapContext.Command.UniqueBundleName;
|
||||||
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||||
|
buildReport.Summary.SupportExtensionless = buildMapContext.Command.SupportExtensionless;
|
||||||
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
|
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||||
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||||
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
||||||
@@ -43,13 +44,17 @@ namespace YooAsset.Editor
|
|||||||
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
||||||
buildReport.Summary.SingleReferencedPackAlone = buildParameters.SingleReferencedPackAlone;
|
buildReport.Summary.SingleReferencedPackAlone = buildParameters.SingleReferencedPackAlone;
|
||||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
||||||
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
buildReport.Summary.EncryptionServicesClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
||||||
|
buildReport.Summary.ManifestProcessServicesClassName = buildParameters.ManifestProcessServices == null ? "null" : buildParameters.ManifestProcessServices.GetType().FullName;
|
||||||
|
buildReport.Summary.ManifestRestoreServicesClassName = buildParameters.ManifestRestoreServices == null ? "null" : buildParameters.ManifestRestoreServices.GetType().FullName;
|
||||||
|
|
||||||
if (buildParameters is BuiltinBuildParameters)
|
if (buildParameters is BuiltinBuildParameters)
|
||||||
{
|
{
|
||||||
var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
|
var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
|
||||||
buildReport.Summary.CompressOption = builtinBuildParameters.CompressOption;
|
buildReport.Summary.CompressOption = builtinBuildParameters.CompressOption;
|
||||||
buildReport.Summary.DisableWriteTypeTree = builtinBuildParameters.DisableWriteTypeTree;
|
buildReport.Summary.DisableWriteTypeTree = builtinBuildParameters.DisableWriteTypeTree;
|
||||||
buildReport.Summary.IgnoreTypeTreeChanges = builtinBuildParameters.IgnoreTypeTreeChanges;
|
buildReport.Summary.IgnoreTypeTreeChanges = builtinBuildParameters.IgnoreTypeTreeChanges;
|
||||||
|
buildReport.Summary.ReplaceAssetPathWithAddress = builtinBuildParameters.ReplaceAssetPathWithAddress;
|
||||||
}
|
}
|
||||||
else if (buildParameters is ScriptableBuildParameters)
|
else if (buildParameters is ScriptableBuildParameters)
|
||||||
{
|
{
|
||||||
@@ -57,6 +62,7 @@ namespace YooAsset.Editor
|
|||||||
buildReport.Summary.CompressOption = scriptableBuildParameters.CompressOption;
|
buildReport.Summary.CompressOption = scriptableBuildParameters.CompressOption;
|
||||||
buildReport.Summary.DisableWriteTypeTree = scriptableBuildParameters.DisableWriteTypeTree;
|
buildReport.Summary.DisableWriteTypeTree = scriptableBuildParameters.DisableWriteTypeTree;
|
||||||
buildReport.Summary.IgnoreTypeTreeChanges = scriptableBuildParameters.IgnoreTypeTreeChanges;
|
buildReport.Summary.IgnoreTypeTreeChanges = scriptableBuildParameters.IgnoreTypeTreeChanges;
|
||||||
|
buildReport.Summary.ReplaceAssetPathWithAddress = scriptableBuildParameters.ReplaceAssetPathWithAddress;
|
||||||
buildReport.Summary.WriteLinkXML = scriptableBuildParameters.WriteLinkXML;
|
buildReport.Summary.WriteLinkXML = scriptableBuildParameters.WriteLinkXML;
|
||||||
buildReport.Summary.CacheServerHost = scriptableBuildParameters.CacheServerHost;
|
buildReport.Summary.CacheServerHost = scriptableBuildParameters.CacheServerHost;
|
||||||
buildReport.Summary.CacheServerPort = scriptableBuildParameters.CacheServerPort;
|
buildReport.Summary.CacheServerPort = scriptableBuildParameters.CacheServerPort;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace YooAsset.Editor
|
|||||||
protected abstract string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context);
|
protected abstract string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context);
|
||||||
protected abstract uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context);
|
protected abstract uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context);
|
||||||
protected abstract string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
protected abstract string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
||||||
protected abstract string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
protected abstract uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
||||||
protected abstract long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
protected abstract long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,8 @@ namespace YooAsset.Editor
|
|||||||
// 开始构建
|
// 开始构建
|
||||||
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
|
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
|
||||||
BuildAssetBundleOptions buildOptions = builtinBuildParameters.GetBundleBuildOptions();
|
BuildAssetBundleOptions buildOptions = builtinBuildParameters.GetBundleBuildOptions();
|
||||||
AssetBundleManifest unityManifest = BuildPipeline.BuildAssetBundles(pipelineOutputDirectory, buildMapContext.GetPipelineBuilds(), buildOptions, buildParametersContext.Parameters.BuildTarget);
|
var bundleBuilds = buildMapContext.GetPipelineBuilds(builtinBuildParameters.ReplaceAssetPathWithAddress);
|
||||||
|
AssetBundleManifest unityManifest = BuildPipeline.BuildAssetBundles(pipelineOutputDirectory, bundleBuilds, buildOptions, buildParametersContext.Parameters.BuildTarget);
|
||||||
if (unityManifest == null)
|
if (unityManifest == null)
|
||||||
{
|
{
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.UnityEngineBuildFailed, "UnityEngine build failed !");
|
string message = BuildLogger.GetErrorMessage(ErrorCode.UnityEngineBuildFailed, "UnityEngine build failed !");
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public class TaskCopyBuildinFiles_BBP : TaskCopyBuildinFiles, IBuildTask
|
public class TaskCopyBuiltinFiles_BBP : TaskCopyBuiltinFiles, IBuildTask
|
||||||
{
|
{
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
if (buildParametersContext.Parameters.BuiltinFileCopyOption != EBuiltinFileCopyOption.None)
|
||||||
{
|
{
|
||||||
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
CopyBuiltinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ namespace YooAsset.Editor
|
|||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
if (buildParametersContext.Parameters.BuiltinFileCopyOption != EBuiltinFileCopyOption.None)
|
||||||
{
|
{
|
||||||
CreateCatalogFile(buildParametersContext);
|
CreateCatalogFile(buildParametersContext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
CreateManifestFile(true, true, context);
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
|
var builtinBuildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
|
||||||
|
bool replaceAssetPathWithAddress = builtinBuildParameters.ReplaceAssetPathWithAddress;
|
||||||
|
CreateManifestFile(true, true, replaceAssetPathWithAddress, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ namespace YooAsset.Editor
|
|||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
return HashUtility.FileMD5(filePath);
|
return HashUtility.FileMD5(filePath);
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
return HashUtility.FileCRC32(filePath);
|
return HashUtility.FileCRC32Value(filePath);
|
||||||
}
|
}
|
||||||
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ECompressOption CompressOption = ECompressOption.Uncompressed;
|
public ECompressOption CompressOption = ECompressOption.Uncompressed;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从文件头里剥离Unity版本信息
|
||||||
|
/// </summary>
|
||||||
|
public bool StripUnityVersion = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 禁止写入类型树结构(可以降低包体和内存并提高加载效率)
|
/// 禁止写入类型树结构(可以降低包体和内存并提高加载效率)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -22,6 +27,12 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IgnoreTypeTreeChanges = true;
|
public bool IgnoreTypeTreeChanges = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用可寻址地址代替资源路径
|
||||||
|
/// 说明:开启此项可以节省运行时清单占用的内存!
|
||||||
|
/// </summary>
|
||||||
|
public bool ReplaceAssetPathWithAddress = false;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取内置构建管线的构建选项
|
/// 获取内置构建管线的构建选项
|
||||||
@@ -41,6 +52,8 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
if (ClearBuildCacheFiles)
|
if (ClearBuildCacheFiles)
|
||||||
opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
|
opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
|
||||||
|
if (StripUnityVersion)
|
||||||
|
opt |= BuildAssetBundleOptions.AssetBundleStripUnityVersion; //Removes the Unity Version number in the Archive File & Serialized File headers
|
||||||
if (DisableWriteTypeTree)
|
if (DisableWriteTypeTree)
|
||||||
opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
|
opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
|
||||||
if (IgnoreTypeTreeChanges)
|
if (IgnoreTypeTreeChanges)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace YooAsset.Editor
|
|||||||
new TaskCreateManifest_BBP(),
|
new TaskCreateManifest_BBP(),
|
||||||
new TaskCreateReport_BBP(),
|
new TaskCreateReport_BBP(),
|
||||||
new TaskCreatePackage_BBP(),
|
new TaskCreatePackage_BBP(),
|
||||||
new TaskCopyBuildinFiles_BBP(),
|
new TaskCopyBuiltinFiles_BBP(),
|
||||||
new TaskCreateCatalog_BBP()
|
new TaskCreateCatalog_BBP()
|
||||||
};
|
};
|
||||||
return pipeline;
|
return pipeline;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
CreateManifestFile(false, false, context);
|
CreateManifestFile(false, false, false, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ namespace YooAsset.Editor
|
|||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
return GetFilePathTempHash(filePath);
|
return GetFilePathTempHash(filePath);
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
return "00000000"; //8位
|
return 0;
|
||||||
}
|
}
|
||||||
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public class TaskCopyBuildinFiles_RFBP : TaskCopyBuildinFiles, IBuildTask
|
public class TaskCopyBuiltinFiles_RFBP : TaskCopyBuiltinFiles, IBuildTask
|
||||||
{
|
{
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildParameters = buildParametersContext.Parameters;
|
var buildParameters = buildParametersContext.Parameters;
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
if (buildParameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
if (buildParameters.BuiltinFileCopyOption != EBuiltinFileCopyOption.None)
|
||||||
{
|
{
|
||||||
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
CopyBuiltinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ namespace YooAsset.Editor
|
|||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
if (buildParametersContext.Parameters.BuiltinFileCopyOption != EBuiltinFileCopyOption.None)
|
||||||
{
|
{
|
||||||
CreateCatalogFile(buildParametersContext);
|
CreateCatalogFile(buildParametersContext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
CreateManifestFile(false, true, context);
|
CreateManifestFile(false, true, false, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ namespace YooAsset.Editor
|
|||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
return HashUtility.FileMD5(filePath);
|
return HashUtility.FileMD5(filePath);
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
return HashUtility.FileCRC32(filePath);
|
return HashUtility.FileCRC32Value(filePath);
|
||||||
}
|
}
|
||||||
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace YooAsset.Editor
|
|||||||
new TaskCreateManifest_RFBP(),
|
new TaskCreateManifest_RFBP(),
|
||||||
new TaskCreateReport_RFBP(),
|
new TaskCreateReport_RFBP(),
|
||||||
new TaskCreatePackage_RFBP(),
|
new TaskCreatePackage_RFBP(),
|
||||||
new TaskCopyBuildinFiles_RFBP(),
|
new TaskCopyBuiltinFiles_RFBP(),
|
||||||
new TaskCreateCatalog_RFBP()
|
new TaskCreateCatalog_RFBP()
|
||||||
};
|
};
|
||||||
return pipeline;
|
return pipeline;
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ namespace YooAsset.Editor
|
|||||||
var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
||||||
|
|
||||||
// 构建内容
|
// 构建内容
|
||||||
var buildContent = new BundleBuildContent(buildMapContext.GetPipelineBuilds());
|
var bundleBuilds = buildMapContext.GetPipelineBuilds(scriptableBuildParameters.ReplaceAssetPathWithAddress);
|
||||||
|
var buildContent = new BundleBuildContent(bundleBuilds);
|
||||||
|
|
||||||
// 开始构建
|
// 开始构建
|
||||||
IBundleBuildResults buildResults;
|
IBundleBuildResults buildResults;
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public class TaskCopyBuildinFiles_SBP : TaskCopyBuildinFiles, IBuildTask
|
public class TaskCopyBuiltinFiles_SBP : TaskCopyBuiltinFiles, IBuildTask
|
||||||
{
|
{
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
if (buildParametersContext.Parameters.BuiltinFileCopyOption != EBuiltinFileCopyOption.None)
|
||||||
{
|
{
|
||||||
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
CopyBuiltinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ namespace YooAsset.Editor
|
|||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
if (buildParametersContext.Parameters.BuiltinFileCopyOption != EBuiltinFileCopyOption.None)
|
||||||
{
|
{
|
||||||
CreateCatalogFile(buildParametersContext);
|
CreateCatalogFile(buildParametersContext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
CreateManifestFile(true, true, context);
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
|
var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
||||||
|
bool replaceAssetPathWithAddress = scriptableBuildParameters.ReplaceAssetPathWithAddress;
|
||||||
|
CreateManifestFile(true, true, replaceAssetPathWithAddress, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ namespace YooAsset.Editor
|
|||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
return HashUtility.FileMD5(filePath);
|
return HashUtility.FileMD5(filePath);
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override uint GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
return HashUtility.FileCRC32(filePath);
|
return HashUtility.FileCRC32Value(filePath);
|
||||||
}
|
}
|
||||||
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace YooAsset.Editor
|
|||||||
public ECompressOption CompressOption = ECompressOption.Uncompressed;
|
public ECompressOption CompressOption = ECompressOption.Uncompressed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 从AssetBundle文件头里剥离Unity版本信息
|
/// 从文件头里剥离Unity版本信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool StripUnityVersion = false;
|
public bool StripUnityVersion = false;
|
||||||
|
|
||||||
@@ -25,10 +25,21 @@ namespace YooAsset.Editor
|
|||||||
public bool DisableWriteTypeTree = false;
|
public bool DisableWriteTypeTree = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 忽略类型树变化
|
/// 忽略类型树变化(无效参数)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IgnoreTypeTreeChanges = true;
|
public bool IgnoreTypeTreeChanges = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用可寻址地址代替资源路径
|
||||||
|
/// 说明:开启此项可以节省运行时清单占用的内存!
|
||||||
|
/// </summary>
|
||||||
|
public bool ReplaceAssetPathWithAddress = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动建立资源对象对图集的依赖关系
|
||||||
|
/// </summary>
|
||||||
|
public bool TrackSpriteAtlasDependencies = false;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成代码防裁剪配置
|
/// 生成代码防裁剪配置
|
||||||
@@ -76,10 +87,9 @@ namespace YooAsset.Editor
|
|||||||
throw new System.NotImplementedException(CompressOption.ToString());
|
throw new System.NotImplementedException(CompressOption.ToString());
|
||||||
|
|
||||||
if (StripUnityVersion)
|
if (StripUnityVersion)
|
||||||
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.StripUnityVersion;
|
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.StripUnityVersion; // Build Flag to indicate the Unity Version should not be written to the serialized file.
|
||||||
|
|
||||||
if (DisableWriteTypeTree)
|
if (DisableWriteTypeTree)
|
||||||
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.DisableWriteTypeTree;
|
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.DisableWriteTypeTree; //Do not include type information within the built content.
|
||||||
|
|
||||||
buildParams.UseCache = true;
|
buildParams.UseCache = true;
|
||||||
buildParams.CacheServerHost = CacheServerHost;
|
buildParams.CacheServerHost = CacheServerHost;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace YooAsset.Editor
|
|||||||
new TaskCreateManifest_SBP(),
|
new TaskCreateManifest_SBP(),
|
||||||
new TaskCreateReport_SBP(),
|
new TaskCreateReport_SBP(),
|
||||||
new TaskCreatePackage_SBP(),
|
new TaskCreatePackage_SBP(),
|
||||||
new TaskCopyBuildinFiles_SBP(),
|
new TaskCopyBuiltinFiles_SBP(),
|
||||||
new TaskCreateCatalog_SBP()
|
new TaskCreateCatalog_SBP()
|
||||||
};
|
};
|
||||||
return pipeline;
|
return pipeline;
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string ErrorInfo;
|
public string ErrorInfo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构建失败的堆栈
|
||||||
|
/// </summary>
|
||||||
|
public string ErrorStack;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 输出的补丁包目录
|
/// 输出的补丁包目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ namespace YooAsset.Editor
|
|||||||
EditorTools.ClearProgressBar();
|
EditorTools.ClearProgressBar();
|
||||||
buildResult.FailedTask = task.GetType().Name;
|
buildResult.FailedTask = task.GetType().Name;
|
||||||
buildResult.ErrorInfo = e.ToString();
|
buildResult.ErrorInfo = e.ToString();
|
||||||
|
buildResult.ErrorStack = e.StackTrace;
|
||||||
buildResult.Success = false;
|
buildResult.Success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
|||||||
PackageNameIsNullOrEmpty = 111,
|
PackageNameIsNullOrEmpty = 111,
|
||||||
PackageVersionIsNullOrEmpty = 112,
|
PackageVersionIsNullOrEmpty = 112,
|
||||||
BuildOutputRootIsNullOrEmpty = 113,
|
BuildOutputRootIsNullOrEmpty = 113,
|
||||||
BuildinFileRootIsNullOrEmpty = 114,
|
BuiltinFileRootIsNullOrEmpty = 114,
|
||||||
PackageOutputDirectoryExists = 115,
|
PackageOutputDirectoryExists = 115,
|
||||||
BuildPipelineIsNullOrEmpty = 116,
|
BuildPipelineIsNullOrEmpty = 116,
|
||||||
BuildBundleTypeIsUnknown = 117,
|
BuildBundleTypeIsUnknown = 117,
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class ManifestProcessNone : IManifestProcessServices
|
||||||
|
{
|
||||||
|
byte[] IManifestProcessServices.ProcessManifest(byte[] fileData)
|
||||||
|
{
|
||||||
|
return fileData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ManifestRestoreNone : IManifestRestoreServices
|
||||||
|
{
|
||||||
|
byte[] IManifestRestoreServices.RestoreManifest(byte[] fileData)
|
||||||
|
{
|
||||||
|
return fileData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 69f62f6b4185d06498f96aa272e9b926
|
guid: 446513b0ea9f5d445ade0cfb09c5073b
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -4,7 +4,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 首包资源文件的拷贝方式
|
/// 首包资源文件的拷贝方式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum EBuildinFileCopyOption
|
public enum EBuiltinFileCopyOption
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 不拷贝任何文件
|
/// 不拷贝任何文件
|
||||||
@@ -44,19 +44,47 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建加密类实例
|
/// 创建资源包加密服务类实例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected IEncryptionServices CreateEncryptionInstance()
|
protected IEncryptionServices CreateEncryptionServicesInstance()
|
||||||
{
|
{
|
||||||
var encyptionClassName = AssetBundleBuilderSetting.GetPackageEncyptionClassName(PackageName, PipelineName);
|
var className = AssetBundleBuilderSetting.GetPackageEncyptionServicesClassName(PackageName, PipelineName);
|
||||||
var encryptionClassTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
|
||||||
var classType = encryptionClassTypes.Find(x => x.FullName.Equals(encyptionClassName));
|
var classType = classTypes.Find(x => x.FullName.Equals(className));
|
||||||
if (classType != null)
|
if (classType != null)
|
||||||
return (IEncryptionServices)Activator.CreateInstance(classType);
|
return (IEncryptionServices)Activator.CreateInstance(classType);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建资源清单加密服务类实例
|
||||||
|
/// </summary>
|
||||||
|
protected IManifestProcessServices CreateManifestProcessServicesInstance()
|
||||||
|
{
|
||||||
|
var className = AssetBundleBuilderSetting.GetPackageManifestProcessServicesClassName(PackageName, PipelineName);
|
||||||
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestProcessServices));
|
||||||
|
var classType = classTypes.Find(x => x.FullName.Equals(className));
|
||||||
|
if (classType != null)
|
||||||
|
return (IManifestProcessServices)Activator.CreateInstance(classType);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建资源清单解密服务类实例
|
||||||
|
/// </summary>
|
||||||
|
protected IManifestRestoreServices CreateManifestRestoreServicesInstance()
|
||||||
|
{
|
||||||
|
var className = AssetBundleBuilderSetting.GetPackageManifestRestoreServicesClassName(PackageName, PipelineName);
|
||||||
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestRestoreServices));
|
||||||
|
var classType = classTypes.Find(x => x.FullName.Equals(className));
|
||||||
|
if (classType != null)
|
||||||
|
return (IManifestRestoreServices)Activator.CreateInstance(classType);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
#region UI元素通用处理方法
|
#region UI元素通用处理方法
|
||||||
protected void SetBuildOutputField(TextField textField)
|
protected void SetBuildOutputField(TextField textField)
|
||||||
{
|
{
|
||||||
@@ -99,31 +127,35 @@ namespace YooAsset.Editor
|
|||||||
});
|
});
|
||||||
UIElementsTools.SetElementLabelMinWidth(enumField, LabelMinWidth);
|
UIElementsTools.SetElementLabelMinWidth(enumField, LabelMinWidth);
|
||||||
}
|
}
|
||||||
protected void SetCopyBuildinFileOptionField(EnumField enumField, TextField tagField)
|
protected void SetCopyBuiltinFileOptionField(EnumField enumField, TextField tagField)
|
||||||
{
|
{
|
||||||
// 首包文件拷贝选项
|
// 首包文件拷贝选项
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, PipelineName);
|
var builtinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyOption(PackageName, PipelineName);
|
||||||
enumField.Init(buildinFileCopyOption);
|
enumField.Init(builtinFileCopyOption);
|
||||||
enumField.SetValueWithoutNotify(buildinFileCopyOption);
|
enumField.SetValueWithoutNotify(builtinFileCopyOption);
|
||||||
enumField.style.width = StyleWidth;
|
enumField.style.width = StyleWidth;
|
||||||
enumField.RegisterValueChangedCallback(evt =>
|
enumField.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
AssetBundleBuilderSetting.SetPackageBuildinFileCopyOption(PackageName, PipelineName, (EBuildinFileCopyOption)enumField.value);
|
AssetBundleBuilderSetting.SetPackageBuiltinFileCopyOption(PackageName, PipelineName, (EBuiltinFileCopyOption)enumField.value);
|
||||||
|
|
||||||
// 设置内置资源标签显隐
|
// 设置内置资源标签显隐
|
||||||
bool tagsFiledVisible = buildinFileCopyOption == EBuildinFileCopyOption.ClearAndCopyByTags || buildinFileCopyOption == EBuildinFileCopyOption.OnlyCopyByTags;
|
SetCopyBuiltinFileTagsVisible(tagField);
|
||||||
tagField.visible = tagsFiledVisible;
|
|
||||||
});
|
});
|
||||||
UIElementsTools.SetElementLabelMinWidth(enumField, LabelMinWidth);
|
UIElementsTools.SetElementLabelMinWidth(enumField, LabelMinWidth);
|
||||||
}
|
}
|
||||||
protected void SetCopyBuildinFileTagsField(TextField textField)
|
protected void SetCopyBuiltinFileTagsVisible(TextField tagField)
|
||||||
|
{
|
||||||
|
var option = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyOption(PackageName, PipelineName);
|
||||||
|
tagField.visible = option == EBuiltinFileCopyOption.ClearAndCopyByTags || option == EBuiltinFileCopyOption.OnlyCopyByTags;
|
||||||
|
}
|
||||||
|
protected void SetCopyBuiltinFileTagsField(TextField textField)
|
||||||
{
|
{
|
||||||
// 首包文件拷贝参数
|
// 首包文件拷贝参数
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, PipelineName);
|
var builtinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyParams(PackageName, PipelineName);
|
||||||
textField.SetValueWithoutNotify(buildinFileCopyParams);
|
textField.SetValueWithoutNotify(builtinFileCopyParams);
|
||||||
textField.RegisterValueChangedCallback(evt =>
|
textField.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
AssetBundleBuilderSetting.SetPackageBuildinFileCopyParams(PackageName, PipelineName, textField.value);
|
AssetBundleBuilderSetting.SetPackageBuiltinFileCopyParams(PackageName, PipelineName, textField.value);
|
||||||
});
|
});
|
||||||
UIElementsTools.SetElementLabelMinWidth(textField, LabelMinWidth);
|
UIElementsTools.SetElementLabelMinWidth(textField, LabelMinWidth);
|
||||||
}
|
}
|
||||||
@@ -149,35 +181,97 @@ namespace YooAsset.Editor
|
|||||||
});
|
});
|
||||||
UIElementsTools.SetElementLabelMinWidth(toggle, LabelMinWidth);
|
UIElementsTools.SetElementLabelMinWidth(toggle, LabelMinWidth);
|
||||||
}
|
}
|
||||||
protected PopupField<Type> CreateEncryptionField(VisualElement container)
|
protected PopupField<Type> CreateEncryptionServicesField(VisualElement container)
|
||||||
{
|
{
|
||||||
// 加密方法
|
// 资源包加密服务类
|
||||||
var encryptionClassTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
|
||||||
if (encryptionClassTypes.Count > 0)
|
if (classTypes.Count > 0)
|
||||||
{
|
{
|
||||||
var encyptionClassName = AssetBundleBuilderSetting.GetPackageEncyptionClassName(PackageName, PipelineName);
|
var className = AssetBundleBuilderSetting.GetPackageEncyptionServicesClassName(PackageName, PipelineName);
|
||||||
int defaultIndex = encryptionClassTypes.FindIndex(x => x.FullName.Equals(encyptionClassName));
|
int defaultIndex = classTypes.FindIndex(x => x.FullName.Equals(className));
|
||||||
if (defaultIndex < 0)
|
if (defaultIndex < 0)
|
||||||
defaultIndex = 0;
|
defaultIndex = 0;
|
||||||
var encryptionField = new PopupField<Type>(encryptionClassTypes, defaultIndex);
|
var popupField = new PopupField<Type>(classTypes, defaultIndex);
|
||||||
encryptionField.label = "Encryption";
|
popupField.label = "Encryption Services";
|
||||||
encryptionField.style.width = StyleWidth;
|
popupField.style.width = StyleWidth;
|
||||||
encryptionField.RegisterValueChangedCallback(evt =>
|
popupField.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
AssetBundleBuilderSetting.SetPackageEncyptionClassName(PackageName, PipelineName, encryptionField.value.FullName);
|
AssetBundleBuilderSetting.SetPackageEncyptionServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
||||||
});
|
});
|
||||||
container.Add(encryptionField);
|
container.Add(popupField);
|
||||||
UIElementsTools.SetElementLabelMinWidth(encryptionField, LabelMinWidth);
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
return encryptionField;
|
return popupField;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var encryptionField = new PopupField<Type>();
|
var popupField = new PopupField<Type>();
|
||||||
encryptionField.label = "Encryption";
|
popupField.label = "Encryption Services";
|
||||||
encryptionField.style.width = StyleWidth;
|
popupField.style.width = StyleWidth;
|
||||||
container.Add(encryptionField);
|
container.Add(popupField);
|
||||||
UIElementsTools.SetElementLabelMinWidth(encryptionField, LabelMinWidth);
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
return encryptionField;
|
return popupField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected PopupField<Type> CreateManifestProcessServicesField(VisualElement container)
|
||||||
|
{
|
||||||
|
// 资源清单加密服务类
|
||||||
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestProcessServices));
|
||||||
|
if (classTypes.Count > 0)
|
||||||
|
{
|
||||||
|
var className = AssetBundleBuilderSetting.GetPackageManifestProcessServicesClassName(PackageName, PipelineName);
|
||||||
|
int defaultIndex = classTypes.FindIndex(x => x.FullName.Equals(className));
|
||||||
|
if (defaultIndex < 0)
|
||||||
|
defaultIndex = 0;
|
||||||
|
var popupField = new PopupField<Type>(classTypes, defaultIndex);
|
||||||
|
popupField.label = "Manifest Process Services";
|
||||||
|
popupField.style.width = StyleWidth;
|
||||||
|
popupField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
AssetBundleBuilderSetting.SetPackageManifestProcessServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
||||||
|
});
|
||||||
|
container.Add(popupField);
|
||||||
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
|
return popupField;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var popupField = new PopupField<Type>();
|
||||||
|
popupField.label = "Manifest Process Services";
|
||||||
|
popupField.style.width = StyleWidth;
|
||||||
|
container.Add(popupField);
|
||||||
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
|
return popupField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected PopupField<Type> CreateManifestRestoreServicesField(VisualElement container)
|
||||||
|
{
|
||||||
|
// 资源清单加密服务类
|
||||||
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestRestoreServices));
|
||||||
|
if (classTypes.Count > 0)
|
||||||
|
{
|
||||||
|
var className = AssetBundleBuilderSetting.GetPackageManifestRestoreServicesClassName(PackageName, PipelineName);
|
||||||
|
int defaultIndex = classTypes.FindIndex(x => x.FullName.Equals(className));
|
||||||
|
if (defaultIndex < 0)
|
||||||
|
defaultIndex = 0;
|
||||||
|
var popupField = new PopupField<Type>(classTypes, defaultIndex);
|
||||||
|
popupField.label = "Manifest Restore Services";
|
||||||
|
popupField.style.width = StyleWidth;
|
||||||
|
popupField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
AssetBundleBuilderSetting.SetPackageManifestRestoreServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
||||||
|
});
|
||||||
|
container.Add(popupField);
|
||||||
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
|
return popupField;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var popupField = new PopupField<Type>();
|
||||||
|
popupField.label = "Manifest Restore Services";
|
||||||
|
popupField.style.width = StyleWidth;
|
||||||
|
container.Add(popupField);
|
||||||
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
|
return popupField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -16,11 +16,13 @@ namespace YooAsset.Editor
|
|||||||
protected TemplateContainer Root;
|
protected TemplateContainer Root;
|
||||||
protected TextField _buildOutputField;
|
protected TextField _buildOutputField;
|
||||||
protected TextField _buildVersionField;
|
protected TextField _buildVersionField;
|
||||||
protected PopupField<Type> _encryptionField;
|
protected PopupField<Type> _encryptionServicesField;
|
||||||
|
protected PopupField<Type> _manifestProcessServicesField;
|
||||||
|
protected PopupField<Type> _manifestRestoreServicesField;
|
||||||
protected EnumField _compressionField;
|
protected EnumField _compressionField;
|
||||||
protected EnumField _outputNameStyleField;
|
protected EnumField _outputNameStyleField;
|
||||||
protected EnumField _copyBuildinFileOptionField;
|
protected EnumField _copyBuiltinFileOptionField;
|
||||||
protected TextField _copyBuildinFileTagsField;
|
protected TextField _copyBuiltinFileTagsField;
|
||||||
protected Toggle _clearBuildCacheToggle;
|
protected Toggle _clearBuildCacheToggle;
|
||||||
protected Toggle _useAssetDependencyDBToggle;
|
protected Toggle _useAssetDependencyDBToggle;
|
||||||
|
|
||||||
@@ -43,9 +45,11 @@ namespace YooAsset.Editor
|
|||||||
_buildVersionField = Root.Q<TextField>("BuildVersion");
|
_buildVersionField = Root.Q<TextField>("BuildVersion");
|
||||||
SetBuildVersionField(_buildVersionField);
|
SetBuildVersionField(_buildVersionField);
|
||||||
|
|
||||||
// 加密方法
|
// 服务类
|
||||||
var encryptionContainer = Root.Q("EncryptionContainer");
|
var popupContainer = Root.Q("PopupContainer");
|
||||||
_encryptionField = CreateEncryptionField(encryptionContainer);
|
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||||
|
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||||
|
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||||
|
|
||||||
// 压缩方式选项
|
// 压缩方式选项
|
||||||
_compressionField = Root.Q<EnumField>("Compression");
|
_compressionField = Root.Q<EnumField>("Compression");
|
||||||
@@ -56,12 +60,13 @@ namespace YooAsset.Editor
|
|||||||
SetOutputNameStyleField(_outputNameStyleField);
|
SetOutputNameStyleField(_outputNameStyleField);
|
||||||
|
|
||||||
// 首包文件拷贝参数
|
// 首包文件拷贝参数
|
||||||
_copyBuildinFileTagsField = Root.Q<TextField>("CopyBuildinFileParam");
|
_copyBuiltinFileTagsField = Root.Q<TextField>("CopyBuiltinFileParam");
|
||||||
SetCopyBuildinFileTagsField(_copyBuildinFileTagsField);
|
SetCopyBuiltinFileTagsField(_copyBuiltinFileTagsField);
|
||||||
|
SetCopyBuiltinFileTagsVisible(_copyBuiltinFileTagsField);
|
||||||
|
|
||||||
// 首包文件拷贝选项
|
// 首包文件拷贝选项
|
||||||
_copyBuildinFileOptionField = Root.Q<EnumField>("CopyBuildinFileOption");
|
_copyBuiltinFileOptionField = Root.Q<EnumField>("CopyBuiltinFileOption");
|
||||||
SetCopyBuildinFileOptionField(_copyBuildinFileOptionField, _copyBuildinFileTagsField);
|
SetCopyBuiltinFileOptionField(_copyBuiltinFileOptionField, _copyBuiltinFileTagsField);
|
||||||
|
|
||||||
// 清理构建缓存
|
// 清理构建缓存
|
||||||
_clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
_clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
||||||
@@ -94,15 +99,15 @@ namespace YooAsset.Editor
|
|||||||
protected virtual void ExecuteBuild()
|
protected virtual void ExecuteBuild()
|
||||||
{
|
{
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, PipelineName);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, PipelineName);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, PipelineName);
|
var builtinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyOption(PackageName, PipelineName);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, PipelineName);
|
var builtinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyParams(PackageName, PipelineName);
|
||||||
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, PipelineName);
|
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, PipelineName);
|
||||||
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, PipelineName);
|
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, PipelineName);
|
||||||
var useAssetDependencyDB = AssetBundleBuilderSetting.GetPackageUseAssetDependencyDB(PackageName, PipelineName);
|
var useAssetDependencyDB = AssetBundleBuilderSetting.GetPackageUseAssetDependencyDB(PackageName, PipelineName);
|
||||||
|
|
||||||
BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
|
BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuiltinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = PipelineName.ToString();
|
buildParameters.BuildPipeline = PipelineName.ToString();
|
||||||
buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
|
buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
@@ -111,12 +116,14 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.EnableSharePackRule = true;
|
buildParameters.EnableSharePackRule = true;
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuiltinFileCopyOption = builtinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuiltinFileCopyParams = builtinFileCopyParams;
|
||||||
buildParameters.CompressOption = compressOption;
|
buildParameters.CompressOption = compressOption;
|
||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||||
|
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||||
|
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||||
|
|
||||||
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
||||||
<ui:Toggle label="Clear Build Cache" name="ClearBuildCache" />
|
<ui:Toggle label="Clear Build Cache" name="ClearBuildCache" />
|
||||||
<ui:Toggle label="Use Asset Depend DB" name="UseAssetDependency" />
|
<ui:Toggle label="Use Asset Depend DB" name="UseAssetDependency" />
|
||||||
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
|
<ui:VisualElement name="PopupContainer" style="flex-grow: 1;" />
|
||||||
<uie:EnumField label="Compression" value="Center" name="Compression" />
|
<uie:EnumField label="Compression" value="Center" name="Compression" />
|
||||||
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
||||||
<uie:EnumField label="Copy Buildin File Option" value="Center" name="CopyBuildinFileOption" />
|
<uie:EnumField label="Copy Builtin File Option" value="Center" name="CopyBuiltinFileOption" />
|
||||||
<ui:TextField picking-mode="Ignore" label="Copy Buildin File Param" name="CopyBuildinFileParam" />
|
<ui:TextField picking-mode="Ignore" label="Copy Builtin File Param" name="CopyBuiltinFileParam" />
|
||||||
<ui:VisualElement name="ExtensionContainer" />
|
<ui:VisualElement name="ExtensionContainer" />
|
||||||
<ui:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
<ui:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ namespace YooAsset.Editor
|
|||||||
protected virtual void ExecuteBuild()
|
protected virtual void ExecuteBuild()
|
||||||
{
|
{
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, PipelineName);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, PipelineName);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, PipelineName);
|
var builtinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyOption(PackageName, PipelineName);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, PipelineName);
|
var builtinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyParams(PackageName, PipelineName);
|
||||||
|
|
||||||
EditorSimulateBuildParameters buildParameters = new EditorSimulateBuildParameters();
|
EditorSimulateBuildParameters buildParameters = new EditorSimulateBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuiltinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = PipelineName.ToString();
|
buildParameters.BuildPipeline = PipelineName.ToString();
|
||||||
buildParameters.BuildBundleType = (int)EBuildBundleType.VirtualBundle;
|
buildParameters.BuildBundleType = (int)EBuildBundleType.VirtualBundle;
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
@@ -72,9 +72,8 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.PackageVersion = _buildVersionField.value;
|
buildParameters.PackageVersion = _buildVersionField.value;
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuiltinFileCopyOption = builtinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuiltinFileCopyParams = builtinFileCopyParams;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
|
||||||
|
|
||||||
EditorSimulateBuildPipeline pipeline = new EditorSimulateBuildPipeline();
|
EditorSimulateBuildPipeline pipeline = new EditorSimulateBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ namespace YooAsset.Editor
|
|||||||
protected TemplateContainer Root;
|
protected TemplateContainer Root;
|
||||||
protected TextField _buildOutputField;
|
protected TextField _buildOutputField;
|
||||||
protected TextField _buildVersionField;
|
protected TextField _buildVersionField;
|
||||||
protected PopupField<Type> _encryptionField;
|
protected PopupField<Type> _encryptionServicesField;
|
||||||
|
protected PopupField<Type> _manifestProcessServicesField;
|
||||||
|
protected PopupField<Type> _manifestRestoreServicesField;
|
||||||
protected EnumField _outputNameStyleField;
|
protected EnumField _outputNameStyleField;
|
||||||
protected EnumField _copyBuildinFileOptionField;
|
protected EnumField _copyBuiltinFileOptionField;
|
||||||
protected TextField _copyBuildinFileTagsField;
|
protected TextField _copyBuiltinFileTagsField;
|
||||||
protected Toggle _clearBuildCacheToggle;
|
protected Toggle _clearBuildCacheToggle;
|
||||||
protected Toggle _useAssetDependencyDBToggle;
|
protected Toggle _useAssetDependencyDBToggle;
|
||||||
|
|
||||||
@@ -43,20 +45,23 @@ namespace YooAsset.Editor
|
|||||||
SetBuildVersionField(_buildVersionField);
|
SetBuildVersionField(_buildVersionField);
|
||||||
|
|
||||||
// 加密方法
|
// 加密方法
|
||||||
var encryptionContainer = Root.Q("EncryptionContainer");
|
var popupContainer = Root.Q("PopupContainer");
|
||||||
_encryptionField = CreateEncryptionField(encryptionContainer);
|
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||||
|
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||||
|
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||||
|
|
||||||
// 输出文件名称样式
|
// 输出文件名称样式
|
||||||
_outputNameStyleField = Root.Q<EnumField>("FileNameStyle");
|
_outputNameStyleField = Root.Q<EnumField>("FileNameStyle");
|
||||||
SetOutputNameStyleField(_outputNameStyleField);
|
SetOutputNameStyleField(_outputNameStyleField);
|
||||||
|
|
||||||
// 首包文件拷贝参数
|
// 首包文件拷贝参数
|
||||||
_copyBuildinFileTagsField = Root.Q<TextField>("CopyBuildinFileParam");
|
_copyBuiltinFileTagsField = Root.Q<TextField>("CopyBuiltinFileParam");
|
||||||
SetCopyBuildinFileTagsField(_copyBuildinFileTagsField);
|
SetCopyBuiltinFileTagsField(_copyBuiltinFileTagsField);
|
||||||
|
SetCopyBuiltinFileTagsVisible(_copyBuiltinFileTagsField);
|
||||||
|
|
||||||
// 首包文件拷贝选项
|
// 首包文件拷贝选项
|
||||||
_copyBuildinFileOptionField = Root.Q<EnumField>("CopyBuildinFileOption");
|
_copyBuiltinFileOptionField = Root.Q<EnumField>("CopyBuiltinFileOption");
|
||||||
SetCopyBuildinFileOptionField(_copyBuildinFileOptionField, _copyBuildinFileTagsField);
|
SetCopyBuiltinFileOptionField(_copyBuiltinFileOptionField, _copyBuiltinFileTagsField);
|
||||||
|
|
||||||
// 清理构建缓存
|
// 清理构建缓存
|
||||||
_clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
_clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
||||||
@@ -89,14 +94,14 @@ namespace YooAsset.Editor
|
|||||||
protected virtual void ExecuteBuild()
|
protected virtual void ExecuteBuild()
|
||||||
{
|
{
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, PipelineName);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, PipelineName);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, PipelineName);
|
var builtinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyOption(PackageName, PipelineName);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, PipelineName);
|
var builtinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyParams(PackageName, PipelineName);
|
||||||
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, PipelineName);
|
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, PipelineName);
|
||||||
var useAssetDependencyDB = AssetBundleBuilderSetting.GetPackageUseAssetDependencyDB(PackageName, PipelineName);
|
var useAssetDependencyDB = AssetBundleBuilderSetting.GetPackageUseAssetDependencyDB(PackageName, PipelineName);
|
||||||
|
|
||||||
RawFileBuildParameters buildParameters = new RawFileBuildParameters();
|
RawFileBuildParameters buildParameters = new RawFileBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuiltinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = PipelineName.ToString();
|
buildParameters.BuildPipeline = PipelineName.ToString();
|
||||||
buildParameters.BuildBundleType = (int)EBuildBundleType.RawBundle;
|
buildParameters.BuildBundleType = (int)EBuildBundleType.RawBundle;
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
@@ -104,11 +109,13 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.PackageVersion = _buildVersionField.value;
|
buildParameters.PackageVersion = _buildVersionField.value;
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuiltinFileCopyOption = builtinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuiltinFileCopyParams = builtinFileCopyParams;
|
||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||||
|
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||||
|
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||||
|
|
||||||
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
||||||
<ui:Toggle label="Clear Build Cache" name="ClearBuildCache" />
|
<ui:Toggle label="Clear Build Cache" name="ClearBuildCache" />
|
||||||
<ui:Toggle label="Use Asset Depend DB" name="UseAssetDependency" />
|
<ui:Toggle label="Use Asset Depend DB" name="UseAssetDependency" />
|
||||||
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
|
<ui:VisualElement name="PopupContainer" style="flex-grow: 1;" />
|
||||||
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
||||||
<uie:EnumField label="Copy Buildin File Option" value="Center" name="CopyBuildinFileOption" />
|
<uie:EnumField label="Copy Builtin File Option" value="Center" name="CopyBuiltinFileOption" />
|
||||||
<ui:TextField picking-mode="Ignore" label="Copy Buildin File Param" name="CopyBuildinFileParam" />
|
<ui:TextField picking-mode="Ignore" label="Copy Builtin File Param" name="CopyBuiltinFileParam" />
|
||||||
<ui:VisualElement name="ExtensionContainer" />
|
<ui:VisualElement name="ExtensionContainer" />
|
||||||
<ui:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
<ui:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
|
|||||||
@@ -16,11 +16,13 @@ namespace YooAsset.Editor
|
|||||||
protected TemplateContainer Root;
|
protected TemplateContainer Root;
|
||||||
protected TextField _buildOutputField;
|
protected TextField _buildOutputField;
|
||||||
protected TextField _buildVersionField;
|
protected TextField _buildVersionField;
|
||||||
protected PopupField<Type> _encryptionField;
|
protected PopupField<Type> _encryptionServicesField;
|
||||||
|
protected PopupField<Type> _manifestProcessServicesField;
|
||||||
|
protected PopupField<Type> _manifestRestoreServicesField;
|
||||||
protected EnumField _compressionField;
|
protected EnumField _compressionField;
|
||||||
protected EnumField _outputNameStyleField;
|
protected EnumField _outputNameStyleField;
|
||||||
protected EnumField _copyBuildinFileOptionField;
|
protected EnumField _copyBuiltinFileOptionField;
|
||||||
protected TextField _copyBuildinFileTagsField;
|
protected TextField _copyBuiltinFileTagsField;
|
||||||
protected Toggle _clearBuildCacheToggle;
|
protected Toggle _clearBuildCacheToggle;
|
||||||
protected Toggle _useAssetDependencyDBToggle;
|
protected Toggle _useAssetDependencyDBToggle;
|
||||||
|
|
||||||
@@ -44,8 +46,10 @@ namespace YooAsset.Editor
|
|||||||
SetBuildVersionField(_buildVersionField);
|
SetBuildVersionField(_buildVersionField);
|
||||||
|
|
||||||
// 加密方法
|
// 加密方法
|
||||||
var encryptionContainer = Root.Q("EncryptionContainer");
|
var popupContainer = Root.Q("PopupContainer");
|
||||||
_encryptionField = CreateEncryptionField(encryptionContainer);
|
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||||
|
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||||
|
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||||
|
|
||||||
// 压缩方式选项
|
// 压缩方式选项
|
||||||
_compressionField = Root.Q<EnumField>("Compression");
|
_compressionField = Root.Q<EnumField>("Compression");
|
||||||
@@ -56,12 +60,13 @@ namespace YooAsset.Editor
|
|||||||
SetOutputNameStyleField(_outputNameStyleField);
|
SetOutputNameStyleField(_outputNameStyleField);
|
||||||
|
|
||||||
// 首包文件拷贝参数
|
// 首包文件拷贝参数
|
||||||
_copyBuildinFileTagsField = Root.Q<TextField>("CopyBuildinFileParam");
|
_copyBuiltinFileTagsField = Root.Q<TextField>("CopyBuiltinFileParam");
|
||||||
SetCopyBuildinFileTagsField(_copyBuildinFileTagsField);
|
SetCopyBuiltinFileTagsField(_copyBuiltinFileTagsField);
|
||||||
|
SetCopyBuiltinFileTagsVisible(_copyBuiltinFileTagsField);
|
||||||
|
|
||||||
// 首包文件拷贝选项
|
// 首包文件拷贝选项
|
||||||
_copyBuildinFileOptionField = Root.Q<EnumField>("CopyBuildinFileOption");
|
_copyBuiltinFileOptionField = Root.Q<EnumField>("CopyBuiltinFileOption");
|
||||||
SetCopyBuildinFileOptionField(_copyBuildinFileOptionField, _copyBuildinFileTagsField);
|
SetCopyBuiltinFileOptionField(_copyBuiltinFileOptionField, _copyBuiltinFileTagsField);
|
||||||
|
|
||||||
// 清理构建缓存
|
// 清理构建缓存
|
||||||
_clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
_clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
||||||
@@ -94,16 +99,15 @@ namespace YooAsset.Editor
|
|||||||
protected virtual void ExecuteBuild()
|
protected virtual void ExecuteBuild()
|
||||||
{
|
{
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, PipelineName);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, PipelineName);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, PipelineName);
|
var builtinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyOption(PackageName, PipelineName);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, PipelineName);
|
var builtinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuiltinFileCopyParams(PackageName, PipelineName);
|
||||||
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, PipelineName);
|
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, PipelineName);
|
||||||
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, PipelineName);
|
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, PipelineName);
|
||||||
var useAssetDependencyDB = AssetBundleBuilderSetting.GetPackageUseAssetDependencyDB(PackageName, PipelineName);
|
var useAssetDependencyDB = AssetBundleBuilderSetting.GetPackageUseAssetDependencyDB(PackageName, PipelineName);
|
||||||
var builtinShaderBundleName = GetBuiltinShaderBundleName();
|
|
||||||
|
|
||||||
ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
|
ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuiltinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = PipelineName.ToString();
|
buildParameters.BuildPipeline = PipelineName.ToString();
|
||||||
buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
|
buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
@@ -112,13 +116,15 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.EnableSharePackRule = true;
|
buildParameters.EnableSharePackRule = true;
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuiltinFileCopyOption = builtinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuiltinFileCopyParams = builtinFileCopyParams;
|
||||||
buildParameters.CompressOption = compressOption;
|
buildParameters.CompressOption = compressOption;
|
||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||||
buildParameters.BuiltinShadersBundleName = builtinShaderBundleName;
|
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||||
|
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||||
|
buildParameters.BuiltinShadersBundleName = GetBuiltinShaderBundleName();
|
||||||
|
|
||||||
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
@@ -136,6 +142,16 @@ namespace YooAsset.Editor
|
|||||||
var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
|
var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
|
||||||
return packRuleResult.GetBundleName(PackageName, uniqueBundleName);
|
return packRuleResult.GetBundleName(PackageName, uniqueBundleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mono脚本的资源包名称
|
||||||
|
/// </summary>
|
||||||
|
protected string GetMonoScriptsBundleName()
|
||||||
|
{
|
||||||
|
var uniqueBundleName = AssetBundleCollectorSettingData.Setting.UniqueBundleName;
|
||||||
|
var packRuleResult = DefaultPackRule.CreateMonosPackRuleResult();
|
||||||
|
return packRuleResult.GetBundleName(PackageName, uniqueBundleName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -4,11 +4,11 @@
|
|||||||
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
||||||
<ui:Toggle label="Clear Build Cache" name="ClearBuildCache" />
|
<ui:Toggle label="Clear Build Cache" name="ClearBuildCache" />
|
||||||
<ui:Toggle label="Use Asset Depend DB" name="UseAssetDependency" />
|
<ui:Toggle label="Use Asset Depend DB" name="UseAssetDependency" />
|
||||||
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
|
<ui:VisualElement name="PopupContainer" style="flex-grow: 1;" />
|
||||||
<uie:EnumField label="Compression" value="Center" name="Compression" />
|
<uie:EnumField label="Compression" value="Center" name="Compression" />
|
||||||
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
||||||
<uie:EnumField label="Copy Buildin File Option" value="Center" name="CopyBuildinFileOption" />
|
<uie:EnumField label="Copy Builtin File Option" value="Center" name="CopyBuiltinFileOption" />
|
||||||
<ui:TextField picking-mode="Ignore" label="Copy Buildin File Param" name="CopyBuildinFileParam" />
|
<ui:TextField picking-mode="Ignore" label="Copy Builtin File Param" name="CopyBuiltinFileParam" />
|
||||||
<ui:VisualElement name="ExtensionContainer" />
|
<ui:VisualElement name="ExtensionContainer" />
|
||||||
<ui:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
<ui:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
|
|||||||
@@ -139,10 +139,17 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<CollectAssetInfo> GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
|
public List<CollectAssetInfo> GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
|
||||||
{
|
{
|
||||||
// 注意:模拟构建模式下只收集主资源
|
bool ignoreStaticCollector = command.IsFlagSet(ECollectFlags.IgnoreStaticCollector);
|
||||||
if (command.SimulateBuild)
|
if (ignoreStaticCollector)
|
||||||
{
|
{
|
||||||
if (CollectorType != ECollectorType.MainAssetCollector)
|
if (CollectorType == ECollectorType.StaticAssetCollector)
|
||||||
|
return new List<CollectAssetInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ignoreDependCollector = command.IsFlagSet(ECollectFlags.IgnoreDependCollector);
|
||||||
|
if (ignoreDependCollector)
|
||||||
|
{
|
||||||
|
if (CollectorType == ECollectorType.DependAssetCollector)
|
||||||
return new List<CollectAssetInfo>();
|
return new List<CollectAssetInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,8 +159,10 @@ namespace YooAsset.Editor
|
|||||||
List<string> findAssets = new List<string>();
|
List<string> findAssets = new List<string>();
|
||||||
if (AssetDatabase.IsValidFolder(CollectPath))
|
if (AssetDatabase.IsValidFolder(CollectPath))
|
||||||
{
|
{
|
||||||
string collectDirectory = CollectPath;
|
IFilterRule filterRuleInstance = AssetBundleCollectorSettingData.GetFilterRuleInstance(FilterRuleName);
|
||||||
string[] findResult = EditorTools.FindAssets(EAssetSearchType.All, collectDirectory);
|
string findAssetType = filterRuleInstance.FindAssetType;
|
||||||
|
string searchFolder = CollectPath;
|
||||||
|
string[] findResult = EditorTools.FindAssets(findAssetType, searchFolder);
|
||||||
findAssets.AddRange(findResult);
|
findAssets.AddRange(findResult);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -269,8 +278,8 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath)
|
private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath)
|
||||||
{
|
{
|
||||||
// 注意:模拟构建模式下不需要收集依赖资源
|
bool ignoreGetDependencies = command.IsFlagSet(ECollectFlags.IgnoreGetDependencies);
|
||||||
if (command.SimulateBuild)
|
if (ignoreGetDependencies)
|
||||||
return new List<AssetInfo>();
|
return new List<AssetInfo>();
|
||||||
|
|
||||||
string[] depends = command.AssetDependency.GetDependencies(mainAssetPath, true);
|
string[] depends = command.AssetDependency.GetDependencies(mainAssetPath, true);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
public class AssetBundleCollectorConfig
|
public class AssetBundleCollectorConfig
|
||||||
{
|
{
|
||||||
public const string ConfigVersion = "v2.1";
|
public const string ConfigVersion = "v2025.8.28";
|
||||||
|
|
||||||
public const string XmlVersion = "Version";
|
public const string XmlVersion = "Version";
|
||||||
public const string XmlCommon = "Common";
|
public const string XmlCommon = "Common";
|
||||||
@@ -23,6 +23,7 @@ namespace YooAsset.Editor
|
|||||||
public const string XmlPackageName = "PackageName";
|
public const string XmlPackageName = "PackageName";
|
||||||
public const string XmlPackageDesc = "PackageDesc";
|
public const string XmlPackageDesc = "PackageDesc";
|
||||||
public const string XmlEnableAddressable = "AutoAddressable";
|
public const string XmlEnableAddressable = "AutoAddressable";
|
||||||
|
public const string XmlSupportExtensionless = "SupportExtensionless";
|
||||||
public const string XmlLocationToLower = "LocationToLower";
|
public const string XmlLocationToLower = "LocationToLower";
|
||||||
public const string XmlIncludeAssetGUID = "IncludeAssetGUID";
|
public const string XmlIncludeAssetGUID = "IncludeAssetGUID";
|
||||||
public const string XmlIgnoreRuleName = "IgnoreRuleName";
|
public const string XmlIgnoreRuleName = "IgnoreRuleName";
|
||||||
@@ -99,6 +100,7 @@ namespace YooAsset.Editor
|
|||||||
package.PackageName = packageElement.GetAttribute(XmlPackageName);
|
package.PackageName = packageElement.GetAttribute(XmlPackageName);
|
||||||
package.PackageDesc = packageElement.GetAttribute(XmlPackageDesc);
|
package.PackageDesc = packageElement.GetAttribute(XmlPackageDesc);
|
||||||
package.EnableAddressable = packageElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
package.EnableAddressable = packageElement.GetAttribute(XmlEnableAddressable) == "True" ? true : false;
|
||||||
|
package.SupportExtensionless = packageElement.GetAttribute(XmlSupportExtensionless) == "True" ? true : false;
|
||||||
package.LocationToLower = packageElement.GetAttribute(XmlLocationToLower) == "True" ? true : false;
|
package.LocationToLower = packageElement.GetAttribute(XmlLocationToLower) == "True" ? true : false;
|
||||||
package.IncludeAssetGUID = packageElement.GetAttribute(XmlIncludeAssetGUID) == "True" ? true : false;
|
package.IncludeAssetGUID = packageElement.GetAttribute(XmlIncludeAssetGUID) == "True" ? true : false;
|
||||||
package.IgnoreRuleName = packageElement.GetAttribute(XmlIgnoreRuleName);
|
package.IgnoreRuleName = packageElement.GetAttribute(XmlIgnoreRuleName);
|
||||||
@@ -211,6 +213,7 @@ namespace YooAsset.Editor
|
|||||||
packageElement.SetAttribute(XmlPackageName, package.PackageName);
|
packageElement.SetAttribute(XmlPackageName, package.PackageName);
|
||||||
packageElement.SetAttribute(XmlPackageDesc, package.PackageDesc);
|
packageElement.SetAttribute(XmlPackageDesc, package.PackageDesc);
|
||||||
packageElement.SetAttribute(XmlEnableAddressable, package.EnableAddressable.ToString());
|
packageElement.SetAttribute(XmlEnableAddressable, package.EnableAddressable.ToString());
|
||||||
|
packageElement.SetAttribute(XmlSupportExtensionless, package.SupportExtensionless.ToString());
|
||||||
packageElement.SetAttribute(XmlLocationToLower, package.LocationToLower.ToString());
|
packageElement.SetAttribute(XmlLocationToLower, package.LocationToLower.ToString());
|
||||||
packageElement.SetAttribute(XmlIncludeAssetGUID, package.IncludeAssetGUID.ToString());
|
packageElement.SetAttribute(XmlIncludeAssetGUID, package.IncludeAssetGUID.ToString());
|
||||||
packageElement.SetAttribute(XmlIgnoreRuleName, package.IgnoreRuleName);
|
packageElement.SetAttribute(XmlIgnoreRuleName, package.IgnoreRuleName);
|
||||||
@@ -275,6 +278,23 @@ namespace YooAsset.Editor
|
|||||||
return UpdateXmlConfig(xmlDoc);
|
return UpdateXmlConfig(xmlDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// v2.1 -> v2025.8.28
|
||||||
|
if (configVersion == "v2.1")
|
||||||
|
{
|
||||||
|
// 读取包裹配置
|
||||||
|
var packageNodeList = root.GetElementsByTagName(XmlPackage);
|
||||||
|
foreach (var packageNode in packageNodeList)
|
||||||
|
{
|
||||||
|
XmlElement packageElement = packageNode as XmlElement;
|
||||||
|
if (packageElement.HasAttribute(XmlSupportExtensionless) == false)
|
||||||
|
packageElement.SetAttribute(XmlSupportExtensionless, "True");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新版本
|
||||||
|
root.SetAttribute(XmlVersion, "v2025.8.28");
|
||||||
|
return UpdateXmlConfig(xmlDoc);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnableAddressable = false;
|
public bool EnableAddressable = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支持无后缀名的资源定位地址
|
||||||
|
/// </summary>
|
||||||
|
public bool SupportExtensionless = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源定位地址大小写不敏感
|
/// 资源定位地址大小写不敏感
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ namespace YooAsset.Editor
|
|||||||
command.UniqueBundleName = UniqueBundleName;
|
command.UniqueBundleName = UniqueBundleName;
|
||||||
command.UseAssetDependencyDB = useAssetDependencyDB;
|
command.UseAssetDependencyDB = useAssetDependencyDB;
|
||||||
command.EnableAddressable = package.EnableAddressable;
|
command.EnableAddressable = package.EnableAddressable;
|
||||||
|
command.SupportExtensionless = package.SupportExtensionless;
|
||||||
command.LocationToLower = package.LocationToLower;
|
command.LocationToLower = package.LocationToLower;
|
||||||
command.IncludeAssetGUID = package.IncludeAssetGUID;
|
command.IncludeAssetGUID = package.IncludeAssetGUID;
|
||||||
command.AutoCollectShaders = package.AutoCollectShaders;
|
command.AutoCollectShaders = package.AutoCollectShaders;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
private VisualElement _setting2Container;
|
private VisualElement _setting2Container;
|
||||||
private Toggle _enableAddressableToogle;
|
private Toggle _enableAddressableToogle;
|
||||||
|
private Toggle _supportExtensionlessToogle;
|
||||||
private Toggle _locationToLowerToogle;
|
private Toggle _locationToLowerToogle;
|
||||||
private Toggle _includeAssetGUIDToogle;
|
private Toggle _includeAssetGUIDToogle;
|
||||||
private Toggle _autoCollectShadersToogle;
|
private Toggle _autoCollectShadersToogle;
|
||||||
@@ -131,6 +132,17 @@ namespace YooAsset.Editor
|
|||||||
RefreshWindow();
|
RefreshWindow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
_supportExtensionlessToogle = root.Q<Toggle>("SupportExtensionless");
|
||||||
|
_supportExtensionlessToogle.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
|
||||||
|
if (selectPackage != null)
|
||||||
|
{
|
||||||
|
selectPackage.SupportExtensionless = evt.newValue;
|
||||||
|
AssetBundleCollectorSettingData.ModifyPackage(selectPackage);
|
||||||
|
RefreshWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
_locationToLowerToogle = root.Q<Toggle>("LocationToLower");
|
_locationToLowerToogle = root.Q<Toggle>("LocationToLower");
|
||||||
_locationToLowerToogle.RegisterValueChangedCallback(evt =>
|
_locationToLowerToogle.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
@@ -487,6 +499,7 @@ namespace YooAsset.Editor
|
|||||||
_packageSettingsButton.SetEnabled(true);
|
_packageSettingsButton.SetEnabled(true);
|
||||||
_packageSettingsButton.text = $"{packageSettingName} ({selectPackage.PackageName})";
|
_packageSettingsButton.text = $"{packageSettingName} ({selectPackage.PackageName})";
|
||||||
_enableAddressableToogle.SetValueWithoutNotify(selectPackage.EnableAddressable);
|
_enableAddressableToogle.SetValueWithoutNotify(selectPackage.EnableAddressable);
|
||||||
|
_supportExtensionlessToogle.SetValueWithoutNotify(selectPackage.SupportExtensionless);
|
||||||
_locationToLowerToogle.SetValueWithoutNotify(selectPackage.LocationToLower);
|
_locationToLowerToogle.SetValueWithoutNotify(selectPackage.LocationToLower);
|
||||||
_includeAssetGUIDToogle.SetValueWithoutNotify(selectPackage.IncludeAssetGUID);
|
_includeAssetGUIDToogle.SetValueWithoutNotify(selectPackage.IncludeAssetGUID);
|
||||||
_autoCollectShadersToogle.SetValueWithoutNotify(selectPackage.AutoCollectShaders);
|
_autoCollectShadersToogle.SetValueWithoutNotify(selectPackage.AutoCollectShaders);
|
||||||
@@ -762,6 +775,7 @@ namespace YooAsset.Editor
|
|||||||
elementTop.Add(objectField);
|
elementTop.Add(objectField);
|
||||||
var label = objectField.Q<Label>();
|
var label = objectField.Q<Label>();
|
||||||
label.style.minWidth = 63;
|
label.style.minWidth = 63;
|
||||||
|
UIElementsTools.SetObjectFieldShowPath(objectField);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bottom VisualElement
|
// Bottom VisualElement
|
||||||
@@ -830,7 +844,7 @@ namespace YooAsset.Editor
|
|||||||
var foldout = new Foldout();
|
var foldout = new Foldout();
|
||||||
foldout.name = "Foldout1";
|
foldout.name = "Foldout1";
|
||||||
foldout.value = false;
|
foldout.value = false;
|
||||||
foldout.text = "Main Assets";
|
foldout.text = "Assets";
|
||||||
elementFoldout.Add(foldout);
|
elementFoldout.Add(foldout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -851,8 +865,6 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
var collector = selectGroup.Collectors[index];
|
var collector = selectGroup.Collectors[index];
|
||||||
var collectObject = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(collector.CollectPath);
|
var collectObject = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(collector.CollectPath);
|
||||||
if (collectObject != null)
|
|
||||||
collectObject.name = collector.CollectPath;
|
|
||||||
|
|
||||||
// 注意:非主资源收集器的标签栏需要被冻结
|
// 注意:非主资源收集器的标签栏需要被冻结
|
||||||
var textTags = element.Q<TextField>("TextField1");
|
var textTags = element.Q<TextField>("TextField1");
|
||||||
@@ -865,11 +877,9 @@ namespace YooAsset.Editor
|
|||||||
var foldout = element.Q<Foldout>("Foldout1");
|
var foldout = element.Q<Foldout>("Foldout1");
|
||||||
foldout.RegisterValueChangedCallback(evt =>
|
foldout.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
if (evt.newValue)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
else
|
|
||||||
foldout.Clear();
|
|
||||||
});
|
});
|
||||||
|
RefreshFoldoutName(foldout, collector.CollectorType);
|
||||||
|
|
||||||
// Remove Button
|
// Remove Button
|
||||||
var removeBtn = element.Q<Button>("Button1");
|
var removeBtn = element.Q<Button>("Button1");
|
||||||
@@ -885,13 +895,10 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.CollectPath = AssetDatabase.GetAssetPath(evt.newValue);
|
collector.CollectPath = AssetDatabase.GetAssetPath(evt.newValue);
|
||||||
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collector.CollectPath);
|
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collector.CollectPath);
|
||||||
objectField1.value.name = collector.CollectPath;
|
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
UIElementsTools.RefreshObjectFieldShowPath(objectField1);
|
||||||
|
|
||||||
// Collector Type
|
// Collector Type
|
||||||
var popupField0 = element.Q<PopupField<string>>("PopupField0");
|
var popupField0 = element.Q<PopupField<string>>("PopupField0");
|
||||||
@@ -900,10 +907,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.CollectorType = EditorTools.NameToEnum<ECollectorType>(evt.newValue);
|
collector.CollectorType = EditorTools.NameToEnum<ECollectorType>(evt.newValue);
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (collector.CollectorType == ECollectorType.MainAssetCollector)
|
if (collector.CollectorType == ECollectorType.MainAssetCollector)
|
||||||
textTags.SetEnabled(true);
|
textTags.SetEnabled(true);
|
||||||
@@ -922,10 +926,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.AddressRuleName = evt.newValue.ClassName;
|
collector.AddressRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -938,10 +939,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.PackRuleName = evt.newValue.ClassName;
|
collector.PackRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filter Rule
|
// Filter Rule
|
||||||
@@ -953,10 +951,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.FilterRuleName = evt.newValue.ClassName;
|
collector.FilterRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// UserData
|
// UserData
|
||||||
@@ -977,19 +972,55 @@ namespace YooAsset.Editor
|
|||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void RefreshFoldout(Foldout foldout, AssetBundleCollectorGroup group, AssetBundleCollector collector)
|
private void RefreshFoldoutName(Foldout foldout, ECollectorType collectorType, int elementNumber = -1)
|
||||||
{
|
{
|
||||||
|
if (collectorType == ECollectorType.MainAssetCollector)
|
||||||
|
{
|
||||||
|
if (elementNumber >= 0)
|
||||||
|
foldout.text = $"Main Assets ({elementNumber})";
|
||||||
|
else
|
||||||
|
foldout.text = $"Main Assets";
|
||||||
|
}
|
||||||
|
else if (collectorType == ECollectorType.StaticAssetCollector)
|
||||||
|
{
|
||||||
|
if (elementNumber >= 0)
|
||||||
|
foldout.text = $"Static Assets ({elementNumber})";
|
||||||
|
else
|
||||||
|
foldout.text = $"Static Assets";
|
||||||
|
}
|
||||||
|
else if (collectorType == ECollectorType.DependAssetCollector)
|
||||||
|
{
|
||||||
|
if (elementNumber >= 0)
|
||||||
|
foldout.text = $"Depend Assets ({elementNumber})";
|
||||||
|
else
|
||||||
|
foldout.text = $"Depend Assets";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException(collectorType.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void RefreshFoldoutContent(Foldout foldout, AssetBundleCollectorGroup group, AssetBundleCollector collector)
|
||||||
|
{
|
||||||
|
RefreshFoldoutName(foldout, collector.CollectorType);
|
||||||
|
|
||||||
|
// 折叠栏不可见
|
||||||
|
if (foldout.value == false)
|
||||||
|
{
|
||||||
|
foldout.Clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 清空旧元素
|
// 清空旧元素
|
||||||
foldout.Clear();
|
foldout.Clear();
|
||||||
|
|
||||||
|
// 检测配置是否有效
|
||||||
if (collector.IsValid() == false)
|
if (collector.IsValid() == false)
|
||||||
{
|
{
|
||||||
collector.CheckConfigError();
|
collector.CheckConfigError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collector.CollectorType == ECollectorType.MainAssetCollector || collector.CollectorType == ECollectorType.StaticAssetCollector)
|
|
||||||
{
|
|
||||||
List<CollectAssetInfo> collectAssetInfos = null;
|
List<CollectAssetInfo> collectAssetInfos = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -997,10 +1028,10 @@ namespace YooAsset.Editor
|
|||||||
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
||||||
string packageName = _packageNameTxt.value;
|
string packageName = _packageNameTxt.value;
|
||||||
var command = new CollectCommand(packageName, ignoreRule);
|
var command = new CollectCommand(packageName, ignoreRule);
|
||||||
command.SimulateBuild = true;
|
command.SetFlag(ECollectFlags.IgnoreGetDependencies, true);
|
||||||
command.UniqueBundleName = _uniqueBundleNameToogle.value;
|
command.UniqueBundleName = _uniqueBundleNameToogle.value;
|
||||||
command.UseAssetDependencyDB = true;
|
|
||||||
command.EnableAddressable = _enableAddressableToogle.value;
|
command.EnableAddressable = _enableAddressableToogle.value;
|
||||||
|
command.SupportExtensionless = _supportExtensionlessToogle.value;
|
||||||
command.LocationToLower = _locationToLowerToogle.value;
|
command.LocationToLower = _locationToLowerToogle.value;
|
||||||
command.IncludeAssetGUID = _includeAssetGUIDToogle.value;
|
command.IncludeAssetGUID = _includeAssetGUIDToogle.value;
|
||||||
command.AutoCollectShaders = _autoCollectShadersToogle.value;
|
command.AutoCollectShaders = _autoCollectShadersToogle.value;
|
||||||
@@ -1015,6 +1046,11 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
if (collectAssetInfos != null)
|
if (collectAssetInfos != null)
|
||||||
{
|
{
|
||||||
|
bool showAdress = false;
|
||||||
|
if (_enableAddressableToogle.value && collector.CollectorType == ECollectorType.MainAssetCollector)
|
||||||
|
showAdress = true;
|
||||||
|
|
||||||
|
RefreshFoldoutName(foldout, collector.CollectorType, collectAssetInfos.Count);
|
||||||
foreach (var collectAsset in collectAssetInfos)
|
foreach (var collectAsset in collectAssetInfos)
|
||||||
{
|
{
|
||||||
VisualElement elementRow = new VisualElement();
|
VisualElement elementRow = new VisualElement();
|
||||||
@@ -1022,7 +1058,7 @@ namespace YooAsset.Editor
|
|||||||
foldout.Add(elementRow);
|
foldout.Add(elementRow);
|
||||||
|
|
||||||
string showInfo = collectAsset.AssetInfo.AssetPath;
|
string showInfo = collectAsset.AssetInfo.AssetPath;
|
||||||
if (_enableAddressableToogle.value)
|
if (showAdress)
|
||||||
showInfo = $"[{collectAsset.Address}] {collectAsset.AssetInfo.AssetPath}";
|
showInfo = $"[{collectAsset.Address}] {collectAsset.AssetInfo.AssetPath}";
|
||||||
|
|
||||||
var label = new Label();
|
var label = new Label();
|
||||||
@@ -1034,7 +1070,6 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private void AddCollectorBtn_clicked()
|
private void AddCollectorBtn_clicked()
|
||||||
{
|
{
|
||||||
var selectGroup = _groupListView.selectedItem as AssetBundleCollectorGroup;
|
var selectGroup = _groupListView.selectedItem as AssetBundleCollectorGroup;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<ui:Button text="Package Settings" display-tooltip-when-elided="true" name="PackageSettingsButton" />
|
<ui:Button text="Package Settings" display-tooltip-when-elided="true" name="PackageSettingsButton" />
|
||||||
<ui:VisualElement name="PublicContainer2">
|
<ui:VisualElement name="PublicContainer2">
|
||||||
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
|
<ui:Toggle label="Support Extensionless" name="SupportExtensionless" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Location To Lower" name="LocationToLower" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Location To Lower" name="LocationToLower" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Include Asset GUID" name="IncludeAssetGUID" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Include Asset GUID" name="IncludeAssetGUID" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
<ui:Toggle label="Auto Collect Shaders" name="AutoCollectShaders" value="true" style="width: 196px; -unity-text-align: middle-left;" />
|
<ui:Toggle label="Auto Collect Shaders" name="AutoCollectShaders" value="true" style="width: 196px; -unity-text-align: middle-left;" />
|
||||||
|
|||||||
@@ -177,19 +177,21 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] GetDependencies(string assetPath, bool recursive)
|
public string[] GetDependencies(string assetPath, bool recursive)
|
||||||
{
|
{
|
||||||
// 注意:AssetDatabase.GetDependencies()方法返回结果里会踢出丢失文件!
|
|
||||||
// 注意:AssetDatabase.GetDependencies()方法返回结果里会包含主资源路径!
|
|
||||||
|
|
||||||
// 注意:机制上不允许存在未收录的资源
|
// 注意:机制上不允许存在未收录的资源
|
||||||
if (_database.ContainsKey(assetPath) == false)
|
if (_database.ContainsKey(assetPath) == false)
|
||||||
{
|
{
|
||||||
throw new Exception($"Fatal : can not found cache info : {assetPath}");
|
throw new Exception($"Fatal : can not found cache info : {assetPath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = new HashSet<string> { assetPath };
|
var result = new HashSet<string>();
|
||||||
|
|
||||||
|
// 注意:递归收集依赖时,依赖列表中包含主资源
|
||||||
|
if (recursive)
|
||||||
|
result.Add(assetPath);
|
||||||
|
|
||||||
|
// 收集依赖
|
||||||
CollectDependencies(assetPath, assetPath, result, recursive);
|
CollectDependencies(assetPath, assetPath, result, recursive);
|
||||||
|
|
||||||
// 注意:AssetDatabase.GetDependencies保持一致,将主资源添加到依赖列表最前面
|
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
private void CollectDependencies(string parent, string assetPath, HashSet<string> result, bool recursive)
|
private void CollectDependencies(string parent, string assetPath, HashSet<string> result, bool recursive)
|
||||||
@@ -255,6 +257,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
private DependencyInfo CreateDependencyInfo(string assetPath)
|
private DependencyInfo CreateDependencyInfo(string assetPath)
|
||||||
{
|
{
|
||||||
|
// 注意:AssetDatabase.GetDependencies()方法返回结果里会踢出丢失文件!
|
||||||
var dependHash = AssetDatabase.GetAssetDependencyHash(assetPath);
|
var dependHash = AssetDatabase.GetAssetDependencyHash(assetPath);
|
||||||
var dependAssetPaths = AssetDatabase.GetDependencies(assetPath, false);
|
var dependAssetPaths = AssetDatabase.GetDependencies(assetPath, false);
|
||||||
var dependGUIDs = new List<string>();
|
var dependGUIDs = new List<string>();
|
||||||
|
|||||||
@@ -1,6 +1,26 @@
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
|
public enum ECollectFlags
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不收集依赖资源
|
||||||
|
/// </summary>
|
||||||
|
IgnoreGetDependencies = 1 << 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略静态收集器
|
||||||
|
/// </summary>
|
||||||
|
IgnoreStaticCollector = 1 << 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略依赖收集器
|
||||||
|
/// </summary>
|
||||||
|
IgnoreDependCollector = 1 << 2,
|
||||||
|
}
|
||||||
|
|
||||||
public class CollectCommand
|
public class CollectCommand
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -17,7 +37,20 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模拟构建模式
|
/// 模拟构建模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SimulateBuild { set; get; }
|
public bool SimulateBuild
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetFlag(ECollectFlags.IgnoreGetDependencies, value);
|
||||||
|
SetFlag(ECollectFlags.IgnoreStaticCollector, value);
|
||||||
|
SetFlag(ECollectFlags.IgnoreDependCollector, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 窗口收集模式
|
||||||
|
/// </summary>
|
||||||
|
public int CollectFlags { set; get; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源包名唯一化
|
/// 资源包名唯一化
|
||||||
@@ -34,6 +67,11 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnableAddressable { set; get; }
|
public bool EnableAddressable { set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支持无后缀名的资源定位地址
|
||||||
|
/// </summary>
|
||||||
|
public bool SupportExtensionless { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源定位地址大小写不敏感
|
/// 资源定位地址大小写不敏感
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -65,5 +103,24 @@ namespace YooAsset.Editor
|
|||||||
PackageName = packageName;
|
PackageName = packageName;
|
||||||
IgnoreRule = ignoreRule;
|
IgnoreRule = ignoreRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置标记位
|
||||||
|
/// </summary>
|
||||||
|
public void SetFlag(ECollectFlags flag, bool isOn)
|
||||||
|
{
|
||||||
|
if (isOn)
|
||||||
|
CollectFlags |= (int)flag; // 开启指定标志位
|
||||||
|
else
|
||||||
|
CollectFlags &= ~(int)flag; // 关闭指定标志位
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询标记位
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFlagSet(ECollectFlags flag)
|
||||||
|
{
|
||||||
|
return (CollectFlags & (int)flag) != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,13 @@ namespace YooAsset.Editor
|
|||||||
public interface IFilterRule
|
public interface IFilterRule
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否为收集资源
|
/// 搜寻的资源类型
|
||||||
|
/// 说明:使用引擎方法搜索获取所有资源列表
|
||||||
|
/// </summary>
|
||||||
|
string FindAssetType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证搜寻的资源是否为收集资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>如果收集该资源返回TRUE</returns>
|
/// <returns>如果收集该资源返回TRUE</returns>
|
||||||
bool IsCollectAsset(FilterRuleData data);
|
bool IsCollectAsset(FilterRuleData data);
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ namespace YooAsset.Editor
|
|||||||
[DisplayName("收集所有资源")]
|
[DisplayName("收集所有资源")]
|
||||||
public class CollectAll : IFilterRule
|
public class CollectAll : IFilterRule
|
||||||
{
|
{
|
||||||
|
public string FindAssetType
|
||||||
|
{
|
||||||
|
get { return EAssetSearchType.All.ToString(); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -18,6 +23,11 @@ namespace YooAsset.Editor
|
|||||||
[DisplayName("收集场景")]
|
[DisplayName("收集场景")]
|
||||||
public class CollectScene : IFilterRule
|
public class CollectScene : IFilterRule
|
||||||
{
|
{
|
||||||
|
public string FindAssetType
|
||||||
|
{
|
||||||
|
get { return EAssetSearchType.Scene.ToString(); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
{
|
{
|
||||||
string extension = Path.GetExtension(data.AssetPath);
|
string extension = Path.GetExtension(data.AssetPath);
|
||||||
@@ -28,6 +38,11 @@ namespace YooAsset.Editor
|
|||||||
[DisplayName("收集预制体")]
|
[DisplayName("收集预制体")]
|
||||||
public class CollectPrefab : IFilterRule
|
public class CollectPrefab : IFilterRule
|
||||||
{
|
{
|
||||||
|
public string FindAssetType
|
||||||
|
{
|
||||||
|
get { return EAssetSearchType.Prefab.ToString(); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
{
|
{
|
||||||
return Path.GetExtension(data.AssetPath) == ".prefab";
|
return Path.GetExtension(data.AssetPath) == ".prefab";
|
||||||
@@ -37,6 +52,11 @@ namespace YooAsset.Editor
|
|||||||
[DisplayName("收集精灵类型的纹理")]
|
[DisplayName("收集精灵类型的纹理")]
|
||||||
public class CollectSprite : IFilterRule
|
public class CollectSprite : IFilterRule
|
||||||
{
|
{
|
||||||
|
public string FindAssetType
|
||||||
|
{
|
||||||
|
get { return EAssetSearchType.Sprite.ToString(); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
{
|
{
|
||||||
var mainAssetType = AssetDatabase.GetMainAssetTypeAtPath(data.AssetPath);
|
var mainAssetType = AssetDatabase.GetMainAssetTypeAtPath(data.AssetPath);
|
||||||
@@ -58,6 +78,11 @@ namespace YooAsset.Editor
|
|||||||
[DisplayName("收集着色器")]
|
[DisplayName("收集着色器")]
|
||||||
public class CollectShader : IFilterRule
|
public class CollectShader : IFilterRule
|
||||||
{
|
{
|
||||||
|
public string FindAssetType
|
||||||
|
{
|
||||||
|
get { return EAssetSearchType.Shader.ToString(); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
{
|
{
|
||||||
return Path.GetExtension(data.AssetPath) == ".shader";
|
return Path.GetExtension(data.AssetPath) == ".shader";
|
||||||
@@ -67,6 +92,11 @@ namespace YooAsset.Editor
|
|||||||
[DisplayName("收集着色器变种集合")]
|
[DisplayName("收集着色器变种集合")]
|
||||||
public class CollectShaderVariants : IFilterRule
|
public class CollectShaderVariants : IFilterRule
|
||||||
{
|
{
|
||||||
|
public string FindAssetType
|
||||||
|
{
|
||||||
|
get { return EAssetSearchType.All.ToString(); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsCollectAsset(FilterRuleData data)
|
public bool IsCollectAsset(FilterRuleData data)
|
||||||
{
|
{
|
||||||
return Path.GetExtension(data.AssetPath) == ".shadervariants";
|
return Path.GetExtension(data.AssetPath) == ".shadervariants";
|
||||||
|
|||||||
@@ -17,16 +17,25 @@ namespace YooAsset.Editor
|
|||||||
public const string RawFileExtension = "rawfile";
|
public const string RawFileExtension = "rawfile";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unity着色器资源包名称
|
/// 默认的Unity着色器资源包名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ShadersBundleName = "unityshaders";
|
public const string ShadersBundleName = "unityshaders";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 默认的Unity脚本资源包名称
|
||||||
|
/// </summary>
|
||||||
|
public const string MonosBundleName = "unitymonos";
|
||||||
|
|
||||||
public static PackRuleResult CreateShadersPackRuleResult()
|
public static PackRuleResult CreateShadersPackRuleResult()
|
||||||
{
|
{
|
||||||
PackRuleResult result = new PackRuleResult(ShadersBundleName, AssetBundleFileExtension);
|
PackRuleResult result = new PackRuleResult(ShadersBundleName, AssetBundleFileExtension);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
public static PackRuleResult CreateMonosPackRuleResult()
|
||||||
|
{
|
||||||
|
PackRuleResult result = new PackRuleResult(MonosBundleName, AssetBundleFileExtension);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件校验码
|
/// 文件校验码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FileCRC;
|
public uint FileCRC;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件大小(字节数)
|
/// 文件大小(字节数)
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace YooAsset.Editor
|
|||||||
// 收集器配置
|
// 收集器配置
|
||||||
public bool UniqueBundleName;
|
public bool UniqueBundleName;
|
||||||
public bool EnableAddressable;
|
public bool EnableAddressable;
|
||||||
|
public bool SupportExtensionless;
|
||||||
public bool LocationToLower;
|
public bool LocationToLower;
|
||||||
public bool IncludeAssetGUID;
|
public bool IncludeAssetGUID;
|
||||||
public bool AutoCollectShaders;
|
public bool AutoCollectShaders;
|
||||||
@@ -71,13 +72,16 @@ namespace YooAsset.Editor
|
|||||||
public bool UseAssetDependencyDB;
|
public bool UseAssetDependencyDB;
|
||||||
public bool EnableSharePackRule;
|
public bool EnableSharePackRule;
|
||||||
public bool SingleReferencedPackAlone;
|
public bool SingleReferencedPackAlone;
|
||||||
public string EncryptionClassName;
|
public string EncryptionServicesClassName;
|
||||||
|
public string ManifestProcessServicesClassName;
|
||||||
|
public string ManifestRestoreServicesClassName;
|
||||||
public EFileNameStyle FileNameStyle;
|
public EFileNameStyle FileNameStyle;
|
||||||
|
|
||||||
// 引擎参数
|
// 引擎参数
|
||||||
public ECompressOption CompressOption;
|
public ECompressOption CompressOption;
|
||||||
public bool DisableWriteTypeTree;
|
public bool DisableWriteTypeTree;
|
||||||
public bool IgnoreTypeTreeChanges;
|
public bool IgnoreTypeTreeChanges;
|
||||||
|
public bool ReplaceAssetPathWithAddress;
|
||||||
public bool WriteLinkXML = true;
|
public bool WriteLinkXML = true;
|
||||||
public string CacheServerHost;
|
public string CacheServerHost;
|
||||||
public int CacheServerPort;
|
public int CacheServerPort;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ namespace YooAsset.Editor
|
|||||||
BindListViewHeader("Collect Settings");
|
BindListViewHeader("Collect Settings");
|
||||||
BindListViewItem("Unique Bundle Name", $"{buildReport.Summary.UniqueBundleName}");
|
BindListViewItem("Unique Bundle Name", $"{buildReport.Summary.UniqueBundleName}");
|
||||||
BindListViewItem("Enable Addressable", $"{buildReport.Summary.EnableAddressable}");
|
BindListViewItem("Enable Addressable", $"{buildReport.Summary.EnableAddressable}");
|
||||||
|
BindListViewItem("Support Extensionless", $"{buildReport.Summary.SupportExtensionless}");
|
||||||
BindListViewItem("Location To Lower", $"{buildReport.Summary.LocationToLower}");
|
BindListViewItem("Location To Lower", $"{buildReport.Summary.LocationToLower}");
|
||||||
BindListViewItem("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}");
|
BindListViewItem("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}");
|
||||||
BindListViewItem("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}");
|
BindListViewItem("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}");
|
||||||
@@ -66,11 +67,14 @@ namespace YooAsset.Editor
|
|||||||
BindListViewItem("Use Asset Dependency DB", $"{buildReport.Summary.UseAssetDependencyDB}");
|
BindListViewItem("Use Asset Dependency DB", $"{buildReport.Summary.UseAssetDependencyDB}");
|
||||||
BindListViewItem("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}");
|
BindListViewItem("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}");
|
||||||
BindListViewItem("Single Referenced Pack Alone", $"{buildReport.Summary.SingleReferencedPackAlone}");
|
BindListViewItem("Single Referenced Pack Alone", $"{buildReport.Summary.SingleReferencedPackAlone}");
|
||||||
BindListViewItem("Encryption Class Name", buildReport.Summary.EncryptionClassName);
|
BindListViewItem("Encryption Services", buildReport.Summary.EncryptionServicesClassName);
|
||||||
|
BindListViewItem("Manifest Process Services", buildReport.Summary.ManifestProcessServicesClassName);
|
||||||
|
BindListViewItem("Manifest Restore Services", buildReport.Summary.ManifestRestoreServicesClassName);
|
||||||
BindListViewItem("FileNameStyle", $"{buildReport.Summary.FileNameStyle}");
|
BindListViewItem("FileNameStyle", $"{buildReport.Summary.FileNameStyle}");
|
||||||
BindListViewItem("CompressOption", $"{buildReport.Summary.CompressOption}");
|
BindListViewItem("CompressOption", $"{buildReport.Summary.CompressOption}");
|
||||||
BindListViewItem("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}");
|
BindListViewItem("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}");
|
||||||
BindListViewItem("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}");
|
BindListViewItem("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}");
|
||||||
|
BindListViewItem("ReplaceAssetPathWithAddress", $"{buildReport.Summary.ReplaceAssetPathWithAddress}");
|
||||||
BindListViewItem(string.Empty, string.Empty);
|
BindListViewItem(string.Empty, string.Empty);
|
||||||
|
|
||||||
BindListViewHeader("Build Results");
|
BindListViewHeader("Build Results");
|
||||||
|
|||||||
@@ -62,6 +62,17 @@ namespace YooAsset.Editor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为图集资源
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSpriteAtlas()
|
||||||
|
{
|
||||||
|
if (AssetType == typeof(UnityEngine.U2D.SpriteAtlas))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public int CompareTo(AssetInfo other)
|
public int CompareTo(AssetInfo other)
|
||||||
{
|
{
|
||||||
return this.AssetPath.CompareTo(other.AssetPath);
|
return this.AssetPath.CompareTo(other.AssetPath);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace YooAsset.Editor
|
|||||||
Shader,
|
Shader,
|
||||||
Sprite,
|
Sprite,
|
||||||
Texture,
|
Texture,
|
||||||
|
RenderTexture,
|
||||||
VideoClip,
|
VideoClip,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,28 @@ namespace YooAsset.Editor
|
|||||||
/// <param name="searchInFolders">指定搜索的文件夹列表</param>
|
/// <param name="searchInFolders">指定搜索的文件夹列表</param>
|
||||||
/// <returns>返回搜集到的资源路径列表</returns>
|
/// <returns>返回搜集到的资源路径列表</returns>
|
||||||
public static string[] FindAssets(EAssetSearchType searchType, string[] searchInFolders)
|
public static string[] FindAssets(EAssetSearchType searchType, string[] searchInFolders)
|
||||||
|
{
|
||||||
|
return FindAssets(searchType.ToString(), searchInFolders);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜集资源
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchType">搜集的资源类型</param>
|
||||||
|
/// <param name="searchInFolder">指定搜索的文件夹</param>
|
||||||
|
/// <returns>返回搜集到的资源路径列表</returns>
|
||||||
|
public static string[] FindAssets(EAssetSearchType searchType, string searchInFolder)
|
||||||
|
{
|
||||||
|
return FindAssets(searchType.ToString(), new string[] { searchInFolder });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜集资源
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchType">搜集的资源类型</param>
|
||||||
|
/// <param name="searchInFolders">指定搜索的文件夹列表</param>
|
||||||
|
/// <returns>返回搜集到的资源路径列表</returns>
|
||||||
|
public static string[] FindAssets(string searchType, string[] searchInFolders)
|
||||||
{
|
{
|
||||||
// 注意:AssetDatabase.FindAssets()不支持末尾带分隔符的文件夹路径
|
// 注意:AssetDatabase.FindAssets()不支持末尾带分隔符的文件夹路径
|
||||||
for (int i = 0; i < searchInFolders.Length; i++)
|
for (int i = 0; i < searchInFolders.Length; i++)
|
||||||
@@ -179,7 +201,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// 注意:获取指定目录下的所有资源对象(包括子文件夹)
|
// 注意:获取指定目录下的所有资源对象(包括子文件夹)
|
||||||
string[] guids;
|
string[] guids;
|
||||||
if (searchType == EAssetSearchType.All)
|
if (string.IsNullOrEmpty(searchType) || searchType == EAssetSearchType.All.ToString())
|
||||||
guids = AssetDatabase.FindAssets(string.Empty, searchInFolders);
|
guids = AssetDatabase.FindAssets(string.Empty, searchInFolders);
|
||||||
else
|
else
|
||||||
guids = AssetDatabase.FindAssets($"t:{searchType}", searchInFolders);
|
guids = AssetDatabase.FindAssets($"t:{searchType}", searchInFolders);
|
||||||
@@ -206,7 +228,7 @@ namespace YooAsset.Editor
|
|||||||
/// <param name="searchType">搜集的资源类型</param>
|
/// <param name="searchType">搜集的资源类型</param>
|
||||||
/// <param name="searchInFolder">指定搜索的文件夹</param>
|
/// <param name="searchInFolder">指定搜索的文件夹</param>
|
||||||
/// <returns>返回搜集到的资源路径列表</returns>
|
/// <returns>返回搜集到的资源路径列表</returns>
|
||||||
public static string[] FindAssets(EAssetSearchType searchType, string searchInFolder)
|
public static string[] FindAssets(string searchType, string searchInFolder)
|
||||||
{
|
{
|
||||||
return FindAssets(searchType, new string[] { searchInFolder });
|
return FindAssets(searchType, new string[] { searchInFolder });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,67 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置元素显示文本为资源路径
|
||||||
|
/// </summary>
|
||||||
|
public static void SetObjectFieldShowPath(ObjectField objectField)
|
||||||
|
{
|
||||||
|
string LabelClassName = "unity-object-field-display__label";
|
||||||
|
var nameLable = objectField.Q<Label>(className: LabelClassName);
|
||||||
|
if (nameLable == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
objectField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
Object obj = evt.newValue;
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
nameLable.text = "None (Object)";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取资源路径(仅适用于项目资源)
|
||||||
|
string path = AssetDatabase.GetAssetPath(obj);
|
||||||
|
if (string.IsNullOrEmpty(path) == false)
|
||||||
|
{
|
||||||
|
nameLable.text = path;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nameLable.text = obj.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新元素显示文本内容
|
||||||
|
/// </summary>
|
||||||
|
public static void RefreshObjectFieldShowPath(ObjectField objectField)
|
||||||
|
{
|
||||||
|
string LabelClassName = "unity-object-field-display__label";
|
||||||
|
var nameLable = objectField.Q<Label>(className: LabelClassName);
|
||||||
|
if (nameLable == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Object obj = objectField.value;
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
nameLable.text = "None (Object)";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取资源路径(仅适用于项目资源)
|
||||||
|
string path = AssetDatabase.GetAssetPath(obj);
|
||||||
|
if (string.IsNullOrEmpty(path) == false)
|
||||||
|
{
|
||||||
|
nameLable.text = path;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nameLable.text = obj.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置按钮图标
|
/// 设置按钮图标
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// 内部友元
|
// 内部友元
|
||||||
[assembly: InternalsVisibleTo("YooAsset.Editor")]
|
[assembly: InternalsVisibleTo("YooAsset.Editor")]
|
||||||
|
[assembly: InternalsVisibleTo("YooAsset.Test")]
|
||||||
[assembly: InternalsVisibleTo("YooAsset.Test.Editor")]
|
[assembly: InternalsVisibleTo("YooAsset.Test.Editor")]
|
||||||
|
|
||||||
// 外部友元
|
// 外部友元
|
||||||
|
|||||||
@@ -94,4 +94,25 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public long FileSize;
|
public long FileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导入文件的信息
|
||||||
|
/// </summary>
|
||||||
|
public struct ImportFileInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 本地文件路径
|
||||||
|
/// </summary>
|
||||||
|
public string FilePath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源包名称
|
||||||
|
/// </summary>
|
||||||
|
public string BundleName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源包GUID
|
||||||
|
/// </summary>
|
||||||
|
public string BundleGUID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -37,13 +37,17 @@ namespace YooAsset
|
|||||||
string url;
|
string url;
|
||||||
|
|
||||||
// 获取对应平台的URL地址
|
// 获取对应平台的URL地址
|
||||||
|
// 说明:苹果不同设备上操作系统不同。
|
||||||
|
// 说明:iPhone和iPod对应的是iOS系统。
|
||||||
|
// 说明:iPad对应的是iPadOS系统。
|
||||||
|
// 说明:AppleTV对应的是tvOS系统。
|
||||||
#if UNITY_EDITOR_OSX
|
#if UNITY_EDITOR_OSX
|
||||||
url = StringUtility.Format("file://{0}", path);
|
url = StringUtility.Format("file://{0}", path);
|
||||||
#elif UNITY_EDITOR
|
#elif UNITY_EDITOR_WIN
|
||||||
url = StringUtility.Format("file:///{0}", path);
|
url = StringUtility.Format("file:///{0}", path);
|
||||||
#elif UNITY_WEBGL
|
#elif UNITY_WEBGL
|
||||||
url = path;
|
url = path;
|
||||||
#elif UNITY_IPHONE
|
#elif UNITY_IOS || UNITY_IPHONE
|
||||||
url = StringUtility.Format("file://{0}", path);
|
url = StringUtility.Format("file://{0}", path);
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
if (path.StartsWith("jar:file://"))
|
if (path.StartsWith("jar:file://"))
|
||||||
@@ -65,12 +69,17 @@ namespace YooAsset
|
|||||||
else
|
else
|
||||||
url = StringUtility.Format("file://{0}", path);
|
url = StringUtility.Format("file://{0}", path);
|
||||||
}
|
}
|
||||||
#elif UNITY_STANDALONE_OSX
|
|
||||||
url = new System.Uri(path).ToString();
|
#elif UNITY_WSA
|
||||||
#elif UNITY_STANDALONE || UNITY_WSA
|
|
||||||
url = StringUtility.Format("file:///{0}", path);
|
url = StringUtility.Format("file:///{0}", path);
|
||||||
#elif UNITY_TVOS
|
#elif UNITY_TVOS
|
||||||
url = StringUtility.Format("file:///{0}", path);
|
url = StringUtility.Format("file:///{0}", path);
|
||||||
|
#elif UNITY_STANDALONE_OSX
|
||||||
|
url = new System.Uri(path).ToString();
|
||||||
|
#elif UNITY_STANDALONE_WIN
|
||||||
|
url = StringUtility.Format("file:///{0}", path);
|
||||||
|
#elif UNITY_STANDALONE_LINUX
|
||||||
|
url = StringUtility.Format("file:///root/{0}", path);
|
||||||
#else
|
#else
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,16 +1,32 @@
|
|||||||
using UnityEngine;
|
using UnityEngine.Networking;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class DownloadWebNormalAssetBundleOperation : DownloadAssetBundleOperation
|
internal class UnityAssetBundleRequestOperation : UnityWebRequestOperation
|
||||||
{
|
{
|
||||||
private readonly bool _disableUnityWebCache;
|
protected enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
CreateRequest,
|
||||||
|
Download,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
|
private UnityWebRequestAsyncOperation _requestOperation;
|
||||||
private DownloadHandlerAssetBundle _downloadhandler;
|
private DownloadHandlerAssetBundle _downloadhandler;
|
||||||
|
private readonly PackageBundle _packageBundle;
|
||||||
|
private readonly bool _disableUnityWebCache;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
internal DownloadWebNormalAssetBundleOperation(bool disableUnityWebCache, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
|
/// <summary>
|
||||||
|
/// 请求结果
|
||||||
|
/// </summary>
|
||||||
|
public AssetBundle Result { private set; get; }
|
||||||
|
|
||||||
|
internal UnityAssetBundleRequestOperation(PackageBundle packageBundle, bool disableUnityWebCache, string url) : base(url)
|
||||||
{
|
{
|
||||||
|
_packageBundle = packageBundle;
|
||||||
_disableUnityWebCache = disableUnityWebCache;
|
_disableUnityWebCache = disableUnityWebCache;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
@@ -22,34 +38,20 @@ namespace YooAsset
|
|||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// 创建下载器
|
|
||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
// 获取请求地址
|
|
||||||
_requestURL = GetRequestURL();
|
|
||||||
|
|
||||||
// 重置变量
|
|
||||||
ResetRequestFiled();
|
|
||||||
|
|
||||||
// 创建下载器
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
|
_steps = ESteps.Download;
|
||||||
_steps = ESteps.CheckRequest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测下载结果
|
if (_steps == ESteps.Download)
|
||||||
if (_steps == ESteps.CheckRequest)
|
|
||||||
{
|
{
|
||||||
DownloadProgress = _webRequest.downloadProgress;
|
DownloadProgress = _webRequest.downloadProgress;
|
||||||
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = DownloadProgress;
|
Progress = _requestOperation.progress;
|
||||||
if (_webRequest.isDone == false)
|
if (_requestOperation.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// 检查网络错误
|
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
{
|
{
|
||||||
AssetBundle assetBundle = _downloadhandler.assetBundle;
|
AssetBundle assetBundle = _downloadhandler.assetBundle;
|
||||||
@@ -57,7 +59,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Failed;
|
Status = EOperationStatus.Failed;
|
||||||
Error = "Download handler asset bundle object is null !";
|
Error = $"URL : {_requestURL} Download handler asset bundle object is null !";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -68,37 +70,13 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_steps = ESteps.TryAgain;
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注意:最终释放请求器
|
// 注意:最终释放请求器
|
||||||
DisposeWebRequest();
|
DisposeRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新尝试下载
|
|
||||||
if (_steps == ESteps.TryAgain)
|
|
||||||
{
|
|
||||||
if (FailedTryAgain <= 0)
|
|
||||||
{
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
YooLogger.Error(Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_tryAgainTimer += Time.unscaledDeltaTime;
|
|
||||||
if (_tryAgainTimer > 1f)
|
|
||||||
{
|
|
||||||
FailedTryAgain--;
|
|
||||||
_steps = ESteps.CreateRequest;
|
|
||||||
YooLogger.Warning(Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
internal override void InternalAbort()
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
DisposeWebRequest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
@@ -107,22 +85,13 @@ namespace YooAsset
|
|||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
_webRequest.downloadHandler = _downloadhandler;
|
_webRequest.downloadHandler = _downloadhandler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_webRequest.SendWebRequest();
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
}
|
|
||||||
private void DisposeWebRequest()
|
|
||||||
{
|
|
||||||
if (_webRequest != null)
|
|
||||||
{
|
|
||||||
//注意:引擎底层会自动调用Abort方法
|
|
||||||
_webRequest.Dispose();
|
|
||||||
_webRequest = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private DownloadHandlerAssetBundle CreateWebDownloadHandler()
|
private DownloadHandlerAssetBundle CreateWebDownloadHandler()
|
||||||
{
|
{
|
||||||
if (_disableUnityWebCache)
|
if (_disableUnityWebCache)
|
||||||
{
|
{
|
||||||
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, Bundle.UnityCRC);
|
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, _packageBundle.UnityCRC);
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
downloadhandler.autoLoadAssetBundle = false;
|
downloadhandler.autoLoadAssetBundle = false;
|
||||||
#endif
|
#endif
|
||||||
@@ -132,8 +101,8 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
// 注意:优先从浏览器缓存里获取文件
|
// 注意:优先从浏览器缓存里获取文件
|
||||||
// The file hash defining the version of the asset bundle.
|
// The file hash defining the version of the asset bundle.
|
||||||
Hash128 fileHash = Hash128.Parse(Bundle.FileHash);
|
Hash128 fileHash = Hash128.Parse(_packageBundle.FileHash);
|
||||||
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, fileHash, Bundle.UnityCRC);
|
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, fileHash, _packageBundle.UnityCRC);
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
downloadhandler.autoLoadAssetBundle = false;
|
downloadhandler.autoLoadAssetBundle = false;
|
||||||
#endif
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 94254ab8e4496214884c11a891c131c6
|
guid: e01cc308d7179a34281087fafe455b42
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
using UnityEngine.Networking;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
internal class UnityVirtualBundleRequestOperation : UnityWebRequestOperation
|
||||||
|
{
|
||||||
|
protected enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Download,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly PackageBundle _bundle;
|
||||||
|
private readonly int _downloadSpeed;
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
internal UnityVirtualBundleRequestOperation(PackageBundle packageBundle, int downloadSpeed, string url) : base(url)
|
||||||
|
{
|
||||||
|
_bundle = packageBundle;
|
||||||
|
_downloadSpeed = downloadSpeed;
|
||||||
|
}
|
||||||
|
internal override void InternalStart()
|
||||||
|
{
|
||||||
|
_steps = ESteps.Download;
|
||||||
|
}
|
||||||
|
internal override void InternalUpdate()
|
||||||
|
{
|
||||||
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.Download)
|
||||||
|
{
|
||||||
|
// 模拟下载进度
|
||||||
|
float progress = 0;
|
||||||
|
if (DownloadedBytes > 0)
|
||||||
|
progress = DownloadedBytes / _bundle.FileSize;
|
||||||
|
long downloadBytes = (long)((double)_downloadSpeed * Time.deltaTime);
|
||||||
|
|
||||||
|
Progress = progress;
|
||||||
|
DownloadProgress = progress;
|
||||||
|
DownloadedBytes += downloadBytes;
|
||||||
|
if (DownloadedBytes < _bundle.FileSize)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Progress = 1f;
|
||||||
|
DownloadProgress = 1f;
|
||||||
|
DownloadedBytes = _bundle.FileSize;
|
||||||
|
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
internal override void InternalWaitForAsyncComplete()
|
||||||
|
{
|
||||||
|
if (_steps != ESteps.Done)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = $"Try load bundle {_bundle.BundleName} from remote !";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: f2a5bb0106a45e540a43a05b72a75bcd
|
guid: 9e71e850eded0da43906cb4f7cb75629
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
internal class UnityWebCacheRequestOperation : UnityWebRequestOperation
|
||||||
|
{
|
||||||
|
protected enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
CreateRequest,
|
||||||
|
Download,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
|
private UnityWebRequestAsyncOperation _requestOperation;
|
||||||
|
private readonly Dictionary<string, string> _headers = new Dictionary<string, string>();
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
|
||||||
|
internal UnityWebCacheRequestOperation(string url) : base(url)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
internal override void InternalStart()
|
||||||
|
{
|
||||||
|
_steps = ESteps.CreateRequest;
|
||||||
|
}
|
||||||
|
internal override void InternalUpdate()
|
||||||
|
{
|
||||||
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.CreateRequest)
|
||||||
|
{
|
||||||
|
CreateWebRequest();
|
||||||
|
_steps = ESteps.Download;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_steps == ESteps.Download)
|
||||||
|
{
|
||||||
|
DownloadProgress = _webRequest.downloadProgress;
|
||||||
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
|
Progress = _requestOperation.progress;
|
||||||
|
if (_requestOperation.isDone == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CheckRequestResult())
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意:最终释放请求器
|
||||||
|
DisposeRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置请求头信息
|
||||||
|
/// </summary>
|
||||||
|
public void SetRequestHeader(string name, string value)
|
||||||
|
{
|
||||||
|
_headers.Add(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateWebRequest()
|
||||||
|
{
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
|
|
||||||
|
// 设置消息头
|
||||||
|
foreach (var keyValuePair in _headers)
|
||||||
|
{
|
||||||
|
string name = keyValuePair.Key;
|
||||||
|
string value = keyValuePair.Value;
|
||||||
|
_webRequest.SetRequestHeader(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8ac57bde14f2e1a4e9323751a7157ed7
|
guid: 375d88bcf5b9a6146adaf98ceb5369f8
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -5,7 +5,23 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
internal class UnityWebDataRequestOperation : UnityWebRequestOperation
|
internal class UnityWebDataRequestOperation : UnityWebRequestOperation
|
||||||
{
|
{
|
||||||
|
protected enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
CreateRequest,
|
||||||
|
Download,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
private UnityWebRequestAsyncOperation _requestOperation;
|
private UnityWebRequestAsyncOperation _requestOperation;
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
|
||||||
|
/// 注意:当Timeout设置为0时,不会应用超时。
|
||||||
|
/// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _timeout;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 请求结果
|
/// 请求结果
|
||||||
@@ -13,8 +29,9 @@ namespace YooAsset
|
|||||||
public byte[] Result { private set; get; }
|
public byte[] Result { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
internal UnityWebDataRequestOperation(string url, int timeout = 60) : base(url, timeout)
|
internal UnityWebDataRequestOperation(string url, int timeout) : base(url)
|
||||||
{
|
{
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -27,28 +44,34 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
_latestDownloadBytes = 0;
|
|
||||||
_latestDownloadRealtime = Time.realtimeSinceStartup;
|
|
||||||
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_steps == ESteps.Download)
|
if (_steps == ESteps.Download)
|
||||||
{
|
{
|
||||||
|
DownloadProgress = _webRequest.downloadProgress;
|
||||||
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = _requestOperation.progress;
|
Progress = _requestOperation.progress;
|
||||||
if (_requestOperation.isDone == false)
|
if (_requestOperation.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
|
{
|
||||||
|
var fileData = _webRequest.downloadHandler.data;
|
||||||
|
if (fileData == null || fileData.Length == 0)
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Result = _webRequest.downloadHandler.data;
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = $"URL : {_requestURL} Download handler data is null or empty !";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Result = fileData;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
@@ -59,16 +82,12 @@ namespace YooAsset
|
|||||||
DisposeRequest();
|
DisposeRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal override void InternalAbort()
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
DisposeRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
|
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
|
_webRequest.timeout = _timeout;
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_requestOperation = _webRequest.SendWebRequest();
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
|
|||||||
@@ -5,12 +5,30 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
internal class UnityWebFileRequestOperation : UnityWebRequestOperation
|
internal class UnityWebFileRequestOperation : UnityWebRequestOperation
|
||||||
{
|
{
|
||||||
|
protected enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
CreateRequest,
|
||||||
|
Download,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
private UnityWebRequestAsyncOperation _requestOperation;
|
private UnityWebRequestAsyncOperation _requestOperation;
|
||||||
private readonly string _fileSavePath;
|
private readonly string _fileSavePath;
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
internal UnityWebFileRequestOperation(string url, string fileSavePath, int timeout = 60) : base(url, timeout)
|
/// <summary>
|
||||||
|
/// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
|
||||||
|
/// 注意:当Timeout设置为0时,不会应用超时。
|
||||||
|
/// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _timeout;
|
||||||
|
|
||||||
|
|
||||||
|
internal UnityWebFileRequestOperation(string url, string fileSavePath, int timeout) : base(url)
|
||||||
{
|
{
|
||||||
_fileSavePath = fileSavePath;
|
_fileSavePath = fileSavePath;
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -23,21 +41,17 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
_latestDownloadBytes = 0;
|
|
||||||
_latestDownloadRealtime = Time.realtimeSinceStartup;
|
|
||||||
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_steps == ESteps.Download)
|
if (_steps == ESteps.Download)
|
||||||
{
|
{
|
||||||
|
DownloadProgress = _webRequest.downloadProgress;
|
||||||
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = _requestOperation.progress;
|
Progress = _requestOperation.progress;
|
||||||
if (_requestOperation.isDone == false)
|
if (_requestOperation.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
{
|
{
|
||||||
@@ -54,17 +68,13 @@ namespace YooAsset
|
|||||||
DisposeRequest();
|
DisposeRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal override void InternalAbort()
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
DisposeRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
DownloadHandlerFile handler = new DownloadHandlerFile(_fileSavePath);
|
DownloadHandlerFile handler = new DownloadHandlerFile(_fileSavePath);
|
||||||
handler.removeFileOnAbort = true;
|
handler.removeFileOnAbort = true;
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
|
_webRequest.timeout = _timeout;
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_requestOperation = _webRequest.SendWebRequest();
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -8,33 +6,50 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
internal abstract class UnityWebRequestOperation : AsyncOperationBase
|
internal abstract class UnityWebRequestOperation : AsyncOperationBase
|
||||||
{
|
{
|
||||||
protected enum ESteps
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
CreateRequest,
|
|
||||||
Download,
|
|
||||||
Done,
|
|
||||||
}
|
|
||||||
|
|
||||||
protected UnityWebRequest _webRequest;
|
protected UnityWebRequest _webRequest;
|
||||||
protected readonly string _requestURL;
|
protected readonly string _requestURL;
|
||||||
protected ESteps _steps = ESteps.None;
|
|
||||||
|
|
||||||
// 超时相关
|
|
||||||
protected readonly float _timeout;
|
|
||||||
protected ulong _latestDownloadBytes;
|
|
||||||
protected float _latestDownloadRealtime;
|
|
||||||
private bool _isAbort = false;
|
private bool _isAbort = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// HTTP返回码
|
||||||
|
/// </summary>
|
||||||
|
public long HttpCode { private set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前下载的字节数
|
||||||
|
/// </summary>
|
||||||
|
public long DownloadedBytes { protected set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前下载进度(0f - 1f)
|
||||||
|
/// </summary>
|
||||||
|
public float DownloadProgress { protected set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求的URL地址
|
||||||
|
/// </summary>
|
||||||
public string URL
|
public string URL
|
||||||
{
|
{
|
||||||
get { return _requestURL; }
|
get { return _requestURL; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal UnityWebRequestOperation(string url, int timeout)
|
internal UnityWebRequestOperation(string url)
|
||||||
{
|
{
|
||||||
_requestURL = url;
|
_requestURL = url;
|
||||||
_timeout = timeout;
|
}
|
||||||
|
internal override void InternalAbort()
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
// 1. 编辑器下停止运行游戏的时候主动终止下载任务
|
||||||
|
// 2. 真机上销毁包裹的时候主动终止下载任务
|
||||||
|
if (_isAbort == false)
|
||||||
|
{
|
||||||
|
if (_webRequest != null)
|
||||||
|
{
|
||||||
|
_webRequest.Abort();
|
||||||
|
_isAbort = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -44,39 +59,19 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_webRequest != null)
|
if (_webRequest != null)
|
||||||
{
|
{
|
||||||
|
//注意:引擎底层会自动调用Abort方法
|
||||||
_webRequest.Dispose();
|
_webRequest.Dispose();
|
||||||
_webRequest = null;
|
_webRequest = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 检测超时
|
|
||||||
/// </summary>
|
|
||||||
protected void CheckRequestTimeout()
|
|
||||||
{
|
|
||||||
// 注意:在连续时间段内无新增下载数据及判定为超时
|
|
||||||
if (_isAbort == false)
|
|
||||||
{
|
|
||||||
if ( _latestDownloadBytes != _webRequest.downloadedBytes)
|
|
||||||
{
|
|
||||||
_latestDownloadBytes = _webRequest.downloadedBytes;
|
|
||||||
_latestDownloadRealtime = Time.realtimeSinceStartup;
|
|
||||||
}
|
|
||||||
|
|
||||||
float offset = Time.realtimeSinceStartup - _latestDownloadRealtime;
|
|
||||||
if (offset > _timeout)
|
|
||||||
{
|
|
||||||
_webRequest.Abort();
|
|
||||||
_isAbort = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检测请求结果
|
/// 检测请求结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected bool CheckRequestResult()
|
protected bool CheckRequestResult()
|
||||||
{
|
{
|
||||||
|
HttpCode = _webRequest.responseCode;
|
||||||
|
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
if (_webRequest.result != UnityWebRequest.Result.Success)
|
if (_webRequest.result != UnityWebRequest.Result.Success)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,23 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
internal class UnityWebTextRequestOperation : UnityWebRequestOperation
|
internal class UnityWebTextRequestOperation : UnityWebRequestOperation
|
||||||
{
|
{
|
||||||
|
protected enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
CreateRequest,
|
||||||
|
Download,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
private UnityWebRequestAsyncOperation _requestOperation;
|
private UnityWebRequestAsyncOperation _requestOperation;
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应的超时时间(单位:秒),在经过Timeout的秒数后尝试中止。
|
||||||
|
/// 注意:当Timeout设置为0时,不会应用超时。
|
||||||
|
/// 注意:设置的超时值可能应用于Android上的每个URL重定向,这可能会导致响应时间增加。
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _timeout;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 请求结果
|
/// 请求结果
|
||||||
@@ -13,8 +29,9 @@ namespace YooAsset
|
|||||||
public string Result { private set; get; }
|
public string Result { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
internal UnityWebTextRequestOperation(string url, int timeout = 60) : base(url, timeout)
|
internal UnityWebTextRequestOperation(string url, int timeout) : base(url)
|
||||||
{
|
{
|
||||||
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
@@ -27,28 +44,34 @@ namespace YooAsset
|
|||||||
|
|
||||||
if (_steps == ESteps.CreateRequest)
|
if (_steps == ESteps.CreateRequest)
|
||||||
{
|
{
|
||||||
_latestDownloadBytes = 0;
|
|
||||||
_latestDownloadRealtime = Time.realtimeSinceStartup;
|
|
||||||
|
|
||||||
CreateWebRequest();
|
CreateWebRequest();
|
||||||
_steps = ESteps.Download;
|
_steps = ESteps.Download;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_steps == ESteps.Download)
|
if (_steps == ESteps.Download)
|
||||||
{
|
{
|
||||||
|
DownloadProgress = _webRequest.downloadProgress;
|
||||||
|
DownloadedBytes = (long)_webRequest.downloadedBytes;
|
||||||
Progress = _requestOperation.progress;
|
Progress = _requestOperation.progress;
|
||||||
if (_requestOperation.isDone == false)
|
if (_requestOperation.isDone == false)
|
||||||
{
|
|
||||||
CheckRequestTimeout();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckRequestResult())
|
if (CheckRequestResult())
|
||||||
|
{
|
||||||
|
var fileText = _webRequest.downloadHandler.text;
|
||||||
|
if (string.IsNullOrEmpty(fileText))
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Result = _webRequest.downloadHandler.text;
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = $"URL : {_requestURL} Download handler text is null or empty !";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Result = fileText;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
@@ -59,16 +82,12 @@ namespace YooAsset
|
|||||||
DisposeRequest();
|
DisposeRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal override void InternalAbort()
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
DisposeRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateWebRequest()
|
private void CreateWebRequest()
|
||||||
{
|
{
|
||||||
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
|
||||||
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
|
DownloadHandlerBuffer handler = new DownloadHandlerBuffer();
|
||||||
|
_webRequest = DownloadSystemHelper.NewUnityWebRequestGet(_requestURL);
|
||||||
|
_webRequest.timeout = _timeout;
|
||||||
_webRequest.downloadHandler = handler;
|
_webRequest.downloadHandler = handler;
|
||||||
_webRequest.disposeDownloadHandlerOnDispose = true;
|
_webRequest.disposeDownloadHandlerOnDispose = true;
|
||||||
_requestOperation = _webRequest.SendWebRequest();
|
_requestOperation = _webRequest.SendWebRequest();
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InternalWaitForAsyncComplete()
|
internal override void InternalWaitForAsyncComplete()
|
||||||
{
|
{
|
||||||
//TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
|
//注意:场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
|
||||||
InternalUpdate();
|
InternalUpdate();
|
||||||
}
|
}
|
||||||
public override void UnSuspendLoad()
|
public override void UnSuspendLoad()
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InternalWaitForAsyncComplete()
|
internal override void InternalWaitForAsyncComplete()
|
||||||
{
|
{
|
||||||
//TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
|
//注意:场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
|
||||||
InternalUpdate();
|
InternalUpdate();
|
||||||
}
|
}
|
||||||
public override void UnSuspendLoad()
|
public override void UnSuspendLoad()
|
||||||
|
|||||||
@@ -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,148 +0,0 @@
|
|||||||
#if UNITY_EDITOR
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
public class DefaultBuildinFileSystemBuild : UnityEditor.Build.IPreprocessBuildWithReport
|
|
||||||
{
|
|
||||||
public int callbackOrder { get { return 0; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在构建应用程序前自动生成内置资源目录文件。
|
|
||||||
/// 原理:搜索StreamingAssets目录下的所有资源文件,然后将这些文件信息写入文件,并存储在Resources目录下。
|
|
||||||
/// </summary>
|
|
||||||
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
|
|
||||||
{
|
|
||||||
YooLogger.Log("Begin to create catalog file !");
|
|
||||||
|
|
||||||
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
|
|
||||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
|
||||||
if (rootDirectory.Exists == false)
|
|
||||||
{
|
|
||||||
UnityEngine.Debug.LogWarning($"Can not found StreamingAssets root directory : {rootPath}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 搜索所有Package目录
|
|
||||||
DirectoryInfo[] subDirectories = rootDirectory.GetDirectories();
|
|
||||||
foreach (var subDirectory in subDirectories)
|
|
||||||
{
|
|
||||||
string packageName = subDirectory.Name;
|
|
||||||
string pacakgeDirectory = subDirectory.FullName;
|
|
||||||
bool result = CreateBuildinCatalogFile(packageName, pacakgeDirectory);
|
|
||||||
if (result == false)
|
|
||||||
{
|
|
||||||
throw new System.Exception($"Create package {packageName} catalog file failed ! See the detail error in console !");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 生成包裹的内置资源目录文件
|
|
||||||
/// </summary>
|
|
||||||
public static bool CreateBuildinCatalogFile(string packageName, string pacakgeDirectory)
|
|
||||||
{
|
|
||||||
// 获取资源清单版本
|
|
||||||
string packageVersion;
|
|
||||||
{
|
|
||||||
string versionFileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
|
||||||
string versionFilePath = $"{pacakgeDirectory}/{versionFileName}";
|
|
||||||
if (File.Exists(versionFilePath) == false)
|
|
||||||
{
|
|
||||||
Debug.LogError($"Can not found package version file : {versionFilePath}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
packageVersion = FileUtility.ReadAllText(versionFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载资源清单文件
|
|
||||||
PackageManifest packageManifest;
|
|
||||||
{
|
|
||||||
string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(packageName, packageVersion);
|
|
||||||
string manifestFilePath = $"{pacakgeDirectory}/{manifestFileName}";
|
|
||||||
if (File.Exists(manifestFilePath) == false)
|
|
||||||
{
|
|
||||||
Debug.LogError($"Can not found package manifest file : {manifestFilePath}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var binaryData = FileUtility.ReadAllBytes(manifestFilePath);
|
|
||||||
packageManifest = ManifestTools.DeserializeFromBinary(binaryData);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取文件名映射关系
|
|
||||||
Dictionary<string, string> fileMapping = new Dictionary<string, string>();
|
|
||||||
{
|
|
||||||
foreach (var packageBundle in packageManifest.BundleList)
|
|
||||||
{
|
|
||||||
fileMapping.Add(packageBundle.FileName, packageBundle.BundleGUID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建内置清单实例
|
|
||||||
var buildinFileCatalog = new DefaultBuildinFileCatalog();
|
|
||||||
buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
|
|
||||||
buildinFileCatalog.PackageName = packageName;
|
|
||||||
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);
|
|
||||||
FileInfo[] fileInfos = rootDirectory.GetFiles();
|
|
||||||
foreach (var fileInfo in fileInfos)
|
|
||||||
{
|
|
||||||
if (fileInfo.Extension == ".meta")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (whiteFileList.Contains(fileInfo.Name))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string fileName = fileInfo.Name;
|
|
||||||
if (fileMapping.TryGetValue(fileName, out string bundleGUID))
|
|
||||||
{
|
|
||||||
var wrapper = new DefaultBuildinFileCatalog.FileWrapper();
|
|
||||||
wrapper.BundleGUID = bundleGUID;
|
|
||||||
wrapper.FileName = fileName;
|
|
||||||
buildinFileCatalog.Wrappers.Add(wrapper);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"Failed mapping file : {fileName}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建输出文件
|
|
||||||
string jsonFilePath = $"{pacakgeDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
|
|
||||||
if (File.Exists(jsonFilePath))
|
|
||||||
File.Delete(jsonFilePath);
|
|
||||||
CatalogTools.SerializeToJson(jsonFilePath, buildinFileCatalog);
|
|
||||||
|
|
||||||
// 创建输出文件
|
|
||||||
string binaryFilePath = $"{pacakgeDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
|
|
||||||
if (File.Exists(binaryFilePath))
|
|
||||||
File.Delete(binaryFilePath);
|
|
||||||
CatalogTools.SerializeToBinary(binaryFilePath, buildinFileCatalog);
|
|
||||||
|
|
||||||
UnityEditor.AssetDatabase.Refresh();
|
|
||||||
Debug.Log($"Succeed to save buildin file catalog : {binaryFilePath}");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal class DBFSInitializeOperation : FSInitializeFileSystemOperation
|
|
||||||
{
|
|
||||||
private enum ESteps
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
CopyBuildinManifest,
|
|
||||||
InitUnpackFileSystem,
|
|
||||||
LoadCatalogFile,
|
|
||||||
Done,
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly DefaultBuildinFileSystem _fileSystem;
|
|
||||||
private CopyBuildinPackageManifestOperation _copyBuildinPackageManifestOp;
|
|
||||||
private FSInitializeFileSystemOperation _initUnpackFIleSystemOp;
|
|
||||||
private LoadBuildinCatalogFileOperation _loadCatalogFileOp;
|
|
||||||
private ESteps _steps = ESteps.None;
|
|
||||||
|
|
||||||
internal DBFSInitializeOperation(DefaultBuildinFileSystem fileSystem)
|
|
||||||
{
|
|
||||||
_fileSystem = fileSystem;
|
|
||||||
}
|
|
||||||
internal override void InternalStart()
|
|
||||||
{
|
|
||||||
#if UNITY_WEBGL
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = $"{nameof(DefaultBuildinFileSystem)} is not support WEBGL platform !";
|
|
||||||
#else
|
|
||||||
if (_fileSystem.CopyBuildinPackageManifest)
|
|
||||||
_steps = ESteps.CopyBuildinManifest;
|
|
||||||
else
|
|
||||||
_steps = ESteps.InitUnpackFileSystem;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
internal override void InternalUpdate()
|
|
||||||
{
|
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_steps == ESteps.CopyBuildinManifest)
|
|
||||||
{
|
|
||||||
if (_copyBuildinPackageManifestOp == null)
|
|
||||||
{
|
|
||||||
_copyBuildinPackageManifestOp = new CopyBuildinPackageManifestOperation(_fileSystem);
|
|
||||||
_copyBuildinPackageManifestOp.StartOperation();
|
|
||||||
AddChildOperation(_copyBuildinPackageManifestOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_copyBuildinPackageManifestOp.UpdateOperation();
|
|
||||||
if (_copyBuildinPackageManifestOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_copyBuildinPackageManifestOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.InitUnpackFileSystem;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _copyBuildinPackageManifestOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.InitUnpackFileSystem)
|
|
||||||
{
|
|
||||||
if (_initUnpackFIleSystemOp == null)
|
|
||||||
{
|
|
||||||
_initUnpackFIleSystemOp = _fileSystem.InitializeUpackFileSystem();
|
|
||||||
_initUnpackFIleSystemOp.StartOperation();
|
|
||||||
AddChildOperation(_initUnpackFIleSystemOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_initUnpackFIleSystemOp.UpdateOperation();
|
|
||||||
Progress = _initUnpackFIleSystemOp.Progress;
|
|
||||||
if (_initUnpackFIleSystemOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_initUnpackFIleSystemOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
if (_fileSystem.DisableCatalogFile)
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.LoadCatalogFile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _initUnpackFIleSystemOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.LoadCatalogFile)
|
|
||||||
{
|
|
||||||
if (_loadCatalogFileOp == null)
|
|
||||||
{
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
// 兼容性初始化
|
|
||||||
// 说明:内置文件系统在编辑器下运行时需要动态生成
|
|
||||||
string packageRoot = _fileSystem.FileRoot;
|
|
||||||
bool result = DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.PackageName, packageRoot);
|
|
||||||
if (result == false)
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = $"Create package catalog file failed ! See the detail error in console !";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_loadCatalogFileOp = new LoadBuildinCatalogFileOperation(_fileSystem);
|
|
||||||
_loadCatalogFileOp.StartOperation();
|
|
||||||
AddChildOperation(_loadCatalogFileOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_loadCatalogFileOp.UpdateOperation();
|
|
||||||
if (_loadCatalogFileOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_loadCatalogFileOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _loadCatalogFileOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal class DBFSLoadPackageManifestOperation : FSLoadPackageManifestOperation
|
|
||||||
{
|
|
||||||
private enum ESteps
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
RequestBuildinPackageHash,
|
|
||||||
LoadBuildinPackageManifest,
|
|
||||||
Done,
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly DefaultBuildinFileSystem _fileSystem;
|
|
||||||
private readonly string _packageVersion;
|
|
||||||
private RequestBuildinPackageHashOperation _requestBuildinPackageHashOp;
|
|
||||||
private LoadBuildinPackageManifestOperation _loadBuildinPackageManifestOp;
|
|
||||||
private ESteps _steps = ESteps.None;
|
|
||||||
|
|
||||||
|
|
||||||
public DBFSLoadPackageManifestOperation(DefaultBuildinFileSystem fileSystem, string packageVersion)
|
|
||||||
{
|
|
||||||
_fileSystem = fileSystem;
|
|
||||||
_packageVersion = packageVersion;
|
|
||||||
}
|
|
||||||
internal override void InternalStart()
|
|
||||||
{
|
|
||||||
_steps = ESteps.RequestBuildinPackageHash;
|
|
||||||
}
|
|
||||||
internal override void InternalUpdate()
|
|
||||||
{
|
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_steps == ESteps.RequestBuildinPackageHash)
|
|
||||||
{
|
|
||||||
if (_requestBuildinPackageHashOp == null)
|
|
||||||
{
|
|
||||||
_requestBuildinPackageHashOp = new RequestBuildinPackageHashOperation(_fileSystem, _packageVersion);
|
|
||||||
_requestBuildinPackageHashOp.StartOperation();
|
|
||||||
AddChildOperation(_requestBuildinPackageHashOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_requestBuildinPackageHashOp.UpdateOperation();
|
|
||||||
if (_requestBuildinPackageHashOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_requestBuildinPackageHashOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.LoadBuildinPackageManifest;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _requestBuildinPackageHashOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.LoadBuildinPackageManifest)
|
|
||||||
{
|
|
||||||
if (_loadBuildinPackageManifestOp == null)
|
|
||||||
{
|
|
||||||
string packageHash = _requestBuildinPackageHashOp.PackageHash;
|
|
||||||
_loadBuildinPackageManifestOp = new LoadBuildinPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
|
|
||||||
_loadBuildinPackageManifestOp.StartOperation();
|
|
||||||
AddChildOperation(_loadBuildinPackageManifestOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_loadBuildinPackageManifestOp.UpdateOperation();
|
|
||||||
if (_loadBuildinPackageManifestOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_loadBuildinPackageManifestOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Manifest = _loadBuildinPackageManifestOp.Manifest;
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _loadBuildinPackageManifestOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal class CopyBuildinPackageManifestOperation : AsyncOperationBase
|
|
||||||
{
|
|
||||||
private enum ESteps
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
RequestPackageVersion,
|
|
||||||
CheckHashFile,
|
|
||||||
UnpackHashFile,
|
|
||||||
CheckManifestFile,
|
|
||||||
UnpackManifestFile,
|
|
||||||
Done,
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly DefaultBuildinFileSystem _fileSystem;
|
|
||||||
private RequestBuildinPackageVersionOperation _requestBuildinPackageVersionOp;
|
|
||||||
private UnityWebFileRequestOperation _hashFileRequestOp;
|
|
||||||
private UnityWebFileRequestOperation _manifestFileRequestOp;
|
|
||||||
private string _buildinPackageVersion;
|
|
||||||
private ESteps _steps = ESteps.None;
|
|
||||||
|
|
||||||
public CopyBuildinPackageManifestOperation(DefaultBuildinFileSystem fileSystem)
|
|
||||||
{
|
|
||||||
_fileSystem = fileSystem;
|
|
||||||
}
|
|
||||||
internal override void InternalStart()
|
|
||||||
{
|
|
||||||
_steps = ESteps.RequestPackageVersion;
|
|
||||||
}
|
|
||||||
internal override void InternalUpdate()
|
|
||||||
{
|
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_steps == ESteps.RequestPackageVersion)
|
|
||||||
{
|
|
||||||
if (_requestBuildinPackageVersionOp == null)
|
|
||||||
{
|
|
||||||
_requestBuildinPackageVersionOp = new RequestBuildinPackageVersionOperation(_fileSystem);
|
|
||||||
_requestBuildinPackageVersionOp.StartOperation();
|
|
||||||
AddChildOperation(_requestBuildinPackageVersionOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_requestBuildinPackageVersionOp.UpdateOperation();
|
|
||||||
if (_requestBuildinPackageVersionOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_requestBuildinPackageVersionOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.CheckHashFile;
|
|
||||||
_buildinPackageVersion = _requestBuildinPackageVersionOp.PackageVersion;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _requestBuildinPackageVersionOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.CheckHashFile)
|
|
||||||
{
|
|
||||||
string hashFilePath = GetCopyPackageHashDestPath(_buildinPackageVersion);
|
|
||||||
if (File.Exists(hashFilePath))
|
|
||||||
{
|
|
||||||
_steps = ESteps.CheckManifestFile;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_steps = ESteps.UnpackHashFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.UnpackHashFile)
|
|
||||||
{
|
|
||||||
if (_hashFileRequestOp == null)
|
|
||||||
{
|
|
||||||
string sourcePath = _fileSystem.GetBuildinPackageHashFilePath(_buildinPackageVersion);
|
|
||||||
string destPath = GetCopyPackageHashDestPath(_buildinPackageVersion);
|
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
|
||||||
_hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
|
|
||||||
_hashFileRequestOp.StartOperation();
|
|
||||||
AddChildOperation(_hashFileRequestOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_hashFileRequestOp.UpdateOperation();
|
|
||||||
if (_hashFileRequestOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_hashFileRequestOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.CheckManifestFile;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _hashFileRequestOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.CheckManifestFile)
|
|
||||||
{
|
|
||||||
string manifestFilePath = GetCopyPackageManifestDestPath(_buildinPackageVersion);
|
|
||||||
if (File.Exists(manifestFilePath))
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_steps = ESteps.UnpackManifestFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_steps == ESteps.UnpackManifestFile)
|
|
||||||
{
|
|
||||||
if (_manifestFileRequestOp == null)
|
|
||||||
{
|
|
||||||
string sourcePath = _fileSystem.GetBuildinPackageManifestFilePath(_buildinPackageVersion);
|
|
||||||
string destPath = GetCopyPackageManifestDestPath(_buildinPackageVersion);
|
|
||||||
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
|
||||||
_manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
|
|
||||||
_manifestFileRequestOp.StartOperation();
|
|
||||||
AddChildOperation(_manifestFileRequestOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
_manifestFileRequestOp.UpdateOperation();
|
|
||||||
if (_manifestFileRequestOp.IsDone == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_manifestFileRequestOp.Status == EOperationStatus.Succeed)
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Status = EOperationStatus.Failed;
|
|
||||||
Error = _manifestFileRequestOp.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetCopyManifestFileRoot()
|
|
||||||
{
|
|
||||||
string destRoot = _fileSystem.CopyBuildinPackageManifestDestRoot;
|
|
||||||
if (string.IsNullOrEmpty(destRoot))
|
|
||||||
{
|
|
||||||
string defaultCacheRoot = YooAssetSettingsData.GetYooDefaultCacheRoot();
|
|
||||||
destRoot = PathUtility.Combine(defaultCacheRoot, _fileSystem.PackageName, DefaultCacheFileSystemDefine.ManifestFilesFolderName);
|
|
||||||
}
|
|
||||||
return destRoot;
|
|
||||||
}
|
|
||||||
private string GetCopyPackageHashDestPath(string packageVersion)
|
|
||||||
{
|
|
||||||
string fileRoot = GetCopyManifestFileRoot();
|
|
||||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, packageVersion);
|
|
||||||
return PathUtility.Combine(fileRoot, fileName);
|
|
||||||
}
|
|
||||||
private string GetCopyPackageManifestDestPath(string packageVersion)
|
|
||||||
{
|
|
||||||
string fileRoot = GetCopyManifestFileRoot();
|
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, packageVersion);
|
|
||||||
return PathUtility.Combine(fileRoot, fileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user