Compare commits

...

100 Commits

Author SHA1 Message Date
何冠峰
eabebf3d8f Update CHANGELOG.md 2025-05-13 10:47:59 +08:00
何冠峰
4ef789520a Update package.json 2025-05-13 10:47:49 +08:00
何冠峰
4322f3c58c fix #545 2025-05-13 10:23:22 +08:00
何冠峰
c40a796170 fix #542 2025-05-13 10:11:06 +08:00
何冠峰
32841d4773 Update AssetBundleDebuggerWindow.cs 2025-05-09 15:29:26 +08:00
何冠峰
e469b32d94 refactor: The tag diffusion logic in the collector
优化收集器tag传染扩散逻辑,避免Group里配置了Tag导致的无意义的警告信息。
2025-04-23 18:42:26 +08:00
何冠峰
c0e5315953 feat : Buld the pipeline output the log file.
构建管线输出构建日志到输出目录下。
2025-04-23 18:19:13 +08:00
何冠峰
7b5f366533 Build system add BuiltinShadersBundleNameIsNull ErrorCode 2025-04-23 16:56:03 +08:00
何冠峰
e674d5bf97 update extension sample
PanelMonitor增加控制开关
2025-04-23 16:39:07 +08:00
何冠峰
9b0bebd981 refactor : Macro scripts control by YOO_ASSET_EXPERIMENT 2025-04-23 16:38:17 +08:00
何冠峰
dc46462bfa fix : remove Caching class
it's not support in webGL
2025-04-23 14:14:34 +08:00
何冠峰
51c9943cf2 修复了输出csproject工程文件编码为UTF16的问题
修正BOM问题
2025-04-22 17:41:36 +08:00
何冠峰
3db9b750e3 update logo 2025-04-22 16:47:44 +08:00
何冠峰
1b57a0b7df 修复了输出csproject工程文件编码为UTF16的问题。 2025-04-22 16:47:33 +08:00
何冠峰
bd5ce1e6bd perf : webgl platform use crc verify the bundle when first time downloaded
WebGL平台首次下载会验证CRC。
2025-04-18 18:21:24 +08:00
何冠峰
7eb74d4dd1 update extension sample 2025-04-18 17:11:40 +08:00
何冠峰
a384ca1f18 feat : scriptable build pipeline add StripUnityVersion parameter.
新增构建参数
2025-04-18 16:48:03 +08:00
何冠峰
c7253a3f23 Update CHANGELOG.md 2025-04-17 19:02:59 +08:00
何冠峰
b296abb27e Update package.json 2025-04-17 19:02:57 +08:00
何冠峰
999ede6bab fix #534 2025-04-17 18:51:08 +08:00
何冠峰
bd1569c34d fix #533 2025-04-17 18:47:59 +08:00
何冠峰
3c265c1ab4 update extension sample 2025-04-17 15:38:07 +08:00
何冠峰
570a3a817c update space shooter 2025-04-17 15:16:05 +08:00
何冠峰
7a8f344927 update extension sample 2025-04-17 15:15:48 +08:00
何冠峰
b2c9cb3a7e update space shooter 2025-04-17 14:16:56 +08:00
何冠峰
06a5c90b23 update space shooter 2025-04-17 12:00:45 +08:00
何冠峰
dcd8ced42a update space shooter 2025-04-17 11:10:08 +08:00
何冠峰
76b31bd3cf update extension sample 2025-04-17 11:09:37 +08:00
何冠峰
009e8ece79 fix #528 #531 2025-04-15 14:20:32 +08:00
何冠峰
4e257ab27d fix #531 2025-04-09 11:39:42 +08:00
何冠峰
927400b669 refactor : EFileNameStyle move to runtime code 2025-04-08 14:28:52 +08:00
何冠峰
c0d42e79d8 refactor : DownloadParam rename DownloadFileOptions 2025-04-08 11:48:32 +08:00
何冠峰
b843c6b0ed refactor : add ClearCacheFilesOptions define 2025-04-08 11:34:46 +08:00
何冠峰
9fb7f8bbfe Update CHANGELOG.md 2025-04-01 14:20:52 +08:00
何冠峰
b0382afad0 Update package.json 2025-04-01 14:20:46 +08:00
何冠峰
1ab7689174 fix #524
新增初始化参数 BundleLoadingMaxConcurrency
2025-04-01 11:44:10 +08:00
何冠峰
29d456c065 fix #523 2025-04-01 10:22:01 +08:00
何冠峰
b0dc829b04 fix #515
资源路径大小写不敏感逻辑优化
2025-03-31 19:06:03 +08:00
何冠峰
b3ead90832 fix #526 2025-03-31 18:13:07 +08:00
何冠峰
7bf00d4ff6 update space shooter 2025-03-31 17:28:10 +08:00
何冠峰
030e94d8ff update test sample 2025-03-31 17:27:58 +08:00
何冠峰
cf05254121 fix #519
FileSystemParametersDefine新增参数:INSTALL_CLEAR_MODE
2025-03-31 17:26:46 +08:00
何冠峰
3f786bca3b Merge branch 'dev' of https://github.com/tuyoogame/YooAsset into dev 2025-03-26 15:12:04 +08:00
何冠峰
98719d212f Merge pull request #520 from SongQQQ/fix-UWPError
修复了UWP平台报错
2025-03-26 14:35:24 +08:00
SONG\11700
3409f7ce4d 修复了UWP平台报错 2025-03-26 12:07:59 +08:00
何冠峰
f57b354e9b fix : UWP平台的适配问题。
修复UWP平台获取WWW加载路径未适配的问题。
2025-03-26 11:45:50 +08:00
何冠峰
974493f88d Update CHANGELOG.md 2025-03-25 11:15:56 +08:00
何冠峰
69a69988a1 Update package.json 2025-03-25 11:15:24 +08:00
何冠峰
4e9c1955eb fix #486 2025-03-14 18:54:03 +08:00
何冠峰
b6c68a533e update asset bundle builder
增加TaskCreateCatalog任务节点
2025-03-14 18:49:56 +08:00
何冠峰
38aa1c3509 update file system 2025-03-14 18:26:04 +08:00
何冠峰
eb2f783417 update resource package 2025-03-14 17:23:55 +08:00
何冠峰
8556e071fa fix #507 2025-03-14 16:50:48 +08:00
何冠峰
6155256fb6 Update CHANGELOG.md 2025-03-14 14:48:16 +08:00
何冠峰
0d4f2bc893 Update package.json 2025-03-14 14:47:39 +08:00
何冠峰
600e928ab4 fix #512 2025-03-14 14:32:39 +08:00
何冠峰
4599ff098c update resource package
优化ClearCacheFilesAsync方法
2025-03-14 12:27:01 +08:00
何冠峰
4d2df5b705 Update TestBundleEncryption.cs 2025-03-13 16:29:48 +08:00
何冠峰
79a7732cfd Update InitializeParameters.cs 2025-03-13 14:00:59 +08:00
何冠峰
79467bbf13 update editor assembly 2025-03-12 18:32:28 +08:00
何冠峰
c7d678282b Merge pull request #501 from Y-way/support-macros
Update MacrosProcessor.cs
2025-03-12 17:17:47 +08:00
何冠峰
d376afc217 fix #508 2025-03-12 17:16:24 +08:00
何冠峰
a62f808591 fix #506 2025-03-12 16:36:37 +08:00
何冠峰
b334a4986b fix #504 2025-03-12 10:39:44 +08:00
何冠峰
a4111349a0 fix #502 2025-03-11 15:40:57 +08:00
Y-way
bdcf95384f Update .gitignore 2025-03-10 16:13:18 +08:00
Y-way
d910af589d Update MacrosProcessor.cs
修正YooAsset相关宏在引用库不能生效的问题.
2025-03-10 15:22:44 +08:00
何冠峰
0531864534 Update package.json 2025-03-10 10:29:44 +08:00
何冠峰
72b1278f5c Merge pull request #499 from benjamini258369gmail/fix-rawIgnore-dll
fix ignore raw dll
2025-03-10 10:27:13 +08:00
benjamini
875cd24cba fix ignore raw dll 2025-03-08 17:54:11 +09:00
何冠峰
fcc729a0bf Update CHANGELOG.md 2025-03-08 15:53:46 +08:00
何冠峰
d10e54248b Update package.json 2025-03-08 15:53:35 +08:00
何冠峰
b84800a905 update assembly 2025-03-08 15:51:27 +08:00
何冠峰
8ccd7e552c fix #498 2025-03-08 15:41:03 +08:00
何冠峰
772ba484eb Update HandleFactory.cs 2025-03-08 15:01:19 +08:00
何冠峰
cdbedee705 update asmdef
YooAsset版本宏定义
2025-03-08 14:34:41 +08:00
何冠峰
10cce48e71 Merge pull request #497 from Y-way/support-macros
Support DefineConstants for YooAsset Package
2025-03-08 12:05:07 +08:00
何冠峰
13e8410d80 fix #389 2025-03-08 11:50:35 +08:00
何冠峰
6f07faf4da fix #495 2025-03-08 11:24:17 +08:00
何冠峰
e3228d406e update resource manager
优化Handle生成和移除逻辑
2025-03-08 10:58:19 +08:00
何冠峰
daf2133535 fix #496 2025-03-07 15:03:13 +08:00
Y-way
9bcbc10862 Support DefineConstants for YooAsset Package
自定义YOO_VERSION_2  以及版本管理宏,用于YooAsset升级时的宏定义处理
2025-03-07 15:00:20 +08:00
何冠峰
e6958d205e Update CHANGELOG.md 2025-03-06 15:05:52 +08:00
何冠峰
b03d9db2b0 Update package.json 2025-03-06 15:05:39 +08:00
何冠峰
30853b6d62 update space shooter 2025-03-06 14:31:40 +08:00
何冠峰
a7cafcb328 update UIElements
展示单位Units
2025-03-06 14:31:26 +08:00
何冠峰
d03bca5512 update asset bundle debugger 2025-03-06 12:20:45 +08:00
何冠峰
af3fc50188 update UIElements 2025-03-06 12:20:13 +08:00
何冠峰
b71eeeb855 update UIElements 2025-03-06 11:45:51 +08:00
何冠峰
317c42521a update test sample 2025-03-06 11:39:26 +08:00
何冠峰
064d69269e Update PakcageInvokeBuildParam.cs 2025-03-06 11:17:20 +08:00
何冠峰
9e6401d3c0 update space shooter 2025-03-06 11:17:00 +08:00
何冠峰
2aaba328ee fix #488 2025-03-06 11:16:21 +08:00
何冠峰
62fdc93a82 update test sample 2025-03-06 10:55:54 +08:00
何冠峰
408f0942ee update test sample 2025-03-05 20:00:02 +08:00
何冠峰
ddda9e29db fix #491 2025-03-05 17:39:33 +08:00
何冠峰
c2b33f5ec4 fix #492 2025-03-05 17:29:52 +08:00
何冠峰
e58999e484 update asset bundle debugger 2025-03-05 17:26:58 +08:00
何冠峰
ed9692574c Update AssetBundleSimulateBuilder.cs
模拟构建默认启用依赖关系数据库
2025-03-05 10:54:33 +08:00
何冠峰
f7e078e064 update file system 2025-03-05 10:54:02 +08:00
278 changed files with 4603 additions and 891 deletions

2
.gitignore vendored
View File

@@ -20,6 +20,8 @@
/Assets/StreamingAssets.meta /Assets/StreamingAssets.meta
/Assets/Samples /Assets/Samples
/Assets/Samples.meta /Assets/Samples.meta
/Assets/csc.rsp
/Assets/csc.rsp.meta
/UserSettings /UserSettings

View File

@@ -2,6 +2,176 @@
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.9] - 2025-05-13
### Improvements
- 增加了YOO_ASSET_EXPERIMENT宏用于控制实验性代码的开关。
- 构建管线目前会输出构建日志到输出目录下,方便查看引擎在构建时主动清空的控制台日志。
- 优化了收集器tag传染扩散逻辑避免Group里配置了Tag导致的无意义的警告信息。
- 扩展工程内PanelMonitor代码默认关闭状态。
### Fixed
- (#528) 修复了AssetDependencyDatabase在查询引擎资源对象是否存在的时效问题。
### Added
- (#542) 新增了资源管理系统销毁方法。
该方法会销毁所有的资源包裹和异步操作任务以及卸载所有AssetBundle对象
```csharp
public class YooAssets
{
/// <summary>
/// 销毁资源系统
/// </summary>
public static void Destroy();
}
```
- 新增了SBP构建管线的构建参数
```csharp
/// <summary>
/// 从AssetBundle文件头里剥离Unity版本信息
/// </summary>
public bool StripUnityVersion = false;
```
- 新增了构建错误码BuiltinShadersBundleNameIsNull
## [2.3.8] - 2025-04-17
### Improvements
- 扩展工程里增加了“图集丢失变白块的解决方案”的相关代码。
### Fixed
- (#528) 修复了微信小游戏平台WXFSClearUnusedBundleFiles无法清理的问题。
- (#531) 修复了微信小游戏平台WXFSClearUnusedBundleFiles没有适配BundleName_HashName命名方式。
- (#533) 修复了Editor程序集下无法访问YooAsset.Editor程序集里的internal字段的问题。
- (#534) 修复了资源报告窗口AssetView视图里依赖资源包列表显示不准确的问题。
## [2.3.7] - 2025-04-01
### Improvements
- (#526) 运行时资源清单的哈希值验证兼容了MD5和CRC32两种方式。
- (#515) 优化了资源路径大小写不敏感的逻辑代码减少字符串操作产生的GC。
- (#523) UnloadUnusedAssetsOperation方法支持了分帧处理。
### Fixed
- (#520) 修复了UWP平台获取WWW加载路径未适配的问题。
### Added
- 新增了文件系统初始化参数INSTALL_CLEAR_MODE
```csharp
/// <summary>
/// 覆盖安装清理模式
/// </summary>
public enum EOverwriteInstallClearMode
{
/// <summary>
/// 不做任何处理
/// </summary>
None = 0,
/// <summary>
/// 清理所有缓存文件(包含资源文件和清单文件)
/// </summary>
ClearAllCacheFiles = 1,
/// <summary>
/// 清理所有缓存的资源文件
/// </summary>
ClearAllBundleFiles = 2,
/// <summary>
/// 清理所有缓存的清单文件
/// </summary>
ClearAllManifestFiles = 3,
}
```
- 新增了初始化参数BundleLoadingMaxConcurrency
```csharp
public abstract class InitializeParameters
{
/// <summary>
/// 同时加载Bundle文件的最大并发数
/// </summary>
public int BundleLoadingMaxConcurrency = int.MaxValue;
}
```
## [2.3.6] - 2025-03-25
### Improvements
- 构建管线新增了TaskCreateCatalog任务节点。
- 内置文件系统的catalog文件现在存储在streammingAssets目录下。
### Fixed
- (#486) 修复了微信小游戏文件系统调用ClearUnusedBundleFiles时候的异常。
## [2.3.5-preview] - 2025-03-14
### Fixed
- (#502) 修复了原生缓存文件由于文件格式变动导致的加载本地缓存文件失败的问题。
- (#504) 修复了MacOS平台Offline Play Mode模式请求本地资源清单失败的问题。
- (#506) 修复了v2.3x版本LoadAllAssets方法计算依赖Bundle不完整的问题。
- (#506) 修复了微信小游戏文件系统在启用加密算法后卸载bundle报错的问题。
## [2.3.4-preview] - 2025-03-08
### Improvements
- YooAsset支持了版本宏定义。
```csharp
YOO_ASSET_2
YOO_ASSET_2_3
YOO_ASSET_2_3_OR_NEWER
```
### Fixed
- (#389) 修复了禁用域重载(Reload Domain)的情况下,再次启动游戏报错的问题。
- (#496) 修复了文件系统参数RESUME_DOWNLOAD_MINMUM_SIZE传入int值会导致异常的错误。
- (#498) 修复了v2.3版本尝试加载安卓包内的原生资源包失败的问题。
### Added
- 新增了YooAssets.GetAllPackages()方法
```csharp
/// <summary>
/// 获取所有资源包裹
/// </summary>
public static List<ResourcePackage> GetAllPackages()
```
## [2.3.3-preview] - 2025-03-06
### Improvements
- 新增了异步操作任务调试器AssetBundleDebugger窗口-->OperationView视图模式
- 编辑器下模拟构建默认启用依赖关系数据库,可以大幅降低编辑器下启动游戏的时间。
- 单元测试用例增加加密解密测试用例。
### Fixed
- (#492) 修复了发布的MAC平台应用在启动的时候提示权限无法获取的问题。
## [2.3.2-preview] - 2025-02-27 ## [2.3.2-preview] - 2025-02-27
### Fixed ### Fixed

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fab3cd742c11be2479b07f5d447a78c9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,5 @@
using System.Runtime.CompilerServices;
// 外部友元
[assembly: InternalsVisibleTo("YooAsset.EditorExtension")]
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor")]

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 88e4ec854876f3f40bce38bc880c0f6a guid: ef774f01e50ab0a4d88122041938a6b9
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@@ -0,0 +1,19 @@
using System.Collections.Generic;
#if YOO_ASSET_EXPERIMENT
namespace YooAsset.Editor
{
public class MacroDefine
{
/// <summary>
/// YooAsset版本宏定义
/// </summary>
public static readonly List<string> Macros = new List<string>()
{
"YOO_ASSET_2",
"YOO_ASSET_2_3",
"YOO_ASSET_2_3_OR_NEWER",
};
}
}
#endif

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 07f7c95e8e42fd04f81b9925b2dcf0d0 guid: a61e5c2ca04aab647b1ed0492086aa8f
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@@ -0,0 +1,106 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using UnityEditor;
#if YOO_ASSET_EXPERIMENT
namespace YooAsset.Editor
{
[InitializeOnLoad]
public class MacroProcessor : AssetPostprocessor
{
static string OnGeneratedCSProject(string path, string content)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(content);
if (IsCSProjectReferenced(xmlDoc.DocumentElement) == false)
return content;
if (ProcessDefineConstants(xmlDoc.DocumentElement) == false)
return content;
// 将修改后的XML结构重新输出为文本
using (var memoryStream = new MemoryStream())
{
var writerSettings = new XmlWriterSettings
{
Indent = true,
Encoding = new UTF8Encoding(false), //无BOM
OmitXmlDeclaration = false
};
using (var xmlWriter = XmlWriter.Create(memoryStream, writerSettings))
{
xmlDoc.Save(xmlWriter);
}
return Encoding.UTF8.GetString(memoryStream.ToArray());
}
}
/// <summary>
/// 处理宏定义
/// </summary>
private static bool ProcessDefineConstants(XmlElement element)
{
if (element == null)
return false;
bool processed = false;
foreach (XmlNode node in element.ChildNodes)
{
if (node.Name != "PropertyGroup")
continue;
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.Name != "DefineConstants")
continue;
string[] defines = childNode.InnerText.Split(';');
HashSet<string> hashSets = new HashSet<string>(defines);
foreach (string yooMacro in MacroDefine.Macros)
{
string tmpMacro = yooMacro.Trim();
if (hashSets.Contains(tmpMacro) == false)
hashSets.Add(tmpMacro);
}
childNode.InnerText = string.Join(";", hashSets.ToArray());
processed = true;
}
}
return processed;
}
/// <summary>
/// 检测工程是否引用了YooAsset
/// </summary>
private static bool IsCSProjectReferenced(XmlElement element)
{
if (element == null)
return false;
foreach (XmlNode node in element.ChildNodes)
{
if (node.Name != "ItemGroup")
continue;
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.Name != "Reference" && childNode.Name != "ProjectReference")
continue;
string include = childNode.Attributes["Include"].Value;
if (include.Contains("YooAsset"))
return true;
}
}
return false;
}
}
}
#endif

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 56ea224b45d314e4a86b558404e9b6c8 guid: 88d5a41d078a82e40b82265ed4c3631a
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@@ -0,0 +1,115 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using UnityEditor;
using UnityEngine;
#if YOO_ASSET_EXPERIMENT
namespace YooAsset.Editor.Experiment
{
[InitializeOnLoad]
public class RspGenerator
{
// csc.rsp文件路径
private static string RspFilePath => Path.Combine(Application.dataPath, "csc.rsp");
static RspGenerator()
{
UpdateRspFile(MacroDefine.Macros, null);
}
/// <summary>
/// 更新csc.rsp文件
/// </summary>
private static void UpdateRspFile(List<string> addMacros, List<string> removeMacros)
{
var existingDefines = new HashSet<string>();
var otherLines = new List<string>();
// 1. 读取现有内容
ReadRspFile(existingDefines, otherLines);
// 2. 添加新宏
if (addMacros != null && addMacros.Count > 0)
{
addMacros.ForEach(x =>
{
if (existingDefines.Contains(x) == false)
existingDefines.Add(x);
});
}
// 3. 移除指定宏
if (removeMacros != null && removeMacros.Count > 0)
{
removeMacros.ForEach(x =>
{
existingDefines.Remove(x);
});
}
// 4. 重新生成内容
WriteRspFile(existingDefines, otherLines);
// 5. 刷新AssetDatabase
AssetDatabase.Refresh();
EditorUtility.RequestScriptReload();
}
/// <summary>
/// 读取csc.rsp文件,返回宏定义和其他行
/// </summary>
private static void ReadRspFile(HashSet<string> defines, List<string> others)
{
if (defines == null)
defines = new HashSet<string>();
if (others == null)
others = new List<string>();
if (File.Exists(RspFilePath) == false)
return;
foreach (string line in File.ReadAllLines(RspFilePath))
{
if (line.StartsWith("-define:"))
{
string[] parts = line.Split(new[] { ':' }, 2);
if (parts.Length == 2)
{
defines.Add(parts[1].Trim());
}
}
else
{
others.Add(line);
}
}
}
/// <summary>
/// 重新写入csc.rsp文件
/// </summary>
private static void WriteRspFile(HashSet<string> defines, List<string> others)
{
StringBuilder sb = new StringBuilder();
if (others != null && others.Count > 0)
{
others.ForEach(o => sb.AppendLine(o));
}
if (defines != null && defines.Count > 0)
{
foreach (string define in defines)
{
sb.AppendLine($"-define:{define}");
}
}
File.WriteAllText(RspFilePath, sb.ToString());
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c2662e1d33b1eea469695b68d18b1739
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -97,7 +97,7 @@ namespace YooAsset.Editor
private Button _passesVisibleBtn; private Button _passesVisibleBtn;
private Label _titleLabel; private Label _titleLabel;
private Label _descLabel; private Label _descLabel;
private TableView _elementTableView; private TableViewer _elementTableView;
private ScanReportCombiner _reportCombiner; private ScanReportCombiner _reportCombiner;
private string _lastestOpenFolder; private string _lastestOpenFolder;
@@ -152,7 +152,7 @@ namespace YooAsset.Editor
_descLabel = root.Q<Label>("ReportDesc"); _descLabel = root.Q<Label>("ReportDesc");
// 列表相关 // 列表相关
_elementTableView = root.Q<TableView>("TopTableView"); _elementTableView = root.Q<TableViewer>("TopTableView");
_elementTableView.ClickTableDataEvent = OnClickTableViewItem; _elementTableView.ClickTableDataEvent = OnClickTableViewItem;
_lastestOpenFolder = EditorTools.GetProjectPath(); _lastestOpenFolder = EditorTools.GetProjectPath();
@@ -441,6 +441,8 @@ namespace YooAsset.Editor
columnStyle.Stretchable = header.Stretchable; columnStyle.Stretchable = header.Stretchable;
columnStyle.Searchable = header.Searchable; columnStyle.Searchable = header.Searchable;
columnStyle.Sortable = header.Sortable; columnStyle.Sortable = header.Sortable;
columnStyle.Counter = header.Counter;
columnStyle.Units = header.Units;
var column = new TableColumn(header.HeaderTitle, header.HeaderTitle, columnStyle); var column = new TableColumn(header.HeaderTitle, header.HeaderTitle, columnStyle);
column.MakeCell = () => column.MakeCell = () =>
{ {

View File

@@ -17,6 +17,6 @@
<ui:Button text="显示白名单元素" display-tooltip-when-elided="true" name="WhiteListVisibleButton" style="width: 100px;" /> <ui:Button text="显示白名单元素" display-tooltip-when-elided="true" name="WhiteListVisibleButton" style="width: 100px;" />
</uie:Toolbar> </uie:Toolbar>
<ui:VisualElement name="AssetGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="AssetGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<YooAsset.Editor.TableView name="TopTableView" /> <YooAsset.Editor.TableViewer name="TopTableView" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@@ -43,6 +43,16 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public bool Sortable = false; public bool Sortable = false;
/// <summary>
/// 统计数量
/// </summary>
public bool Counter = false;
/// <summary>
/// 展示单位
/// </summary>
public string Units = string.Empty;
/// <summary> /// <summary>
/// 数值类型 /// 数值类型
/// </summary> /// </summary>
@@ -89,6 +99,16 @@ namespace YooAsset.Editor
Sortable = true; Sortable = true;
return this; return this;
} }
public ReportHeader SetCounter()
{
Counter = true;
return this;
}
public ReportHeader SetUnits(string units)
{
Units = units;
return this;
}
public ReportHeader SetHeaderType(EHeaderType value) public ReportHeader SetHeaderType(EHeaderType value)
{ {
HeaderType = value; HeaderType = value;

View File

@@ -32,8 +32,9 @@ namespace YooAsset.Editor
var buildParametersContext = new BuildParametersContext(buildParameters); var buildParametersContext = new BuildParametersContext(buildParameters);
_buildContext.SetContextObject(buildParametersContext); _buildContext.SetContextObject(buildParametersContext);
// 初始化日志 // 初始化日志系统
BuildLogger.InitLogger(enableLog); string logFilePath = $"{buildParametersContext.GetPipelineOutputDirectory()}/buildInfo.log";
BuildLogger.InitLogger(enableLog, logFilePath);
// 执行构建流程 // 执行构建流程
BuildLogger.Log($"Begin to build package : {buildParameters.PackageName} by {buildParameters.BuildPipeline}"); BuildLogger.Log($"Begin to build package : {buildParameters.PackageName} by {buildParameters.BuildPipeline}");
@@ -50,6 +51,9 @@ namespace YooAsset.Editor
BuildLogger.Error(buildResult.ErrorInfo); BuildLogger.Error(buildResult.ErrorInfo);
} }
// 关闭日志系统
BuildLogger.Shuntdown();
return buildResult; return buildResult;
} }
} }

View File

@@ -26,6 +26,7 @@ namespace YooAsset.Editor
buildParameters.FileNameStyle = EFileNameStyle.HashName; buildParameters.FileNameStyle = EFileNameStyle.HashName;
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None; buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
buildParameters.BuildinFileCopyParams = string.Empty; buildParameters.BuildinFileCopyParams = string.Empty;
buildParameters.UseAssetDependencyDB = true;
var pipeline = new EditorSimulateBuildPipeline(); var pipeline = new EditorSimulateBuildPipeline();
BuildResult buildResult = pipeline.Run(buildParameters, false); BuildResult buildResult = pipeline.Run(buildParameters, false);

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
namespace YooAsset.Editor
{
public class TaskCreateCatalog
{
/// <summary>
/// 生成内置资源记录文件
/// </summary>
internal void CreateCatalogFile(BuildParametersContext buildParametersContext)
{
string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
string buildPackageName = buildParametersContext.Parameters.PackageName;
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(buildPackageName, buildinRootDirectory);
// 刷新目录
AssetDatabase.Refresh();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d2c835e5e40ca34d93480587c8125df
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -30,7 +30,7 @@ namespace YooAsset.Editor
// 创建新补丁清单 // 创建新补丁清单
PackageManifest manifest = new PackageManifest(); PackageManifest manifest = new PackageManifest();
manifest.FileVersion = YooAssetSettings.ManifestFileVersion; manifest.FileVersion = ManifestDefine.FileVersion;
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable; manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
manifest.LocationToLower = buildMapContext.Command.LocationToLower; manifest.LocationToLower = buildMapContext.Command.LocationToLower;
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID; manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace YooAsset.Editor
{
public class TaskCreateCatalog_BBP : TaskCreateCatalog, IBuildTask
{
void IBuildTask.Run(BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
{
CreateCatalogFile(buildParametersContext);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8fe3d00b03dc9c64a96b7acfdf99b54c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -36,6 +36,7 @@ namespace YooAsset.Editor
new TaskCreateReport_BBP(), new TaskCreateReport_BBP(),
new TaskCreatePackage_BBP(), new TaskCreatePackage_BBP(),
new TaskCopyBuildinFiles_BBP(), new TaskCopyBuildinFiles_BBP(),
new TaskCreateCatalog_BBP()
}; };
return pipeline; return pipeline;
} }

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace YooAsset.Editor
{
public class TaskCreateCatalog_RFBP : TaskCreateCatalog, IBuildTask
{
void IBuildTask.Run(BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
{
CreateCatalogFile(buildParametersContext);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 563771ecaff17ee498b5fda7c1132e62
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -38,6 +38,7 @@ namespace YooAsset.Editor
new TaskCreateReport_RFBP(), new TaskCreateReport_RFBP(),
new TaskCreatePackage_RFBP(), new TaskCreatePackage_RFBP(),
new TaskCopyBuildinFiles_RFBP(), new TaskCopyBuildinFiles_RFBP(),
new TaskCreateCatalog_RFBP()
}; };
return pipeline; return pipeline;
} }

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace YooAsset.Editor
{
public class TaskCreateCatalog_SBP : TaskCreateCatalog, IBuildTask
{
void IBuildTask.Run(BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
{
CreateCatalogFile(buildParametersContext);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d8241b1eb8e22874b84d279dae9bbd1b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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>();
var buildParameters = buildParametersContext.Parameters; var buildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
// 检测基础构建参数 // 检测基础构建参数
buildParametersContext.CheckBuildParameters(); buildParametersContext.CheckBuildParameters();
@@ -50,6 +50,13 @@ namespace YooAsset.Editor
{ {
BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}"); BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}");
} }
// 检测内置着色器资源包名称
if (string.IsNullOrEmpty(buildParameters.BuiltinShadersBundleName))
{
string warning = BuildLogger.GetErrorMessage(ErrorCode.BuiltinShadersBundleNameIsNull, $"Builtin shaders bundle name is null. It will cause resource redundancy !");
BuildLogger.Warning(warning);
}
} }
} }
} }

View File

@@ -14,6 +14,11 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public ECompressOption CompressOption = ECompressOption.Uncompressed; public ECompressOption CompressOption = ECompressOption.Uncompressed;
/// <summary>
/// 从AssetBundle文件头里剥离Unity版本信息
/// </summary>
public bool StripUnityVersion = false;
/// <summary> /// <summary>
/// 禁止写入类型树结构(可以降低包体和内存并提高加载效率) /// 禁止写入类型树结构(可以降低包体和内存并提高加载效率)
/// </summary> /// </summary>
@@ -70,6 +75,9 @@ namespace YooAsset.Editor
else else
throw new System.NotImplementedException(CompressOption.ToString()); throw new System.NotImplementedException(CompressOption.ToString());
if (StripUnityVersion)
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.StripUnityVersion;
if (DisableWriteTypeTree) if (DisableWriteTypeTree)
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.DisableWriteTypeTree; buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.DisableWriteTypeTree;

View File

@@ -36,6 +36,7 @@ namespace YooAsset.Editor
new TaskCreateReport_SBP(), new TaskCreateReport_SBP(),
new TaskCreatePackage_SBP(), new TaskCreatePackage_SBP(),
new TaskCopyBuildinFiles_SBP(), new TaskCopyBuildinFiles_SBP(),
new TaskCreateCatalog_SBP()
}; };
return pipeline; return pipeline;
} }

View File

@@ -2,37 +2,100 @@
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using System.Text;
namespace YooAsset.Editor namespace YooAsset.Editor
{ {
internal static class BuildLogger internal static class BuildLogger
{ {
private static bool _enableLog = true; private const int MAX_LOG_BUFFER_SIZE = 1024 * 1024 * 2; //2MB
public static void InitLogger(bool enableLog) private static bool _enableLog = true;
private static string _logFilePath;
private static readonly object _lockObj = new object();
private static readonly StringBuilder _logBuilder = new StringBuilder(MAX_LOG_BUFFER_SIZE);
/// <summary>
/// 初始化日志系统
/// </summary>
public static void InitLogger(bool enableLog, string logFilePath)
{ {
_enableLog = enableLog; _enableLog = enableLog;
_logFilePath = logFilePath;
_logBuilder.Clear();
if (_enableLog)
{
if (string.IsNullOrEmpty(_logFilePath))
throw new Exception("Log file path is null or empty !");
Debug.Log($"Logger initialized at {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
}
}
/// <summary>
/// 关闭日志系统
/// </summary>
public static void Shuntdown()
{
if (_enableLog)
{
lock (_lockObj)
{
try
{
if (File.Exists(_logFilePath))
File.Delete(_logFilePath);
FileUtility.CreateFileDirectory(_logFilePath);
File.WriteAllText(_logFilePath, _logBuilder.ToString(), Encoding.UTF8);
_logBuilder.Clear();
}
catch (Exception ex)
{
Debug.LogError($"Failed to write log file: {ex.Message}");
}
}
}
} }
public static void Log(string message) public static void Log(string message)
{ {
if (_enableLog) if (_enableLog)
{ {
WriteLog("INFO", message);
Debug.Log(message); Debug.Log(message);
} }
} }
public static void Warning(string message) public static void Warning(string message)
{ {
Debug.LogWarning(message); if (_enableLog)
{
WriteLog("WARN", message);
Debug.LogWarning(message);
}
} }
public static void Error(string message) public static void Error(string message)
{ {
Debug.LogError(message); if (_enableLog)
{
WriteLog("ERROR", message);
Debug.LogError(message);
}
} }
public static string GetErrorMessage(ErrorCode code, string message) public static string GetErrorMessage(ErrorCode code, string message)
{ {
return $"[ErrorCode{(int)code}] {message}"; return $"[ErrorCode{(int)code}] {message}";
} }
private static void WriteLog(string level, string message)
{
lock (_lockObj)
{
string logEntry = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} [{level}] {message}";
_logBuilder.AppendLine(logEntry);
}
}
} }
} }

View File

@@ -15,6 +15,7 @@ namespace YooAsset.Editor
BuildPipelineIsNullOrEmpty = 116, BuildPipelineIsNullOrEmpty = 116,
BuildBundleTypeIsUnknown = 117, BuildBundleTypeIsUnknown = 117,
RecommendScriptBuildPipeline = 130, RecommendScriptBuildPipeline = 130,
BuiltinShadersBundleNameIsNull = 131,
// TaskGetBuildMap // TaskGetBuildMap
RemoveInvalidTags = 200, RemoveInvalidTags = 200,

View File

@@ -259,10 +259,13 @@ namespace YooAsset.Editor
} }
private List<string> GetAssetTags(AssetBundleCollectorGroup group) private List<string> GetAssetTags(AssetBundleCollectorGroup group)
{ {
List<string> tags = EditorTools.StringToStringList(group.AssetTags, ';'); List<string> result = EditorTools.StringToStringList(AssetTags, ';');
List<string> temper = EditorTools.StringToStringList(AssetTags, ';'); if (CollectorType == ECollectorType.MainAssetCollector)
tags.AddRange(temper); {
return tags; List<string> temps = EditorTools.StringToStringList(group.AssetTags, ';');
result.AddRange(temps);
}
return result;
} }
private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath) private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath)
{ {

View File

@@ -70,7 +70,7 @@ namespace YooAsset.Editor
foreach (var cacheInfoPair in _database) foreach (var cacheInfoPair in _database)
{ {
var assetPath = cacheInfoPair.Key; var assetPath = cacheInfoPair.Key;
var assetGUID = AssetDatabase.AssetPathToGUID(assetPath); var assetGUID = AssetDatabase.AssetPathToGUID(assetPath, AssetPathToGUIDOptions.OnlyExistingAssets);
if (string.IsNullOrEmpty(assetGUID)) if (string.IsNullOrEmpty(assetGUID))
{ {
removeList.Add(assetPath); removeList.Add(assetPath);

View File

@@ -10,7 +10,7 @@ namespace YooAsset.Editor
/// <summary> /// <summary>
/// 忽略的文件类型 /// 忽略的文件类型
/// </summary> /// </summary>
public readonly static HashSet<string> IgnoreFileExtensions = new HashSet<string>() { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" }; public readonly static HashSet<string> IgnoreFileExtensions = new HashSet<string>() { "", ".so", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
} }
/// <summary> /// <summary>

View File

@@ -59,6 +59,10 @@ namespace YooAsset.Editor
private string _searchKeyWord; private string _searchKeyWord;
private DebugReport _currentReport; private DebugReport _currentReport;
private RemotePlayerSession _currentPlayerSession; private RemotePlayerSession _currentPlayerSession;
private double _lastRepaintTime = 0;
private int _nextRepaintIndex = -1;
private int _lastRepaintIndex = 0;
private int _rangeIndex = 0; private int _rangeIndex = 0;
@@ -161,6 +165,19 @@ namespace YooAsset.Editor
RemoteEditorConnection.Instance.Unregister(RemoteDebuggerDefine.kMsgPlayerSendToEditor); RemoteEditorConnection.Instance.Unregister(RemoteDebuggerDefine.kMsgPlayerSendToEditor);
_playerSessions.Clear(); _playerSessions.Clear();
} }
public void Update()
{
// 每间隔1秒绘制一次页面
if (EditorApplication.timeSinceStartup - _lastRepaintTime > 1f)
{
_lastRepaintTime = EditorApplication.timeSinceStartup;
if (_nextRepaintIndex >= 0)
{
RepaintFrame(_nextRepaintIndex);
_nextRepaintIndex = -1;
}
}
}
private void OnHandleConnectionEvent(int playerId) private void OnHandleConnectionEvent(int playerId)
{ {
@@ -174,21 +191,27 @@ namespace YooAsset.Editor
} }
private void OnHandlePlayerMessage(MessageEventArgs args) private void OnHandlePlayerMessage(MessageEventArgs args)
{ {
var debugReport = DebugReport.Deserialize(args.data);
int playerId = args.playerId; int playerId = args.playerId;
Debug.Log($"Handle player {playerId} debug report !"); var debugReport = DebugReport.Deserialize(args.data);
if (debugReport.DebuggerVersion != RemoteDebuggerDefine.DebuggerVersion)
{
Debug.LogWarning($"Debugger versions are inconsistent : {debugReport.DebuggerVersion} != {RemoteDebuggerDefine.DebuggerVersion}");
return;
}
//Debug.Log($"Handle player {playerId} debug report !");
_currentPlayerSession = GetOrCreatePlayerSession(playerId); _currentPlayerSession = GetOrCreatePlayerSession(playerId);
_currentPlayerSession.AddDebugReport(debugReport); _currentPlayerSession.AddDebugReport(debugReport);
_frameSlider.highValue = _currentPlayerSession.MaxRangeValue; _nextRepaintIndex = _currentPlayerSession.MaxRangeValue;
_frameSlider.value = _currentPlayerSession.MaxRangeValue;
UpdateFrameView(_currentPlayerSession);
} }
private void OnFrameSliderChange(int sliderValue) private void OnFrameSliderChange(int sliderValue)
{ {
if (_currentPlayerSession != null) if (_currentPlayerSession != null)
{ {
_rangeIndex = _currentPlayerSession.ClampRangeIndex(sliderValue); ; _rangeIndex = _currentPlayerSession.ClampRangeIndex(sliderValue); ;
UpdateFrameView(_currentPlayerSession, _rangeIndex); RepaintFrame(_rangeIndex);
} }
} }
private void OnFrameLast_clicked() private void OnFrameLast_clicked()
@@ -197,7 +220,7 @@ namespace YooAsset.Editor
{ {
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex - 1); _rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex - 1);
_frameSlider.value = _rangeIndex; _frameSlider.value = _rangeIndex;
UpdateFrameView(_currentPlayerSession, _rangeIndex); RepaintFrame(_rangeIndex);
} }
} }
private void OnFrameNext_clicked() private void OnFrameNext_clicked()
@@ -206,21 +229,26 @@ namespace YooAsset.Editor
{ {
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex + 1); _rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex + 1);
_frameSlider.value = _rangeIndex; _frameSlider.value = _rangeIndex;
UpdateFrameView(_currentPlayerSession, _rangeIndex); RepaintFrame(_rangeIndex);
} }
} }
private void OnFrameClear_clicked() private void OnFrameClear_clicked()
{ {
_nextRepaintIndex = -1;
_lastRepaintIndex = 0;
_rangeIndex = 0;
_frameSlider.label = $"Frame:";
_frameSlider.value = 0;
_frameSlider.lowValue = 0;
_frameSlider.highValue = 0;
_assetListViewer.ClearView();
_bundleListViewer.ClearView();
_operationListViewer.ClearView();
if (_currentPlayerSession != null) if (_currentPlayerSession != null)
{ {
_frameSlider.label = $"Frame:";
_frameSlider.value = 0;
_frameSlider.lowValue = 0;
_frameSlider.highValue = 0;
_currentPlayerSession.ClearDebugReport(); _currentPlayerSession.ClearDebugReport();
_assetListViewer.ClearView();
_bundleListViewer.ClearView();
_operationListViewer.ClearView();
} }
} }
private void OnRecordToggleValueChange(ChangeEvent<bool> evt) private void OnRecordToggleValueChange(ChangeEvent<bool> evt)
@@ -234,42 +262,6 @@ namespace YooAsset.Editor
RemoteEditorConnection.Instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data); RemoteEditorConnection.Instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
} }
private RemotePlayerSession GetOrCreatePlayerSession(int playerId)
{
if (_playerSessions.TryGetValue(playerId, out RemotePlayerSession session))
{
return session;
}
else
{
RemotePlayerSession newSession = new RemotePlayerSession(playerId);
_playerSessions.Add(playerId, newSession);
return newSession;
}
}
private void UpdateFrameView(RemotePlayerSession playerSession)
{
if (playerSession != null)
{
UpdateFrameView(playerSession, playerSession.MaxRangeValue);
}
}
private void UpdateFrameView(RemotePlayerSession playerSession, int rangeIndex)
{
if (playerSession == null)
return;
var debugReport = playerSession.GetDebugReport(rangeIndex);
if (debugReport != null)
{
_currentReport = debugReport;
_frameSlider.label = $"Frame: {debugReport.FrameCount}";
_assetListViewer.FillViewData(debugReport);
_bundleListViewer.FillViewData(debugReport);
_operationListViewer.FillViewData(debugReport);
}
}
private void SampleBtn_onClick() private void SampleBtn_onClick()
{ {
// 发送采集数据的命令 // 发送采集数据的命令
@@ -304,6 +296,7 @@ namespace YooAsset.Editor
string filePath = $"{resultPath}/{nameof(DebugReport)}_{_currentReport.FrameCount}.json"; string filePath = $"{resultPath}/{nameof(DebugReport)}_{_currentReport.FrameCount}.json";
string fileContent = JsonUtility.ToJson(_currentReport, true); string fileContent = JsonUtility.ToJson(_currentReport, true);
FileUtility.WriteAllText(filePath, fileContent); FileUtility.WriteAllText(filePath, fileContent);
Debug.Log($"Debug report file saved : {filePath}");
} }
} }
private void OnSearchKeyWordChange(ChangeEvent<string> e) private void OnSearchKeyWordChange(ChangeEvent<string> e)
@@ -347,6 +340,9 @@ namespace YooAsset.Editor
{ {
throw new NotImplementedException(viewMode.ToString()); throw new NotImplementedException(viewMode.ToString());
} }
// 重新绘制该帧数据
RepaintFrame(_lastRepaintIndex);
} }
} }
private DropdownMenuAction.Status OnViewModeMenuStatusUpdate(DropdownMenuAction action) private DropdownMenuAction.Status OnViewModeMenuStatusUpdate(DropdownMenuAction action)
@@ -357,6 +353,63 @@ namespace YooAsset.Editor
else else
return DropdownMenuAction.Status.Normal; return DropdownMenuAction.Status.Normal;
} }
private RemotePlayerSession GetOrCreatePlayerSession(int playerId)
{
if (_playerSessions.TryGetValue(playerId, out RemotePlayerSession session))
{
return session;
}
else
{
RemotePlayerSession newSession = new RemotePlayerSession(playerId);
_playerSessions.Add(playerId, newSession);
return newSession;
}
}
private void RepaintFrame(int repaintIndex)
{
if (_currentPlayerSession == null)
{
_assetListViewer.ClearView();
_bundleListViewer.ClearView();
_operationListViewer.ClearView();
return;
}
var debugReport = _currentPlayerSession.GetDebugReport(repaintIndex);
if (debugReport != null)
{
_lastRepaintIndex = repaintIndex;
_currentReport = debugReport;
_frameSlider.label = $"Frame: {debugReport.FrameCount}";
_frameSlider.highValue = _currentPlayerSession.MaxRangeValue;
_frameSlider.value = repaintIndex;
if (_viewMode == EViewMode.AssetView)
{
_assetListViewer.FillViewData(debugReport);
_bundleListViewer.ClearView();
_operationListViewer.ClearView();
}
else if (_viewMode == EViewMode.BundleView)
{
_assetListViewer.ClearView();
_bundleListViewer.FillViewData(debugReport);
_operationListViewer.ClearView();
}
else if (_viewMode == EViewMode.OperationView)
{
_assetListViewer.ClearView();
_bundleListViewer.ClearView();
_operationListViewer.FillViewData(debugReport);
}
else
{
throw new System.NotImplementedException(_viewMode.ToString());
}
}
}
} }
} }
#endif #endif

View File

@@ -1,12 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
namespace YooAsset.Editor namespace YooAsset.Editor
{ {
internal class RemotePlayerSession internal class RemotePlayerSession
{ {
private readonly List<DebugReport> _reportList = new List<DebugReport>(); private readonly Queue<DebugReport> _reports = new Queue<DebugReport>();
/// <summary> /// <summary>
/// 用户ID /// 用户ID
@@ -29,7 +30,7 @@ namespace YooAsset.Editor
{ {
get get
{ {
int index = _reportList.Count - 1; int index = _reports.Count - 1;
if (index < 0) if (index < 0)
index = 0; index = 0;
return index; return index;
@@ -37,7 +38,7 @@ namespace YooAsset.Editor
} }
public RemotePlayerSession(int playerId, int maxReportCount = 1000) public RemotePlayerSession(int playerId, int maxReportCount = 500)
{ {
PlayerId = playerId; PlayerId = playerId;
MaxReportCount = maxReportCount; MaxReportCount = maxReportCount;
@@ -48,7 +49,7 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public void ClearDebugReport() public void ClearDebugReport()
{ {
_reportList.Clear(); _reports.Clear();
} }
/// <summary> /// <summary>
@@ -59,9 +60,9 @@ namespace YooAsset.Editor
if (report == null) if (report == null)
Debug.LogWarning("Invalid debug report data !"); Debug.LogWarning("Invalid debug report data !");
if (_reportList.Count >= MaxReportCount) if (_reports.Count >= MaxReportCount)
_reportList.RemoveAt(0); _reports.Dequeue();
_reportList.Add(report); _reports.Enqueue(report);
} }
/// <summary> /// <summary>
@@ -69,11 +70,11 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public DebugReport GetDebugReport(int rangeIndex) public DebugReport GetDebugReport(int rangeIndex)
{ {
if (_reportList.Count == 0) if (_reports.Count == 0)
return null; return null;
if (rangeIndex < 0 || rangeIndex >= _reportList.Count) if (rangeIndex < 0 || rangeIndex >= _reports.Count)
return null; return null;
return _reportList[rangeIndex]; return _reports.ElementAt(rangeIndex);
} }
/// <summary> /// <summary>

View File

@@ -24,8 +24,8 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset; private VisualTreeAsset _visualAsset;
private TemplateContainer _root; private TemplateContainer _root;
private TableView _providerTableView; private TableViewer _providerTableView;
private TableView _dependTableView; private TableViewer _dependTableView;
private List<ITableData> _sourceDatas; private List<ITableData> _sourceDatas;
@@ -44,12 +44,12 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f; _root.style.flexGrow = 1f;
// 资源列表 // 资源列表
_providerTableView = _root.Q<TableView>("TopTableView"); _providerTableView = _root.Q<TableViewer>("TopTableView");
_providerTableView.SelectionChangedEvent = OnProviderTableViewSelectionChanged; _providerTableView.SelectionChangedEvent = OnProviderTableViewSelectionChanged;
CreateAssetTableViewColumns(); CreateAssetTableViewColumns();
// 依赖列表 // 依赖列表
_dependTableView = _root.Q<TableView>("BottomTableView"); _dependTableView = _root.Q<TableViewer>("BottomTableView");
CreateDependTableViewColumns(); CreateDependTableViewColumns();
// 面板分屏 // 面板分屏
@@ -148,10 +148,11 @@ namespace YooAsset.Editor
// LoadingTime // LoadingTime
{ {
var columnStyle = new ColumnStyle(100); var columnStyle = new ColumnStyle(130);
columnStyle.Stretchable = false; columnStyle.Stretchable = false;
columnStyle.Searchable = false; columnStyle.Searchable = false;
columnStyle.Sortable = true; columnStyle.Sortable = true;
columnStyle.Units = "ms";
var column = new TableColumn("LoadingTime", "Loading Time", columnStyle); var column = new TableColumn("LoadingTime", "Loading Time", columnStyle);
column.MakeCell = () => column.MakeCell = () =>
{ {
@@ -279,7 +280,7 @@ namespace YooAsset.Editor
{ {
StyleColor textColor; StyleColor textColor;
var dependTableData = data as DependTableData; var dependTableData = data as DependTableData;
if (dependTableData.BundleInfo.Status == EOperationStatus.Failed) if (dependTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
textColor = new StyleColor(Color.yellow); textColor = new StyleColor(Color.yellow);
else else
textColor = new StyleColor(Color.white); textColor = new StyleColor(Color.white);
@@ -332,8 +333,10 @@ namespace YooAsset.Editor
public void ClearView() public void ClearView()
{ {
_providerTableView.ClearAll(false, true); _providerTableView.ClearAll(false, true);
_providerTableView.RebuildView();
_dependTableView.ClearAll(false, true); _dependTableView.ClearAll(false, true);
RebuildView(null); _dependTableView.RebuildView();
} }
/// <summary> /// <summary>
@@ -342,10 +345,12 @@ namespace YooAsset.Editor
public void RebuildView(string searchKeyWord) public void RebuildView(string searchKeyWord)
{ {
// 搜索匹配 // 搜索匹配
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord); if (_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
// 重建视图 // 重建视图
_providerTableView.RebuildView(); _providerTableView.RebuildView();
_dependTableView.RebuildView();
} }
/// <summary> /// <summary>

View File

@@ -1,8 +1,8 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False"> <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<YooAsset.Editor.TableView name="TopTableView" /> <YooAsset.Editor.TableViewer name="TopTableView" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;"> <ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;">
<YooAsset.Editor.TableView name="BottomTableView" /> <YooAsset.Editor.TableViewer name="BottomTableView" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@@ -28,9 +28,9 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset; private VisualTreeAsset _visualAsset;
private TemplateContainer _root; private TemplateContainer _root;
private TableView _bundleTableView; private TableViewer _bundleTableView;
private TableView _usingTableView; private TableViewer _usingTableView;
private TableView _referenceTableView; private TableViewer _referenceTableView;
private List<ITableData> _sourceDatas; private List<ITableData> _sourceDatas;
@@ -48,16 +48,16 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f; _root.style.flexGrow = 1f;
// 资源包列表 // 资源包列表
_bundleTableView = _root.Q<TableView>("BundleTableView"); _bundleTableView = _root.Q<TableViewer>("BundleTableView");
_bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged; _bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged;
CreateBundleTableViewColumns(); CreateBundleTableViewColumns();
// 使用列表 // 使用列表
_usingTableView = _root.Q<TableView>("UsingTableView"); _usingTableView = _root.Q<TableViewer>("UsingTableView");
CreateUsingTableViewColumns(); CreateUsingTableViewColumns();
// 引用列表 // 引用列表
_referenceTableView = _root.Q<TableView>("ReferenceTableView"); _referenceTableView = _root.Q<TableViewer>("ReferenceTableView");
CreateReferenceTableViewColumns(); CreateReferenceTableViewColumns();
// 面板分屏 // 面板分屏
@@ -151,7 +151,7 @@ namespace YooAsset.Editor
{ {
StyleColor textColor; StyleColor textColor;
var bundleTableData = data as BundleTableData; var bundleTableData = data as BundleTableData;
if (bundleTableData.BundleInfo.Status == EOperationStatus.Failed) if (bundleTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
textColor = new StyleColor(Color.yellow); textColor = new StyleColor(Color.yellow);
else else
textColor = new StyleColor(Color.white); textColor = new StyleColor(Color.white);
@@ -341,7 +341,7 @@ namespace YooAsset.Editor
{ {
StyleColor textColor; StyleColor textColor;
var feferenceTableData = data as ReferenceTableData; var feferenceTableData = data as ReferenceTableData;
if (feferenceTableData.BundleInfo.Status == EOperationStatus.Failed) if (feferenceTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
textColor = new StyleColor(Color.yellow); textColor = new StyleColor(Color.yellow);
else else
textColor = new StyleColor(Color.white); textColor = new StyleColor(Color.white);
@@ -393,8 +393,10 @@ namespace YooAsset.Editor
{ {
_bundleTableView.ClearAll(false, true); _bundleTableView.ClearAll(false, true);
_bundleTableView.RebuildView(); _bundleTableView.RebuildView();
_usingTableView.ClearAll(false, true); _usingTableView.ClearAll(false, true);
_usingTableView.RebuildView(); _usingTableView.RebuildView();
_referenceTableView.ClearAll(false, true); _referenceTableView.ClearAll(false, true);
_referenceTableView.RebuildView(); _referenceTableView.RebuildView();
} }
@@ -405,10 +407,13 @@ namespace YooAsset.Editor
public void RebuildView(string searchKeyWord) public void RebuildView(string searchKeyWord)
{ {
// 搜索匹配 // 搜索匹配
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord); if(_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
// 重建视图 // 重建视图
_bundleTableView.RebuildView(); _bundleTableView.RebuildView();
_usingTableView.RebuildView();
_referenceTableView.RebuildView();
} }
/// <summary> /// <summary>

View File

@@ -1,9 +1,9 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False"> <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<YooAsset.Editor.TableView name="BundleTableView" /> <YooAsset.Editor.TableViewer name="BundleTableView" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 400px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="BottomGroup" style="height: 400px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;">
<YooAsset.Editor.TableView name="UsingTableView" /> <YooAsset.Editor.TableViewer name="UsingTableView" />
<YooAsset.Editor.TableView name="ReferenceTableView" /> <YooAsset.Editor.TableViewer name="ReferenceTableView" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@@ -20,7 +20,7 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset; private VisualTreeAsset _visualAsset;
private TemplateContainer _root; private TemplateContainer _root;
private TableView _operationTableView; private TableViewer _operationTableView;
private Toolbar _bottomToolbar; private Toolbar _bottomToolbar;
private TreeViewer _childTreeView; private TreeViewer _childTreeView;
@@ -41,7 +41,7 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f; _root.style.flexGrow = 1f;
// 任务列表 // 任务列表
_operationTableView = _root.Q<TableView>("TopTableView"); _operationTableView = _root.Q<TableViewer>("TopTableView");
_operationTableView.SelectionChangedEvent = OnOperationTableViewSelectionChanged; _operationTableView.SelectionChangedEvent = OnOperationTableViewSelectionChanged;
CreateOperationTableViewColumns(); CreateOperationTableViewColumns();
@@ -170,10 +170,11 @@ namespace YooAsset.Editor
// ProcessTime // ProcessTime
{ {
var columnStyle = new ColumnStyle(100); var columnStyle = new ColumnStyle(130);
columnStyle.Stretchable = false; columnStyle.Stretchable = false;
columnStyle.Searchable = false; columnStyle.Searchable = false;
columnStyle.Sortable = true; columnStyle.Sortable = true;
columnStyle.Units = "ms";
var column = new TableColumn("ProcessTime", "Process Time", columnStyle); var column = new TableColumn("ProcessTime", "Process Time", columnStyle);
column.MakeCell = () => column.MakeCell = () =>
{ {
@@ -270,9 +271,9 @@ namespace YooAsset.Editor
// ProcessTime // ProcessTime
{ {
ToolbarButton button = new ToolbarButton(); ToolbarButton button = new ToolbarButton();
button.text = "ProcessTime"; button.text = "ProcessTime (ms)";
button.style.flexGrow = 0; button.style.flexGrow = 0;
button.style.width = 100; button.style.width = 130;
_bottomToolbar.Add(button); _bottomToolbar.Add(button);
} }
@@ -337,8 +338,10 @@ namespace YooAsset.Editor
public void ClearView() public void ClearView()
{ {
_operationTableView.ClearAll(false, true); _operationTableView.ClearAll(false, true);
_operationTableView.RebuildView();
_childTreeView.ClearAll(); _childTreeView.ClearAll();
RebuildView(null); _childTreeView.RebuildView();
} }
/// <summary> /// <summary>
@@ -347,7 +350,8 @@ namespace YooAsset.Editor
public void RebuildView(string searchKeyWord) public void RebuildView(string searchKeyWord)
{ {
// 搜索匹配 // 搜索匹配
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord); if(_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
// 重建视图 // 重建视图
_operationTableView.RebuildView(); _operationTableView.RebuildView();
@@ -419,7 +423,7 @@ namespace YooAsset.Editor
var label = new Label(); var label = new Label();
label.name = "ProcessTime"; label.name = "ProcessTime";
label.style.flexGrow = 0f; label.style.flexGrow = 0f;
label.style.width = 100; label.style.width = 130;
label.style.unityTextAlign = TextAnchor.MiddleLeft; label.style.unityTextAlign = TextAnchor.MiddleLeft;
container.Add(label); container.Add(label);
} }
@@ -446,7 +450,7 @@ namespace YooAsset.Editor
} }
private void BindTreeViewItem(VisualElement container, object userData) private void BindTreeViewItem(VisualElement container, object userData)
{ {
var operationInfo = userData as DebugOperationInfo; var operationInfo = (DebugOperationInfo)userData;
// OperationName // OperationName
{ {

View File

@@ -1,6 +1,6 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True"> <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<YooAsset.Editor.TableView name="TopTableView" /> <YooAsset.Editor.TableViewer name="TopTableView" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="flex-grow: 1;"> <ui:VisualElement name="BottomGroup" style="flex-grow: 1;">
<uie:Toolbar name="BottomToolbar" /> <uie:Toolbar name="BottomToolbar" />

View File

@@ -24,8 +24,8 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset; private VisualTreeAsset _visualAsset;
private TemplateContainer _root; private TemplateContainer _root;
private TableView _assetTableView; private TableViewer _assetTableView;
private TableView _dependTableView; private TableViewer _dependTableView;
private BuildReport _buildReport; private BuildReport _buildReport;
private string _reportFilePath; private string _reportFilePath;
@@ -46,13 +46,13 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f; _root.style.flexGrow = 1f;
// 资源列表 // 资源列表
_assetTableView = _root.Q<TableView>("TopTableView"); _assetTableView = _root.Q<TableViewer>("TopTableView");
_assetTableView.SelectionChangedEvent = OnAssetTableViewSelectionChanged; _assetTableView.SelectionChangedEvent = OnAssetTableViewSelectionChanged;
_assetTableView.ClickTableDataEvent = OnClickAssetTableView; _assetTableView.ClickTableDataEvent = OnClickAssetTableView;
CreateAssetTableViewColumns(); CreateAssetTableViewColumns();
// 依赖列表 // 依赖列表
_dependTableView = _root.Q<TableView>("BottomTableView"); _dependTableView = _root.Q<TableViewer>("BottomTableView");
_dependTableView.ClickTableDataEvent = OnClickBundleTableView; _dependTableView.ClickTableDataEvent = OnClickBundleTableView;
CreateDependTableViewColumns(); CreateDependTableViewColumns();
@@ -238,9 +238,8 @@ namespace YooAsset.Editor
ReportAssetInfo assetInfo = assetTableData.AssetInfo; ReportAssetInfo assetInfo = assetTableData.AssetInfo;
// 填充依赖数据 // 填充依赖数据
var mainBundle = _buildReport.GetBundleInfo(assetInfo.MainBundleName); var sourceDatas = new List<ITableData>(assetInfo.DependBundles.Count);
var sourceDatas = new List<ITableData>(mainBundle.DependBundles.Count); foreach (string dependBundleName in assetInfo.DependBundles)
foreach (string dependBundleName in mainBundle.DependBundles)
{ {
var dependBundle = _buildReport.GetBundleInfo(dependBundleName); var dependBundle = _buildReport.GetBundleInfo(dependBundleName);
var rowData = new DependTableData(); var rowData = new DependTableData();

View File

@@ -1,8 +1,8 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False"> <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<YooAsset.Editor.TableView name="TopTableView" style="flex-grow: 1;" /> <YooAsset.Editor.TableViewer name="TopTableView" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;"> <ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;">
<YooAsset.Editor.TableView name="BottomTableView" style="flex-grow: 1;" /> <YooAsset.Editor.TableViewer name="BottomTableView" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@@ -24,8 +24,8 @@ namespace YooAsset.Editor
private VisualTreeAsset _visualAsset; private VisualTreeAsset _visualAsset;
private TemplateContainer _root; private TemplateContainer _root;
private TableView _bundleTableView; private TableViewer _bundleTableView;
private TableView _includeTableView; private TableViewer _includeTableView;
private BuildReport _buildReport; private BuildReport _buildReport;
private string _reportFilePath; private string _reportFilePath;
@@ -46,13 +46,13 @@ namespace YooAsset.Editor
_root.style.flexGrow = 1f; _root.style.flexGrow = 1f;
// 资源包列表 // 资源包列表
_bundleTableView = _root.Q<TableView>("TopTableView"); _bundleTableView = _root.Q<TableViewer>("TopTableView");
_bundleTableView.ClickTableDataEvent = OnClickBundleTableView; _bundleTableView.ClickTableDataEvent = OnClickBundleTableView;
_bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged; _bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged;
CreateBundleTableViewColumns(); CreateBundleTableViewColumns();
// 包含列表 // 包含列表
_includeTableView = _root.Q<TableView>("BottomTableView"); _includeTableView = _root.Q<TableViewer>("BottomTableView");
_includeTableView.ClickTableDataEvent = OnClickIncludeTableView; _includeTableView.ClickTableDataEvent = OnClickIncludeTableView;
CreateIncludeTableViewColumns(); CreateIncludeTableViewColumns();

View File

@@ -1,8 +1,8 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False"> <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<YooAsset.Editor.TableView name="TopTableView" style="flex-grow: 1;" /> <YooAsset.Editor.TableViewer name="TopTableView" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;"> <ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex; flex-grow: 1;">
<YooAsset.Editor.TableView name="BottomTableView" style="flex-grow: 1;" /> <YooAsset.Editor.TableViewer name="BottomTableView" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@@ -46,6 +46,11 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public bool Counter = false; public bool Counter = false;
/// <summary>
/// 展示单位
/// </summary>
public string Units = string.Empty;
public ColumnStyle(Length width) public ColumnStyle(Length width)
{ {
if (width.value > MaxValue) if (width.value > MaxValue)

View File

@@ -13,9 +13,9 @@ namespace YooAsset.Editor
/// <summary> /// <summary>
/// Unity2022版本以上推荐官方类MultiColumnListView组件 /// Unity2022版本以上推荐官方类MultiColumnListView组件
/// </summary> /// </summary>
public class TableView : VisualElement public class TableViewer : VisualElement
{ {
public new class UxmlFactory : UxmlFactory<TableView, UxmlTraits> public new class UxmlFactory : UxmlFactory<TableViewer, UxmlTraits>
{ {
} }
@@ -82,7 +82,7 @@ namespace YooAsset.Editor
public Action<ITableData> SelectionChangedEvent; public Action<ITableData> SelectionChangedEvent;
public TableView() public TableViewer()
{ {
this.style.flexShrink = 1f; this.style.flexShrink = 1f;
this.style.flexGrow = 1f; this.style.flexGrow = 1f;
@@ -214,6 +214,16 @@ namespace YooAsset.Editor
} }
} }
// 设置展示单位
foreach (var column in _columns)
{
if (string.IsNullOrEmpty(column.ColumnStyle.Units) == false)
{
var toobarButton = GetHeaderElement(column.ElementName) as ToolbarButton;
toobarButton.text = $"{toobarButton.text} ({column.ColumnStyle.Units})";
}
}
// 设置升降符号 // 设置升降符号
if (string.IsNullOrEmpty(_sortingHeader) == false) if (string.IsNullOrEmpty(_sortingHeader) == false)
{ {

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 569f60ef80f74a642bac91eca0b20a2b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +1,10 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
// 内部友元
[assembly: InternalsVisibleTo("YooAsset.Editor")] [assembly: InternalsVisibleTo("YooAsset.Editor")]
[assembly: InternalsVisibleTo("YooAsset.EditorExtension")]
[assembly: InternalsVisibleTo("YooAsset.RuntimeExtension")]
[assembly: InternalsVisibleTo("YooAsset.Test.Editor")] [assembly: InternalsVisibleTo("YooAsset.Test.Editor")]
// 外部友元
[assembly: InternalsVisibleTo("YooAsset.RuntimeExtension")]
[assembly: InternalsVisibleTo("YooAsset.EditorExtension")]
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor")] [assembly: InternalsVisibleTo("Assembly-CSharp-Editor")]

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace YooAsset namespace YooAsset
{ {
[Serializable] [Serializable]
internal class DebugBundleInfo : IComparer<DebugBundleInfo>, IComparable<DebugBundleInfo> internal struct DebugBundleInfo : IComparer<DebugBundleInfo>, IComparable<DebugBundleInfo>
{ {
/// <summary> /// <summary>
/// 资源包名称 /// 资源包名称
@@ -20,7 +20,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 加载状态 /// 加载状态
/// </summary> /// </summary>
public EOperationStatus Status; public string Status;
/// <summary> /// <summary>
/// 谁引用了该资源包 /// 谁引用了该资源包

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace YooAsset namespace YooAsset
{ {
[Serializable] [Serializable]
internal class DebugOperationInfo : IComparer<DebugOperationInfo>, IComparable<DebugOperationInfo> internal struct DebugOperationInfo : IComparer<DebugOperationInfo>, IComparable<DebugOperationInfo>
{ {
/// <summary> /// <summary>
/// 任务名称 /// 任务名称

View File

@@ -47,7 +47,7 @@ namespace YooAsset
else else
{ {
UnityEngine.Debug.LogError($"Can not found {nameof(DebugBundleInfo)} : {bundleName}"); UnityEngine.Debug.LogError($"Can not found {nameof(DebugBundleInfo)} : {bundleName}");
return null; return default;
} }
} }
} }

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace YooAsset namespace YooAsset
{ {
[Serializable] [Serializable]
internal class DebugProviderInfo : IComparer<DebugProviderInfo>, IComparable<DebugProviderInfo> internal struct DebugProviderInfo : IComparer<DebugProviderInfo>, IComparable<DebugProviderInfo>
{ {
/// <summary> /// <summary>
/// 包裹名 /// 包裹名

View File

@@ -12,6 +12,11 @@ namespace YooAsset
[Serializable] [Serializable]
internal class DebugReport internal class DebugReport
{ {
/// <summary>
/// 调试器版本
/// </summary>
public string DebuggerVersion = RemoteDebuggerDefine.DebuggerVersion;
/// <summary> /// <summary>
/// 游戏帧 /// 游戏帧
/// </summary> /// </summary>

View File

@@ -1,10 +1,10 @@
using System; using System;
using System.Text;
namespace YooAsset namespace YooAsset
{ {
internal class RemoteDebuggerDefine internal class RemoteDebuggerDefine
{ {
public const string DebuggerVersion = "2.3.3";
public static readonly Guid kMsgPlayerSendToEditor = new Guid("e34a5702dd353724aa315fb8011f08c3"); public static readonly Guid kMsgPlayerSendToEditor = new Guid("e34a5702dd353724aa315fb8011f08c3");
public static readonly Guid kMsgEditorSendToPlayer = new Guid("4d1926c9df5b052469a1c63448b7609a"); public static readonly Guid kMsgEditorSendToPlayer = new Guid("4d1926c9df5b052469a1c63448b7609a");
} }

View File

@@ -7,6 +7,15 @@ namespace YooAsset
{ {
internal class RemoteDebuggerInRuntime : MonoBehaviour internal class RemoteDebuggerInRuntime : MonoBehaviour
{ {
#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
_sampleOnce = false;
_autoSample = false;
}
#endif
private static bool _sampleOnce = false; private static bool _sampleOnce = false;
private static bool _autoSample = false; private static bool _autoSample = false;

View File

@@ -8,6 +8,14 @@ namespace YooAsset
{ {
internal class RemoteEditorConnection internal class RemoteEditorConnection
{ {
#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
_instance = null;
}
#endif
private static RemoteEditorConnection _instance; private static RemoteEditorConnection _instance;
public static RemoteEditorConnection Instance public static RemoteEditorConnection Instance
{ {

View File

@@ -8,6 +8,14 @@ namespace YooAsset
{ {
internal class RemotePlayerConnection internal class RemotePlayerConnection
{ {
#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
_instance = null;
}
#endif
private static RemotePlayerConnection _instance; private static RemotePlayerConnection _instance;
public static RemotePlayerConnection Instance public static RemotePlayerConnection Instance
{ {

View File

@@ -1,30 +0,0 @@

namespace YooAsset
{
internal class DownloadParam
{
public readonly int FailedTryAgain;
public readonly int Timeout;
/// <summary>
/// 导入的本地文件路径
/// </summary>
public string ImportFilePath { set; get; }
/// <summary>
/// 主资源地址
/// </summary>
public string MainURL { set; get; }
/// <summary>
/// 备用资源地址
/// </summary>
public string FallbackURL { set; get; }
public DownloadParam(int failedTryAgain, int timeout)
{
FailedTryAgain = failedTryAgain;
Timeout = timeout;
}
}
}

View File

@@ -1,4 +1,5 @@
using UnityEngine.Networking; using UnityEngine.Networking;
using UnityEngine;
namespace YooAsset namespace YooAsset
{ {
@@ -9,6 +10,14 @@ namespace YooAsset
internal class DownloadSystemHelper internal class DownloadSystemHelper
{ {
#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
UnityWebRequestCreater = null;
}
#endif
public static UnityWebRequestDelegate UnityWebRequestCreater = null; public static UnityWebRequestDelegate UnityWebRequestCreater = null;
public static UnityWebRequest NewUnityWebRequestGet(string requestURL) public static UnityWebRequest NewUnityWebRequestGet(string requestURL)
{ {
@@ -28,7 +37,9 @@ namespace YooAsset
string url; string url;
// 获取对应平台的URL地址 // 获取对应平台的URL地址
#if UNITY_EDITOR #if UNITY_EDITOR_OSX
url = StringUtility.Format("file://{0}", path);
#elif UNITY_EDITOR
url = StringUtility.Format("file:///{0}", path); url = StringUtility.Format("file:///{0}", path);
#elif UNITY_WEBGL #elif UNITY_WEBGL
url = path; url = path;
@@ -56,7 +67,7 @@ namespace YooAsset
} }
#elif UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_OSX
url = new System.Uri(path).ToString(); url = new System.Uri(path).ToString();
#elif UNITY_STANDALONE #elif UNITY_STANDALONE || UNITY_WSA
url = StringUtility.Format("file:///{0}", path); url = StringUtility.Format("file:///{0}", path);
#else #else
throw new System.NotImplementedException(); throw new System.NotImplementedException();

View File

@@ -6,6 +6,14 @@ namespace YooAsset
{ {
internal class WebRequestCounter internal class WebRequestCounter
{ {
#if UNITY_EDITOR
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
_requestFailedRecorder.Clear();
}
#endif
/// <summary> /// <summary>
/// 记录网络请求失败事件的次数 /// 记录网络请求失败事件的次数
/// </summary> /// </summary>

View File

@@ -0,0 +1,21 @@

namespace YooAsset
{
internal class CatalogDefine
{
/// <summary>
/// 文件极限大小100MB
/// </summary>
public const int FileMaxSize = 104857600;
/// <summary>
/// 文件头标记
/// </summary>
public const uint FileSign = 0x133C5EE;
/// <summary>
/// 文件格式版本
/// </summary>
public const string FileVersion = "1.0.0";
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c6be7b8be0b51784997c959b370193e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More