更新
This commit is contained in:
parent
1571dfc6c2
commit
d56fbe2051
117
CHANGELOG.md
117
CHANGELOG.md
@ -2,6 +2,123 @@
|
||||
|
||||
All notable changes to this package will be documented in this file.
|
||||
|
||||
## [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
|
||||
|
||||
### Fixed
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57108573b0656af4fb20588dbfea7484
|
||||
guid: fab3cd742c11be2479b07f5d447a78c9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
17
Editor/Assembly/MacroDefine.cs
Normal file
17
Editor/Assembly/MacroDefine.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
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",
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07f7c95e8e42fd04f81b9925b2dcf0d0
|
||||
guid: a61e5c2ca04aab647b1ed0492086aa8f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
96
Editor/Assembly/MacroProcessor.cs
Normal file
96
Editor/Assembly/MacroProcessor.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using UnityEditor;
|
||||
|
||||
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结构重新输出为文本
|
||||
var stringWriter = new StringWriter();
|
||||
var writerSettings = new XmlWriterSettings();
|
||||
writerSettings.Indent = true;
|
||||
var xmlWriter = XmlWriter.Create(stringWriter, writerSettings);
|
||||
xmlDoc.WriteTo(xmlWriter);
|
||||
xmlWriter.Flush();
|
||||
return stringWriter.ToString();
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88e4ec854876f3f40bce38bc880c0f6a
|
||||
guid: 88d5a41d078a82e40b82265ed4c3631a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
115
Editor/Assembly/RspGenerator.cs
Normal file
115
Editor/Assembly/RspGenerator.cs
Normal 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
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c3f4136cf7142346ae33e8a82cbdb27
|
||||
guid: c2662e1d33b1eea469695b68d18b1739
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@ -97,7 +97,7 @@ namespace YooAsset.Editor
|
||||
private Button _passesVisibleBtn;
|
||||
private Label _titleLabel;
|
||||
private Label _descLabel;
|
||||
private TableView _elementTableView;
|
||||
private TableViewer _elementTableView;
|
||||
|
||||
private ScanReportCombiner _reportCombiner;
|
||||
private string _lastestOpenFolder;
|
||||
@ -152,7 +152,7 @@ namespace YooAsset.Editor
|
||||
_descLabel = root.Q<Label>("ReportDesc");
|
||||
|
||||
// 列表相关
|
||||
_elementTableView = root.Q<TableView>("TopTableView");
|
||||
_elementTableView = root.Q<TableViewer>("TopTableView");
|
||||
_elementTableView.ClickTableDataEvent = OnClickTableViewItem;
|
||||
|
||||
_lastestOpenFolder = EditorTools.GetProjectPath();
|
||||
@ -326,7 +326,7 @@ namespace YooAsset.Editor
|
||||
var column = new TableColumn("眼睛框", string.Empty, columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var toggle = new DisplayToggle();
|
||||
var toggle = new ToggleDisplay();
|
||||
toggle.text = string.Empty;
|
||||
toggle.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
toggle.RegisterValueChangedCallback((evt) => { OnDisplayToggleValueChange(toggle, evt); });
|
||||
@ -334,11 +334,10 @@ namespace YooAsset.Editor
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
var toggle = element as DisplayToggle;
|
||||
var toggle = element as ToggleDisplay;
|
||||
toggle.userData = data;
|
||||
var tableData = data as ElementTableData;
|
||||
toggle.SetValueWithoutNotify(tableData.Element.Hidden);
|
||||
toggle.RefreshIcon();
|
||||
};
|
||||
_elementTableView.AddColumn(column);
|
||||
var headerElement = _elementTableView.GetHeaderElement("眼睛框");
|
||||
@ -442,6 +441,8 @@ namespace YooAsset.Editor
|
||||
columnStyle.Stretchable = header.Stretchable;
|
||||
columnStyle.Searchable = header.Searchable;
|
||||
columnStyle.Sortable = header.Sortable;
|
||||
columnStyle.Counter = header.Counter;
|
||||
columnStyle.Units = header.Units;
|
||||
var column = new TableColumn(header.HeaderTitle, header.HeaderTitle, columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
@ -577,10 +578,8 @@ namespace YooAsset.Editor
|
||||
// 重绘视图
|
||||
RebuildView();
|
||||
}
|
||||
private void OnDisplayToggleValueChange(DisplayToggle toggle, ChangeEvent<bool> e)
|
||||
private void OnDisplayToggleValueChange(ToggleDisplay toggle, ChangeEvent<bool> e)
|
||||
{
|
||||
toggle.RefreshIcon();
|
||||
|
||||
// 处理自身
|
||||
toggle.SetValueWithoutNotify(e.newValue);
|
||||
|
||||
@ -593,7 +592,8 @@ namespace YooAsset.Editor
|
||||
foreach (var selectedItem in selectedItems)
|
||||
{
|
||||
var selectElement = selectedItem as ElementTableData;
|
||||
selectElement.Element.Hidden = e.newValue;
|
||||
if (selectElement != null)
|
||||
selectElement.Element.Hidden = e.newValue;
|
||||
}
|
||||
|
||||
// 重绘视图
|
||||
|
||||
@ -17,6 +17,6 @@
|
||||
<ui:Button text="显示白名单元素" display-tooltip-when-elided="true" name="WhiteListVisibleButton" style="width: 100px;" />
|
||||
</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;">
|
||||
<YooAsset.Editor.TableView name="TopTableView" />
|
||||
<YooAsset.Editor.TableViewer name="TopTableView" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
||||
@ -43,6 +43,16 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public bool Sortable = false;
|
||||
|
||||
/// <summary>
|
||||
/// 统计数量
|
||||
/// </summary>
|
||||
public bool Counter = false;
|
||||
|
||||
/// <summary>
|
||||
/// 展示单位
|
||||
/// </summary>
|
||||
public string Units = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 数值类型
|
||||
/// </summary>
|
||||
@ -89,6 +99,16 @@ namespace YooAsset.Editor
|
||||
Sortable = true;
|
||||
return this;
|
||||
}
|
||||
public ReportHeader SetCounter()
|
||||
{
|
||||
Counter = true;
|
||||
return this;
|
||||
}
|
||||
public ReportHeader SetUnits(string units)
|
||||
{
|
||||
Units = units;
|
||||
return this;
|
||||
}
|
||||
public ReportHeader SetHeaderType(EHeaderType value)
|
||||
{
|
||||
HeaderType = value;
|
||||
|
||||
@ -26,6 +26,7 @@ namespace YooAsset.Editor
|
||||
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
||||
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
|
||||
buildParameters.BuildinFileCopyParams = string.Empty;
|
||||
buildParameters.UseAssetDependencyDB = true;
|
||||
|
||||
var pipeline = new EditorSimulateBuildPipeline();
|
||||
BuildResult buildResult = pipeline.Run(buildParameters, false);
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d2c835e5e40ca34d93480587c8125df
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -30,7 +30,7 @@ namespace YooAsset.Editor
|
||||
|
||||
// 创建新补丁清单
|
||||
PackageManifest manifest = new PackageManifest();
|
||||
manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
|
||||
manifest.FileVersion = ManifestDefine.FileVersion;
|
||||
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fe3d00b03dc9c64a96b7acfdf99b54c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -36,6 +36,7 @@ namespace YooAsset.Editor
|
||||
new TaskCreateReport_BBP(),
|
||||
new TaskCreatePackage_BBP(),
|
||||
new TaskCopyBuildinFiles_BBP(),
|
||||
new TaskCreateCatalog_BBP()
|
||||
};
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 563771ecaff17ee498b5fda7c1132e62
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -38,6 +38,7 @@ namespace YooAsset.Editor
|
||||
new TaskCreateReport_RFBP(),
|
||||
new TaskCreatePackage_RFBP(),
|
||||
new TaskCopyBuildinFiles_RFBP(),
|
||||
new TaskCreateCatalog_RFBP()
|
||||
};
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8241b1eb8e22874b84d279dae9bbd1b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -36,6 +36,7 @@ namespace YooAsset.Editor
|
||||
new TaskCreateReport_SBP(),
|
||||
new TaskCreatePackage_SBP(),
|
||||
new TaskCopyBuildinFiles_SBP(),
|
||||
new TaskCreateCatalog_SBP()
|
||||
};
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
||||
/// <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>
|
||||
|
||||
@ -38,21 +38,31 @@ namespace YooAsset.Editor
|
||||
/// 资源包视图
|
||||
/// </summary>
|
||||
BundleView,
|
||||
|
||||
/// <summary>
|
||||
/// 异步操作视图
|
||||
/// </summary>
|
||||
OperationView,
|
||||
}
|
||||
|
||||
|
||||
private readonly Dictionary<int, RemotePlayerSession> _playerSessions = new Dictionary<int, RemotePlayerSession>();
|
||||
|
||||
private Label _playerName;
|
||||
private ToolbarButton _playerName;
|
||||
private ToolbarMenu _viewModeMenu;
|
||||
private SliderInt _frameSlider;
|
||||
private DebuggerAssetListViewer _assetListViewer;
|
||||
private DebuggerBundleListViewer _bundleListViewer;
|
||||
private DebuggerOperationListViewer _operationListViewer;
|
||||
|
||||
private EViewMode _viewMode;
|
||||
private string _searchKeyWord;
|
||||
private DebugReport _currentReport;
|
||||
private RemotePlayerSession _currentPlayerSession;
|
||||
|
||||
private double _lastRepaintTime = 0;
|
||||
private int _nextRepaintIndex = -1;
|
||||
private int _lastRepaintIndex = 0;
|
||||
private int _rangeIndex = 0;
|
||||
|
||||
|
||||
@ -78,13 +88,14 @@ namespace YooAsset.Editor
|
||||
exportBtn.clicked += ExportBtn_clicked;
|
||||
|
||||
// 用户列表菜单
|
||||
_playerName = root.Q<Label>("PlayerName");
|
||||
_playerName = root.Q<ToolbarButton>("PlayerName");
|
||||
_playerName.text = "Editor player";
|
||||
|
||||
// 视口模式菜单
|
||||
_viewModeMenu = root.Q<ToolbarMenu>("ViewModeMenu");
|
||||
_viewModeMenu.menu.AppendAction(EViewMode.AssetView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.AssetView);
|
||||
_viewModeMenu.menu.AppendAction(EViewMode.BundleView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.BundleView);
|
||||
_viewModeMenu.menu.AppendAction(EViewMode.OperationView.ToString(), OnViewModeMenuChange, OnViewModeMenuStatusUpdate, EViewMode.OperationView);
|
||||
_viewModeMenu.text = EViewMode.AssetView.ToString();
|
||||
|
||||
// 搜索栏
|
||||
@ -111,6 +122,9 @@ namespace YooAsset.Editor
|
||||
|
||||
var frameClear = root.Q<ToolbarButton>("FrameClear");
|
||||
frameClear.clicked += OnFrameClear_clicked;
|
||||
|
||||
var recorderToggle = root.Q<ToggleRecord>("FrameRecord");
|
||||
recorderToggle.RegisterValueChangedCallback(OnRecordToggleValueChange);
|
||||
}
|
||||
|
||||
// 加载视图
|
||||
@ -121,6 +135,10 @@ namespace YooAsset.Editor
|
||||
_bundleListViewer = new DebuggerBundleListViewer();
|
||||
_bundleListViewer.InitViewer();
|
||||
|
||||
// 加载视图
|
||||
_operationListViewer = new DebuggerOperationListViewer();
|
||||
_operationListViewer.InitViewer();
|
||||
|
||||
// 显示视图
|
||||
_viewMode = EViewMode.AssetView;
|
||||
_assetListViewer.AttachParent(root);
|
||||
@ -129,8 +147,9 @@ namespace YooAsset.Editor
|
||||
EditorConnection.instance.Initialize();
|
||||
EditorConnection.instance.RegisterConnection(OnHandleConnectionEvent);
|
||||
EditorConnection.instance.RegisterDisconnection(OnHandleDisconnectionEvent);
|
||||
EditorConnection.instance.Register(RemoteDebuggerDefine.kMsgSendPlayerToEditor, OnHandlePlayerMessage);
|
||||
RemoteDebuggerInRuntime.EditorHandleDebugReportCallback = OnHandleDebugReport;
|
||||
EditorConnection.instance.Register(RemoteDebuggerDefine.kMsgPlayerSendToEditor, OnHandlePlayerMessage);
|
||||
RemoteEditorConnection.Instance.Initialize();
|
||||
RemoteEditorConnection.Instance.Register(RemoteDebuggerDefine.kMsgPlayerSendToEditor, OnHandlePlayerMessage);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -142,9 +161,23 @@ namespace YooAsset.Editor
|
||||
// 远程调试
|
||||
EditorConnection.instance.UnregisterConnection(OnHandleConnectionEvent);
|
||||
EditorConnection.instance.UnregisterDisconnection(OnHandleDisconnectionEvent);
|
||||
EditorConnection.instance.Unregister(RemoteDebuggerDefine.kMsgSendPlayerToEditor, OnHandlePlayerMessage);
|
||||
EditorConnection.instance.Unregister(RemoteDebuggerDefine.kMsgPlayerSendToEditor, OnHandlePlayerMessage);
|
||||
RemoteEditorConnection.Instance.Unregister(RemoteDebuggerDefine.kMsgPlayerSendToEditor);
|
||||
_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)
|
||||
{
|
||||
@ -158,24 +191,27 @@ namespace YooAsset.Editor
|
||||
}
|
||||
private void OnHandlePlayerMessage(MessageEventArgs args)
|
||||
{
|
||||
int playerId = args.playerId;
|
||||
var debugReport = DebugReport.Deserialize(args.data);
|
||||
OnHandleDebugReport(args.playerId, debugReport);
|
||||
}
|
||||
private void OnHandleDebugReport(int playerId, DebugReport debugReport)
|
||||
{
|
||||
Debug.Log($"Handle player {playerId} debug report !");
|
||||
|
||||
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.AddDebugReport(debugReport);
|
||||
_frameSlider.highValue = _currentPlayerSession.MaxRangeValue;
|
||||
_frameSlider.value = _currentPlayerSession.MaxRangeValue;
|
||||
UpdateFrameView(_currentPlayerSession);
|
||||
_nextRepaintIndex = _currentPlayerSession.MaxRangeValue;
|
||||
}
|
||||
|
||||
private void OnFrameSliderChange(int sliderValue)
|
||||
{
|
||||
if (_currentPlayerSession != null)
|
||||
{
|
||||
_rangeIndex = _currentPlayerSession.ClampRangeIndex(sliderValue); ;
|
||||
UpdateFrameView(_currentPlayerSession, _rangeIndex);
|
||||
RepaintFrame(_rangeIndex);
|
||||
}
|
||||
}
|
||||
private void OnFrameLast_clicked()
|
||||
@ -184,7 +220,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex - 1);
|
||||
_frameSlider.value = _rangeIndex;
|
||||
UpdateFrameView(_currentPlayerSession, _rangeIndex);
|
||||
RepaintFrame(_rangeIndex);
|
||||
}
|
||||
}
|
||||
private void OnFrameNext_clicked()
|
||||
@ -193,56 +229,37 @@ namespace YooAsset.Editor
|
||||
{
|
||||
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex + 1);
|
||||
_frameSlider.value = _rangeIndex;
|
||||
UpdateFrameView(_currentPlayerSession, _rangeIndex);
|
||||
RepaintFrame(_rangeIndex);
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
_frameSlider.label = $"Frame:";
|
||||
_frameSlider.value = 0;
|
||||
_frameSlider.lowValue = 0;
|
||||
_frameSlider.highValue = 0;
|
||||
_currentPlayerSession.ClearDebugReport();
|
||||
_assetListViewer.ClearView();
|
||||
_bundleListViewer.ClearView();
|
||||
}
|
||||
}
|
||||
|
||||
private RemotePlayerSession GetOrCreatePlayerSession(int playerId)
|
||||
private void OnRecordToggleValueChange(ChangeEvent<bool> evt)
|
||||
{
|
||||
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);
|
||||
}
|
||||
// 发送采集数据的命令
|
||||
RemoteCommand command = new RemoteCommand();
|
||||
command.CommandType = (int)ERemoteCommand.SampleAuto;
|
||||
command.CommandParam = evt.newValue ? "open" : "close";
|
||||
byte[] data = RemoteCommand.Serialize(command);
|
||||
EditorConnection.instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
|
||||
RemoteEditorConnection.Instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
|
||||
}
|
||||
|
||||
private void SampleBtn_onClick()
|
||||
@ -252,8 +269,8 @@ namespace YooAsset.Editor
|
||||
command.CommandType = (int)ERemoteCommand.SampleOnce;
|
||||
command.CommandParam = string.Empty;
|
||||
byte[] data = RemoteCommand.Serialize(command);
|
||||
EditorConnection.instance.Send(RemoteDebuggerDefine.kMsgSendEditorToPlayer, data);
|
||||
RemoteDebuggerInRuntime.EditorRequestDebugReport();
|
||||
EditorConnection.instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
|
||||
RemoteEditorConnection.Instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
|
||||
}
|
||||
private void ExportBtn_clicked()
|
||||
{
|
||||
@ -288,6 +305,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
_assetListViewer.RebuildView(_searchKeyWord);
|
||||
_bundleListViewer.RebuildView(_searchKeyWord);
|
||||
_operationListViewer.RebuildView(_searchKeyWord);
|
||||
}
|
||||
}
|
||||
private void OnViewModeMenuChange(DropdownMenuAction action)
|
||||
@ -303,16 +321,27 @@ namespace YooAsset.Editor
|
||||
{
|
||||
_assetListViewer.AttachParent(root);
|
||||
_bundleListViewer.DetachParent();
|
||||
_operationListViewer.DetachParent();
|
||||
}
|
||||
else if (viewMode == EViewMode.BundleView)
|
||||
{
|
||||
_assetListViewer.DetachParent();
|
||||
_bundleListViewer.AttachParent(root);
|
||||
_operationListViewer.DetachParent();
|
||||
}
|
||||
else if (viewMode == EViewMode.OperationView)
|
||||
{
|
||||
_assetListViewer.DetachParent();
|
||||
_bundleListViewer.DetachParent();
|
||||
_operationListViewer.AttachParent(root);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException(viewMode.ToString());
|
||||
}
|
||||
|
||||
// 重新绘制该帧数据
|
||||
RepaintFrame(_lastRepaintIndex);
|
||||
}
|
||||
}
|
||||
private DropdownMenuAction.Status OnViewModeMenuStatusUpdate(DropdownMenuAction action)
|
||||
@ -323,6 +352,63 @@ namespace YooAsset.Editor
|
||||
else
|
||||
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
|
||||
@ -1,7 +1,7 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
|
||||
<uie:Toolbar name="TopToolbar" style="display: flex;">
|
||||
<ui:Label text="Player" display-tooltip-when-elided="true" name="PlayerName" style="width: 200px; -unity-text-align: lower-left; padding-left: 5px;" />
|
||||
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 100px; flex-grow: 0;" />
|
||||
<uie:ToolbarButton text="IP" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PlayerName" style="width: 200px;" />
|
||||
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 150px; flex-grow: 0;" />
|
||||
<uie:ToolbarSearchField focusable="true" name="SearchField" style="flex-grow: 1;" />
|
||||
<uie:ToolbarButton text="Refresh" display-tooltip-when-elided="true" name="SampleButton" style="width: 70px; background-color: rgb(15, 118, 31); -unity-text-align: middle-center; border-top-left-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-left-width: 1px; border-right-width: 1px;" />
|
||||
<uie:ToolbarButton text="Export" display-tooltip-when-elided="true" name="ExportButton" style="width: 70px; background-color: rgb(15, 118, 31); -unity-text-align: middle-center; border-top-left-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-left-width: 1px; border-right-width: 1px;" />
|
||||
@ -11,5 +11,6 @@
|
||||
<uie:ToolbarButton text=" << " display-tooltip-when-elided="true" name="FrameLast" />
|
||||
<uie:ToolbarButton text=" >> " display-tooltip-when-elided="true" name="FrameNext" />
|
||||
<uie:ToolbarButton text="Clear" display-tooltip-when-elided="true" name="FrameClear" />
|
||||
<YooAsset.Editor.ToggleRecord name="FrameRecord" style="width: 20px;" />
|
||||
</uie:Toolbar>
|
||||
</ui:UXML>
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
internal class RemotePlayerSession
|
||||
{
|
||||
private readonly List<DebugReport> _reportList = new List<DebugReport>();
|
||||
private readonly Queue<DebugReport> _reports = new Queue<DebugReport>();
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
@ -29,7 +30,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
get
|
||||
{
|
||||
int index = _reportList.Count - 1;
|
||||
int index = _reports.Count - 1;
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
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;
|
||||
MaxReportCount = maxReportCount;
|
||||
@ -48,7 +49,7 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public void ClearDebugReport()
|
||||
{
|
||||
_reportList.Clear();
|
||||
_reports.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -59,9 +60,9 @@ namespace YooAsset.Editor
|
||||
if (report == null)
|
||||
Debug.LogWarning("Invalid debug report data !");
|
||||
|
||||
if (_reportList.Count >= MaxReportCount)
|
||||
_reportList.RemoveAt(0);
|
||||
_reportList.Add(report);
|
||||
if (_reports.Count >= MaxReportCount)
|
||||
_reports.Dequeue();
|
||||
_reports.Enqueue(report);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,11 +70,11 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public DebugReport GetDebugReport(int rangeIndex)
|
||||
{
|
||||
if (_reportList.Count == 0)
|
||||
if (_reports.Count == 0)
|
||||
return null;
|
||||
if (rangeIndex < 0 || rangeIndex >= _reportList.Count)
|
||||
if (rangeIndex < 0 || rangeIndex >= _reports.Count)
|
||||
return null;
|
||||
return _reportList[rangeIndex];
|
||||
return _reports.ElementAt(rangeIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -24,10 +24,9 @@ namespace YooAsset.Editor
|
||||
private VisualTreeAsset _visualAsset;
|
||||
private TemplateContainer _root;
|
||||
|
||||
private TableView _providerTableView;
|
||||
private TableView _dependTableView;
|
||||
private TableViewer _providerTableView;
|
||||
private TableViewer _dependTableView;
|
||||
|
||||
private DebugReport _debugReport;
|
||||
private List<ITableData> _sourceDatas;
|
||||
|
||||
|
||||
@ -45,21 +44,20 @@ namespace YooAsset.Editor
|
||||
_root.style.flexGrow = 1f;
|
||||
|
||||
// 资源列表
|
||||
_providerTableView = _root.Q<TableView>("TopTableView");
|
||||
_providerTableView = _root.Q<TableViewer>("TopTableView");
|
||||
_providerTableView.SelectionChangedEvent = OnProviderTableViewSelectionChanged;
|
||||
CreateAssetTableViewColumns();
|
||||
|
||||
// 依赖列表
|
||||
_dependTableView = _root.Q<TableView>("BottomTableView");
|
||||
_dependTableView = _root.Q<TableViewer>("BottomTableView");
|
||||
CreateDependTableViewColumns();
|
||||
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
// 面板分屏
|
||||
var topGroup = _root.Q<VisualElement>("TopGroup");
|
||||
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||
topGroup.style.minHeight = 100;
|
||||
bottomGroup.style.minHeight = 100f;
|
||||
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
#endif
|
||||
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
}
|
||||
private void CreateAssetTableViewColumns()
|
||||
{
|
||||
@ -90,6 +88,7 @@ namespace YooAsset.Editor
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Counter = true;
|
||||
var column = new TableColumn("AssetPath", "Asset Path", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
@ -126,13 +125,13 @@ namespace YooAsset.Editor
|
||||
_providerTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// SpawnTime
|
||||
// BeginTime
|
||||
{
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
var column = new TableColumn("SpawnTime", "Spawn Time", columnStyle);
|
||||
var column = new TableColumn("BeginTime", "Begin Time", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
@ -149,10 +148,11 @@ namespace YooAsset.Editor
|
||||
|
||||
// LoadingTime
|
||||
{
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
var columnStyle = new ColumnStyle(130);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Units = "ms";
|
||||
var column = new TableColumn("LoadingTime", "Loading Time", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
@ -226,6 +226,7 @@ namespace YooAsset.Editor
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Counter = true;
|
||||
var column = new TableColumn("DependBundles", "Depend Bundles", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
@ -279,7 +280,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
StyleColor textColor;
|
||||
var dependTableData = data as DependTableData;
|
||||
if (dependTableData.BundleInfo.Status == EOperationStatus.Failed)
|
||||
if (dependTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
|
||||
textColor = new StyleColor(Color.yellow);
|
||||
else
|
||||
textColor = new StyleColor(Color.white);
|
||||
@ -297,8 +298,6 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public void FillViewData(DebugReport debugReport)
|
||||
{
|
||||
_debugReport = debugReport;
|
||||
|
||||
// 清空旧数据
|
||||
_providerTableView.ClearAll(false, true);
|
||||
_dependTableView.ClearAll(false, true);
|
||||
@ -315,7 +314,7 @@ namespace YooAsset.Editor
|
||||
rowData.AddAssetPathCell("PackageName", packageData.PackageName);
|
||||
rowData.AddStringValueCell("AssetPath", providerInfo.AssetPath);
|
||||
rowData.AddStringValueCell("SpawnScene", providerInfo.SpawnScene);
|
||||
rowData.AddStringValueCell("SpawnTime", providerInfo.SpawnTime);
|
||||
rowData.AddStringValueCell("BeginTime", providerInfo.BeginTime);
|
||||
rowData.AddLongValueCell("LoadingTime", providerInfo.LoadingTime);
|
||||
rowData.AddLongValueCell("RefCount", providerInfo.RefCount);
|
||||
rowData.AddStringValueCell("Status", providerInfo.Status.ToString());
|
||||
@ -333,10 +332,11 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public void ClearView()
|
||||
{
|
||||
_debugReport = null;
|
||||
_providerTableView.ClearAll(false, true);
|
||||
_providerTableView.RebuildView();
|
||||
|
||||
_dependTableView.ClearAll(false, true);
|
||||
RebuildView(null);
|
||||
_dependTableView.RebuildView();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -345,10 +345,12 @@ namespace YooAsset.Editor
|
||||
public void RebuildView(string searchKeyWord)
|
||||
{
|
||||
// 搜索匹配
|
||||
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||
if (_sourceDatas != null)
|
||||
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||
|
||||
// 重建视图
|
||||
_providerTableView.RebuildView();
|
||||
_dependTableView.RebuildView();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<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;">
|
||||
<YooAsset.Editor.TableView name="TopTableView" />
|
||||
<YooAsset.Editor.TableViewer name="TopTableView" />
|
||||
</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;">
|
||||
<YooAsset.Editor.TableView name="BottomTableView" />
|
||||
<YooAsset.Editor.TableViewer name="BottomTableView" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
||||
@ -28,11 +28,10 @@ namespace YooAsset.Editor
|
||||
private VisualTreeAsset _visualAsset;
|
||||
private TemplateContainer _root;
|
||||
|
||||
private TableView _bundleTableView;
|
||||
private TableView _usingTableView;
|
||||
private TableView _referenceTableView;
|
||||
private TableViewer _bundleTableView;
|
||||
private TableViewer _usingTableView;
|
||||
private TableViewer _referenceTableView;
|
||||
|
||||
private DebugReport _debugReport;
|
||||
private List<ITableData> _sourceDatas;
|
||||
|
||||
/// <summary>
|
||||
@ -49,26 +48,25 @@ namespace YooAsset.Editor
|
||||
_root.style.flexGrow = 1f;
|
||||
|
||||
// 资源包列表
|
||||
_bundleTableView = _root.Q<TableView>("BundleTableView");
|
||||
_bundleTableView = _root.Q<TableViewer>("BundleTableView");
|
||||
_bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged;
|
||||
CreateBundleTableViewColumns();
|
||||
|
||||
// 使用列表
|
||||
_usingTableView = _root.Q<TableView>("UsingTableView");
|
||||
_usingTableView = _root.Q<TableViewer>("UsingTableView");
|
||||
CreateUsingTableViewColumns();
|
||||
|
||||
// 引用列表
|
||||
_referenceTableView = _root.Q<TableView>("ReferenceTableView");
|
||||
_referenceTableView = _root.Q<TableViewer>("ReferenceTableView");
|
||||
CreateReferenceTableViewColumns();
|
||||
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
// 面板分屏
|
||||
var topGroup = _root.Q<VisualElement>("TopGroup");
|
||||
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||
topGroup.style.minHeight = 100;
|
||||
bottomGroup.style.minHeight = 100f;
|
||||
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
PanelSplitView.SplitVerticalPanel(bottomGroup, _usingTableView, _referenceTableView);
|
||||
#endif
|
||||
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
UIElementsTools.SplitVerticalPanel(bottomGroup, _usingTableView, _referenceTableView);
|
||||
}
|
||||
private void CreateBundleTableViewColumns()
|
||||
{
|
||||
@ -99,6 +97,7 @@ namespace YooAsset.Editor
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Counter = true;
|
||||
var column = new TableColumn("BundleName", "Bundle Name", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
@ -152,7 +151,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
StyleColor textColor;
|
||||
var bundleTableData = data as BundleTableData;
|
||||
if (bundleTableData.BundleInfo.Status == EOperationStatus.Failed)
|
||||
if (bundleTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
|
||||
textColor = new StyleColor(Color.yellow);
|
||||
else
|
||||
textColor = new StyleColor(Color.white);
|
||||
@ -172,6 +171,7 @@ namespace YooAsset.Editor
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Counter = true;
|
||||
var column = new TableColumn("UsingAssets", "Using Assets", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
@ -208,13 +208,13 @@ namespace YooAsset.Editor
|
||||
_usingTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// SpawnTime
|
||||
// BeginTime
|
||||
{
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
var column = new TableColumn("SpawnTime", "Spawn Time", columnStyle);
|
||||
var column = new TableColumn("BeginTime", "Begin Time", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
@ -287,6 +287,7 @@ namespace YooAsset.Editor
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Counter = true;
|
||||
var column = new TableColumn("ReferenceBundle", "Reference Bundle", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
@ -340,7 +341,7 @@ namespace YooAsset.Editor
|
||||
{
|
||||
StyleColor textColor;
|
||||
var feferenceTableData = data as ReferenceTableData;
|
||||
if (feferenceTableData.BundleInfo.Status == EOperationStatus.Failed)
|
||||
if (feferenceTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
|
||||
textColor = new StyleColor(Color.yellow);
|
||||
else
|
||||
textColor = new StyleColor(Color.white);
|
||||
@ -358,8 +359,6 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public void FillViewData(DebugReport debugReport)
|
||||
{
|
||||
_debugReport = debugReport;
|
||||
|
||||
// 清空旧数据
|
||||
_bundleTableView.ClearAll(false, true);
|
||||
_usingTableView.ClearAll(false, true);
|
||||
@ -392,11 +391,12 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public void ClearView()
|
||||
{
|
||||
_debugReport = null;
|
||||
_bundleTableView.ClearAll(false, true);
|
||||
_bundleTableView.RebuildView();
|
||||
|
||||
_usingTableView.ClearAll(false, true);
|
||||
_usingTableView.RebuildView();
|
||||
|
||||
_referenceTableView.ClearAll(false, true);
|
||||
_referenceTableView.RebuildView();
|
||||
}
|
||||
@ -407,10 +407,13 @@ namespace YooAsset.Editor
|
||||
public void RebuildView(string searchKeyWord)
|
||||
{
|
||||
// 搜索匹配
|
||||
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||
if(_sourceDatas != null)
|
||||
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||
|
||||
// 重建视图
|
||||
_bundleTableView.RebuildView();
|
||||
_usingTableView.RebuildView();
|
||||
_referenceTableView.RebuildView();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -448,7 +451,7 @@ namespace YooAsset.Editor
|
||||
rowData.ProviderInfo = providerInfo;
|
||||
rowData.AddStringValueCell("UsingAssets", providerInfo.AssetPath);
|
||||
rowData.AddStringValueCell("SpawnScene", providerInfo.SpawnScene);
|
||||
rowData.AddStringValueCell("SpawnTime", providerInfo.SpawnTime);
|
||||
rowData.AddStringValueCell("BeginTime", providerInfo.BeginTime);
|
||||
rowData.AddLongValueCell("RefCount", providerInfo.RefCount);
|
||||
rowData.AddStringValueCell("Status", providerInfo.Status);
|
||||
sourceDatas.Add(rowData);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<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;">
|
||||
<YooAsset.Editor.TableView name="BundleTableView" />
|
||||
<YooAsset.Editor.TableViewer name="BundleTableView" />
|
||||
</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;">
|
||||
<YooAsset.Editor.TableView name="UsingTableView" />
|
||||
<YooAsset.Editor.TableView name="ReferenceTableView" />
|
||||
<YooAsset.Editor.TableViewer name="UsingTableView" />
|
||||
<YooAsset.Editor.TableViewer name="ReferenceTableView" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
||||
@ -0,0 +1,509 @@
|
||||
#if UNITY_2019_4_OR_NEWER
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
internal class DebuggerOperationListViewer
|
||||
{
|
||||
private class OperationTableData : DefaultTableData
|
||||
{
|
||||
public DebugPackageData PackageData;
|
||||
public DebugOperationInfo OperationInfo;
|
||||
}
|
||||
|
||||
private VisualTreeAsset _visualAsset;
|
||||
private TemplateContainer _root;
|
||||
|
||||
private TableViewer _operationTableView;
|
||||
private Toolbar _bottomToolbar;
|
||||
private TreeViewer _childTreeView;
|
||||
|
||||
private List<ITableData> _sourceDatas;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化页面
|
||||
/// </summary>
|
||||
public void InitViewer()
|
||||
{
|
||||
// 加载布局文件
|
||||
_visualAsset = UxmlLoader.LoadWindowUXML<DebuggerOperationListViewer>();
|
||||
if (_visualAsset == null)
|
||||
return;
|
||||
|
||||
_root = _visualAsset.CloneTree();
|
||||
_root.style.flexGrow = 1f;
|
||||
|
||||
// 任务列表
|
||||
_operationTableView = _root.Q<TableViewer>("TopTableView");
|
||||
_operationTableView.SelectionChangedEvent = OnOperationTableViewSelectionChanged;
|
||||
CreateOperationTableViewColumns();
|
||||
|
||||
// 底部标题栏
|
||||
_bottomToolbar = _root.Q<Toolbar>("BottomToolbar");
|
||||
CreateBottomToolbarHeaders();
|
||||
|
||||
// 子列表
|
||||
_childTreeView = _root.Q<TreeViewer>("BottomTreeView");
|
||||
_childTreeView.makeItem = MakeTreeViewItem;
|
||||
_childTreeView.bindItem = BindTreeViewItem;
|
||||
|
||||
// 面板分屏
|
||||
var topGroup = _root.Q<VisualElement>("TopGroup");
|
||||
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||
topGroup.style.minHeight = 100;
|
||||
bottomGroup.style.minHeight = 100f;
|
||||
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
}
|
||||
private void CreateOperationTableViewColumns()
|
||||
{
|
||||
// PackageName
|
||||
{
|
||||
var columnStyle = new ColumnStyle(200);
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
var column = new TableColumn("PackageName", "Package Name", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
var infoLabel = element as Label;
|
||||
infoLabel.text = (string)cell.GetDisplayObject();
|
||||
};
|
||||
_operationTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// OperationName
|
||||
{
|
||||
var columnStyle = new ColumnStyle(300, 300, 600);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Counter = true;
|
||||
var column = new TableColumn("OperationName", "Operation Name", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
var infoLabel = element as Label;
|
||||
infoLabel.text = (string)cell.GetDisplayObject();
|
||||
};
|
||||
_operationTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// Priority
|
||||
{
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
var column = new TableColumn("Priority", "Priority", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
var infoLabel = element as Label;
|
||||
infoLabel.text = (string)cell.GetDisplayObject();
|
||||
};
|
||||
_operationTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// Progress
|
||||
{
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = false;
|
||||
var column = new TableColumn("Progress", "Progress", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
var infoLabel = element as Label;
|
||||
infoLabel.text = (string)cell.GetDisplayObject();
|
||||
};
|
||||
_operationTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// BeginTime
|
||||
{
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
var column = new TableColumn("BeginTime", "Begin Time", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
var infoLabel = element as Label;
|
||||
infoLabel.text = (string)cell.GetDisplayObject();
|
||||
};
|
||||
_operationTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// ProcessTime
|
||||
{
|
||||
var columnStyle = new ColumnStyle(130);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
columnStyle.Units = "ms";
|
||||
var column = new TableColumn("ProcessTime", "Process Time", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
var infoLabel = element as Label;
|
||||
infoLabel.text = (string)cell.GetDisplayObject();
|
||||
};
|
||||
_operationTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// Status
|
||||
{
|
||||
var columnStyle = new ColumnStyle(100);
|
||||
columnStyle.Stretchable = false;
|
||||
columnStyle.Searchable = false;
|
||||
columnStyle.Sortable = true;
|
||||
var column = new TableColumn("Status", "Status", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
StyleColor textColor;
|
||||
var operationTableData = data as OperationTableData;
|
||||
if (operationTableData.OperationInfo.Status == EOperationStatus.Failed.ToString())
|
||||
textColor = new StyleColor(Color.yellow);
|
||||
else
|
||||
textColor = new StyleColor(Color.white);
|
||||
|
||||
var infoLabel = element as Label;
|
||||
infoLabel.text = (string)cell.GetDisplayObject();
|
||||
infoLabel.style.color = textColor;
|
||||
};
|
||||
_operationTableView.AddColumn(column);
|
||||
}
|
||||
|
||||
// Desc
|
||||
{
|
||||
var columnStyle = new ColumnStyle(500, 500, 1000);
|
||||
columnStyle.Stretchable = true;
|
||||
columnStyle.Searchable = true;
|
||||
var column = new TableColumn("Desc", "Desc", columnStyle);
|
||||
column.MakeCell = () =>
|
||||
{
|
||||
var label = new Label();
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
return label;
|
||||
};
|
||||
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
|
||||
{
|
||||
var infoLabel = element as Label;
|
||||
infoLabel.text = (string)cell.GetDisplayObject();
|
||||
};
|
||||
_operationTableView.AddColumn(column);
|
||||
}
|
||||
}
|
||||
private void CreateBottomToolbarHeaders()
|
||||
{
|
||||
// OperationName
|
||||
{
|
||||
ToolbarButton button = new ToolbarButton();
|
||||
button.text = "OperationName";
|
||||
button.style.flexGrow = 0;
|
||||
button.style.width = 315;
|
||||
_bottomToolbar.Add(button);
|
||||
}
|
||||
|
||||
// Progress
|
||||
{
|
||||
ToolbarButton button = new ToolbarButton();
|
||||
button.text = "Progress";
|
||||
button.style.flexGrow = 0;
|
||||
button.style.width = 100;
|
||||
_bottomToolbar.Add(button);
|
||||
}
|
||||
|
||||
// BeginTime
|
||||
{
|
||||
ToolbarButton button = new ToolbarButton();
|
||||
button.text = "BeginTime";
|
||||
button.style.flexGrow = 0;
|
||||
button.style.width = 100;
|
||||
_bottomToolbar.Add(button);
|
||||
}
|
||||
|
||||
// ProcessTime
|
||||
{
|
||||
ToolbarButton button = new ToolbarButton();
|
||||
button.text = "ProcessTime (ms)";
|
||||
button.style.flexGrow = 0;
|
||||
button.style.width = 130;
|
||||
_bottomToolbar.Add(button);
|
||||
}
|
||||
|
||||
// Status
|
||||
{
|
||||
ToolbarButton button = new ToolbarButton();
|
||||
button.text = "Status";
|
||||
button.style.flexGrow = 0;
|
||||
button.style.width = 100;
|
||||
_bottomToolbar.Add(button);
|
||||
}
|
||||
|
||||
// Desc
|
||||
{
|
||||
ToolbarButton button = new ToolbarButton();
|
||||
button.text = "Desc";
|
||||
button.style.flexGrow = 0;
|
||||
button.style.width = 500;
|
||||
_bottomToolbar.Add(button);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 填充页面数据
|
||||
/// </summary>
|
||||
public void FillViewData(DebugReport debugReport)
|
||||
{
|
||||
// 清空旧数据
|
||||
_operationTableView.ClearAll(false, true);
|
||||
_childTreeView.ClearAll();
|
||||
_childTreeView.RebuildView();
|
||||
|
||||
// 填充数据源
|
||||
_sourceDatas = new List<ITableData>(1000);
|
||||
foreach (var packageData in debugReport.PackageDatas)
|
||||
{
|
||||
foreach (var operationInfo in packageData.OperationInfos)
|
||||
{
|
||||
var rowData = new OperationTableData();
|
||||
rowData.PackageData = packageData;
|
||||
rowData.OperationInfo = operationInfo;
|
||||
rowData.AddStringValueCell("PackageName", packageData.PackageName);
|
||||
rowData.AddStringValueCell("OperationName", operationInfo.OperationName);
|
||||
rowData.AddLongValueCell("Priority", operationInfo.Priority);
|
||||
rowData.AddDoubleValueCell("Progress", operationInfo.Progress);
|
||||
rowData.AddStringValueCell("BeginTime", operationInfo.BeginTime);
|
||||
rowData.AddLongValueCell("LoadingTime", operationInfo.ProcessTime);
|
||||
rowData.AddStringValueCell("Status", operationInfo.Status.ToString());
|
||||
rowData.AddStringValueCell("Desc", operationInfo.OperationDesc);
|
||||
_sourceDatas.Add(rowData);
|
||||
}
|
||||
}
|
||||
_operationTableView.itemsSource = _sourceDatas;
|
||||
|
||||
// 重建视图
|
||||
RebuildView(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空页面
|
||||
/// </summary>
|
||||
public void ClearView()
|
||||
{
|
||||
_operationTableView.ClearAll(false, true);
|
||||
_operationTableView.RebuildView();
|
||||
|
||||
_childTreeView.ClearAll();
|
||||
_childTreeView.RebuildView();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重建视图
|
||||
/// </summary>
|
||||
public void RebuildView(string searchKeyWord)
|
||||
{
|
||||
// 搜索匹配
|
||||
if(_sourceDatas != null)
|
||||
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||
|
||||
// 重建视图
|
||||
_operationTableView.RebuildView();
|
||||
_childTreeView.RebuildView();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 挂接到父类页面上
|
||||
/// </summary>
|
||||
public void AttachParent(VisualElement parent)
|
||||
{
|
||||
parent.Add(_root);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从父类页面脱离开
|
||||
/// </summary>
|
||||
public void DetachParent()
|
||||
{
|
||||
_root.RemoveFromHierarchy();
|
||||
}
|
||||
|
||||
private void OnOperationTableViewSelectionChanged(ITableData data)
|
||||
{
|
||||
var operationTableData = data as OperationTableData;
|
||||
DebugPackageData packageData = operationTableData.PackageData;
|
||||
DebugOperationInfo operationInfo = operationTableData.OperationInfo;
|
||||
|
||||
TreeNode rootNode = new TreeNode(operationInfo);
|
||||
FillTreeData(operationInfo, rootNode);
|
||||
_childTreeView.ClearAll();
|
||||
_childTreeView.SetRootItem(rootNode);
|
||||
_childTreeView.RebuildView();
|
||||
}
|
||||
private void MakeTreeViewItem(VisualElement container)
|
||||
{
|
||||
// OperationName
|
||||
{
|
||||
Label label = new Label();
|
||||
label.name = "OperationName";
|
||||
label.style.flexGrow = 0f;
|
||||
label.style.width = 300;
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
container.Add(label);
|
||||
}
|
||||
|
||||
// Progress
|
||||
{
|
||||
var label = new Label();
|
||||
label.name = "Progress";
|
||||
label.style.flexGrow = 0f;
|
||||
label.style.width = 100;
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
container.Add(label);
|
||||
}
|
||||
|
||||
// BeginTime
|
||||
{
|
||||
var label = new Label();
|
||||
label.name = "BeginTime";
|
||||
label.style.flexGrow = 0f;
|
||||
label.style.width = 100;
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
container.Add(label);
|
||||
}
|
||||
|
||||
// ProcessTime
|
||||
{
|
||||
var label = new Label();
|
||||
label.name = "ProcessTime";
|
||||
label.style.flexGrow = 0f;
|
||||
label.style.width = 130;
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
container.Add(label);
|
||||
}
|
||||
|
||||
// Status
|
||||
{
|
||||
var label = new Label();
|
||||
label.name = "Status";
|
||||
label.style.flexGrow = 0f;
|
||||
label.style.width = 100;
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
container.Add(label);
|
||||
}
|
||||
|
||||
// Desc
|
||||
{
|
||||
Label label = new Label();
|
||||
label.name = "Desc";
|
||||
label.style.flexGrow = 1f;
|
||||
label.style.width = 500;
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
container.Add(label);
|
||||
}
|
||||
}
|
||||
private void BindTreeViewItem(VisualElement container, object userData)
|
||||
{
|
||||
var operationInfo = (DebugOperationInfo)userData;
|
||||
|
||||
// OperationName
|
||||
{
|
||||
var label = container.Q<Label>("OperationName");
|
||||
label.text = operationInfo.OperationName;
|
||||
}
|
||||
|
||||
// Progress
|
||||
{
|
||||
var label = container.Q<Label>("Progress");
|
||||
label.text = operationInfo.Progress.ToString();
|
||||
}
|
||||
|
||||
// BeginTime
|
||||
{
|
||||
var label = container.Q<Label>("BeginTime");
|
||||
label.text = operationInfo.BeginTime;
|
||||
}
|
||||
|
||||
// ProcessTime
|
||||
{
|
||||
var label = container.Q<Label>("ProcessTime");
|
||||
label.text = operationInfo.ProcessTime.ToString();
|
||||
}
|
||||
|
||||
// Status
|
||||
{
|
||||
StyleColor textColor;
|
||||
if (operationInfo.Status == EOperationStatus.Failed.ToString())
|
||||
textColor = new StyleColor(Color.yellow);
|
||||
else
|
||||
textColor = new StyleColor(Color.white);
|
||||
|
||||
var label = container.Q<Label>("Status");
|
||||
label.text = operationInfo.Status;
|
||||
label.style.color = textColor;
|
||||
}
|
||||
|
||||
// Desc
|
||||
{
|
||||
var label = container.Q<Label>("Desc");
|
||||
label.text = operationInfo.OperationDesc;
|
||||
}
|
||||
}
|
||||
private void FillTreeData(DebugOperationInfo parentOperation, TreeNode rootNode)
|
||||
{
|
||||
foreach (var childOperation in parentOperation.Childs)
|
||||
{
|
||||
var childNode = new TreeNode(childOperation);
|
||||
rootNode.AddChild(childNode);
|
||||
FillTreeData(childOperation, childNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: faabdaf3787cba6438d2300f7f71e26f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,9 @@
|
||||
<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;">
|
||||
<YooAsset.Editor.TableViewer name="TopTableView" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="BottomGroup" style="flex-grow: 1;">
|
||||
<uie:Toolbar name="BottomToolbar" />
|
||||
<YooAsset.Editor.TreeViewer name="BottomTreeView" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7147c7108cba1bb4dba3a2cfc758ad43
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
@ -24,8 +24,8 @@ namespace YooAsset.Editor
|
||||
private VisualTreeAsset _visualAsset;
|
||||
private TemplateContainer _root;
|
||||
|
||||
private TableView _assetTableView;
|
||||
private TableView _dependTableView;
|
||||
private TableViewer _assetTableView;
|
||||
private TableViewer _dependTableView;
|
||||
|
||||
private BuildReport _buildReport;
|
||||
private string _reportFilePath;
|
||||
@ -46,23 +46,22 @@ namespace YooAsset.Editor
|
||||
_root.style.flexGrow = 1f;
|
||||
|
||||
// 资源列表
|
||||
_assetTableView = _root.Q<TableView>("TopTableView");
|
||||
_assetTableView = _root.Q<TableViewer>("TopTableView");
|
||||
_assetTableView.SelectionChangedEvent = OnAssetTableViewSelectionChanged;
|
||||
_assetTableView.ClickTableDataEvent = OnClickAssetTableView;
|
||||
CreateAssetTableViewColumns();
|
||||
|
||||
// 依赖列表
|
||||
_dependTableView = _root.Q<TableView>("BottomTableView");
|
||||
_dependTableView = _root.Q<TableViewer>("BottomTableView");
|
||||
_dependTableView.ClickTableDataEvent = OnClickBundleTableView;
|
||||
CreateDependTableViewColumns();
|
||||
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
// 面板分屏
|
||||
var topGroup = _root.Q<VisualElement>("TopGroup");
|
||||
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||
topGroup.style.minHeight = 100;
|
||||
bottomGroup.style.minHeight = 100f;
|
||||
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
#endif
|
||||
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
}
|
||||
private void CreateAssetTableViewColumns()
|
||||
{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<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;">
|
||||
<YooAsset.Editor.TableView name="TopTableView" style="flex-grow: 1;" />
|
||||
<YooAsset.Editor.TableViewer name="TopTableView" style="flex-grow: 1;" />
|
||||
</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;">
|
||||
<YooAsset.Editor.TableView name="BottomTableView" style="flex-grow: 1;" />
|
||||
<YooAsset.Editor.TableViewer name="BottomTableView" style="flex-grow: 1;" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
||||
@ -24,8 +24,8 @@ namespace YooAsset.Editor
|
||||
private VisualTreeAsset _visualAsset;
|
||||
private TemplateContainer _root;
|
||||
|
||||
private TableView _bundleTableView;
|
||||
private TableView _includeTableView;
|
||||
private TableViewer _bundleTableView;
|
||||
private TableViewer _includeTableView;
|
||||
|
||||
private BuildReport _buildReport;
|
||||
private string _reportFilePath;
|
||||
@ -46,13 +46,13 @@ namespace YooAsset.Editor
|
||||
_root.style.flexGrow = 1f;
|
||||
|
||||
// 资源包列表
|
||||
_bundleTableView = _root.Q<TableView>("TopTableView");
|
||||
_bundleTableView = _root.Q<TableViewer>("TopTableView");
|
||||
_bundleTableView.ClickTableDataEvent = OnClickBundleTableView;
|
||||
_bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged;
|
||||
CreateBundleTableViewColumns();
|
||||
|
||||
// 包含列表
|
||||
_includeTableView = _root.Q<TableView>("BottomTableView");
|
||||
_includeTableView = _root.Q<TableViewer>("BottomTableView");
|
||||
_includeTableView.ClickTableDataEvent = OnClickIncludeTableView;
|
||||
CreateIncludeTableViewColumns();
|
||||
|
||||
@ -61,7 +61,7 @@ namespace YooAsset.Editor
|
||||
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||
topGroup.style.minHeight = 100;
|
||||
bottomGroup.style.minHeight = 100f;
|
||||
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
UIElementsTools.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||
#endif
|
||||
}
|
||||
private void CreateBundleTableViewColumns()
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<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;">
|
||||
<YooAsset.Editor.TableView name="TopTableView" style="flex-grow: 1;" />
|
||||
<YooAsset.Editor.TableViewer name="TopTableView" style="flex-grow: 1;" />
|
||||
</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;">
|
||||
<YooAsset.Editor.TableView name="BottomTableView" style="flex-grow: 1;" />
|
||||
<YooAsset.Editor.TableViewer name="BottomTableView" style="flex-grow: 1;" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa5d155c17551ca4bbecf15e9dc69435
|
||||
guid: 7f69598c1185588408737e4dc0a485f0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@ -1,41 +0,0 @@
|
||||
#if UNITY_2019_4_OR_NEWER
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 显示开关(眼睛图标)
|
||||
/// </summary>
|
||||
public class DisplayToggle : Toggle
|
||||
{
|
||||
private readonly VisualElement _checkbox;
|
||||
|
||||
public DisplayToggle()
|
||||
{
|
||||
_checkbox = this.Q<VisualElement>("unity-checkmark");
|
||||
RefreshIcon();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新图标
|
||||
/// </summary>
|
||||
public void RefreshIcon()
|
||||
{
|
||||
if (this.value)
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent("animationvisibilitytoggleoff@2x").image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent("animationvisibilitytoggleon@2x").image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1,36 +0,0 @@
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 分屏控件
|
||||
/// </summary>
|
||||
public class PanelSplitView : TwoPaneSplitView
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<PanelSplitView, UxmlTraits>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 竖版分屏
|
||||
/// </summary>
|
||||
public static void SplitVerticalPanel(VisualElement root, VisualElement panelA, VisualElement panelB)
|
||||
{
|
||||
root.Remove(panelA);
|
||||
root.Remove(panelB);
|
||||
|
||||
var spliteView = new PanelSplitView();
|
||||
spliteView.fixedPaneInitialDimension = 300;
|
||||
spliteView.orientation = TwoPaneSplitViewOrientation.Vertical;
|
||||
spliteView.contentContainer.Add(panelA);
|
||||
spliteView.contentContainer.Add(panelB);
|
||||
root.Add(spliteView);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
55
Editor/UIElements/ElementsDefine/ToggleDisplay.cs
Normal file
55
Editor/UIElements/ElementsDefine/ToggleDisplay.cs
Normal file
@ -0,0 +1,55 @@
|
||||
#if UNITY_2019_4_OR_NEWER
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 显示开关(眼睛图标)
|
||||
/// </summary>
|
||||
public class ToggleDisplay : Toggle
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<ToggleDisplay, UxmlTraits>
|
||||
{
|
||||
}
|
||||
|
||||
private readonly VisualElement _checkbox;
|
||||
|
||||
public ToggleDisplay()
|
||||
{
|
||||
_checkbox = this.Q<VisualElement>("unity-checkmark");
|
||||
RefreshIcon();
|
||||
}
|
||||
public override void SetValueWithoutNotify(bool newValue)
|
||||
{
|
||||
base.SetValueWithoutNotify(newValue);
|
||||
RefreshIcon();
|
||||
}
|
||||
|
||||
#if UNITY_2021_3_OR_NEWER
|
||||
protected override void ToggleValue()
|
||||
{
|
||||
base.ToggleValue();
|
||||
RefreshIcon();
|
||||
}
|
||||
#endif
|
||||
|
||||
private void RefreshIcon()
|
||||
{
|
||||
if (this.value)
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.VisibilityToggleOff).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.VisibilityToggleOn).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
55
Editor/UIElements/ElementsDefine/ToggleFoldout.cs
Normal file
55
Editor/UIElements/ElementsDefine/ToggleFoldout.cs
Normal file
@ -0,0 +1,55 @@
|
||||
#if UNITY_2019_4_OR_NEWER
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 折叠开关
|
||||
/// </summary>
|
||||
public class ToggleFoldout : Toggle
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<ToggleFoldout, UxmlTraits>
|
||||
{
|
||||
}
|
||||
|
||||
private readonly VisualElement _checkbox;
|
||||
|
||||
public ToggleFoldout()
|
||||
{
|
||||
_checkbox = this.Q<VisualElement>("unity-checkmark");
|
||||
RefreshIcon();
|
||||
}
|
||||
public override void SetValueWithoutNotify(bool newValue)
|
||||
{
|
||||
base.SetValueWithoutNotify(newValue);
|
||||
RefreshIcon();
|
||||
}
|
||||
|
||||
#if UNITY_2021_3_OR_NEWER
|
||||
protected override void ToggleValue()
|
||||
{
|
||||
base.ToggleValue();
|
||||
RefreshIcon();
|
||||
}
|
||||
#endif
|
||||
|
||||
public void RefreshIcon()
|
||||
{
|
||||
if (this.value)
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.FoldoutOn).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.FoldoutOff).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Editor/UIElements/ElementsDefine/ToggleFoldout.cs.meta
Normal file
11
Editor/UIElements/ElementsDefine/ToggleFoldout.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2619997e70d98794da26a947f9129e25
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
55
Editor/UIElements/ElementsDefine/ToggleRecord.cs
Normal file
55
Editor/UIElements/ElementsDefine/ToggleRecord.cs
Normal file
@ -0,0 +1,55 @@
|
||||
#if UNITY_2019_4_OR_NEWER
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 录制开关
|
||||
/// </summary>
|
||||
public class ToggleRecord : Toggle
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<ToggleRecord, UxmlTraits>
|
||||
{
|
||||
}
|
||||
|
||||
private readonly VisualElement _checkbox;
|
||||
|
||||
public ToggleRecord()
|
||||
{
|
||||
_checkbox = this.Q<VisualElement>("unity-checkmark");
|
||||
RefreshIcon();
|
||||
}
|
||||
public override void SetValueWithoutNotify(bool newValue)
|
||||
{
|
||||
base.SetValueWithoutNotify(newValue);
|
||||
RefreshIcon();
|
||||
}
|
||||
|
||||
#if UNITY_2021_3_OR_NEWER
|
||||
protected override void ToggleValue()
|
||||
{
|
||||
base.ToggleValue();
|
||||
RefreshIcon();
|
||||
}
|
||||
#endif
|
||||
|
||||
private void RefreshIcon()
|
||||
{
|
||||
if (this.value)
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.RecordOn).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.RecordOff).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Editor/UIElements/ElementsDefine/ToggleRecord.cs.meta
Normal file
11
Editor/UIElements/ElementsDefine/ToggleRecord.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4eace285493a0844f8a8b8f4a4ea02d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -46,6 +46,11 @@ namespace YooAsset.Editor
|
||||
/// </summary>
|
||||
public bool Counter = false;
|
||||
|
||||
/// <summary>
|
||||
/// 展示单位
|
||||
/// </summary>
|
||||
public string Units = string.Empty;
|
||||
|
||||
public ColumnStyle(Length width)
|
||||
{
|
||||
if (width.value > MaxValue)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user