Compare commits

..

30 Commits

Author SHA1 Message Date
何冠峰
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
157 changed files with 2163 additions and 435 deletions

View File

@@ -2,6 +2,47 @@
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.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,109 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using UnityEditor;
namespace YooAsset.Editor
{
[InitializeOnLoad]
public class MacrosProcessor : AssetPostprocessor
{
static MacrosProcessor()
{
}
/// <summary>
/// YooAsset版本宏定义
/// </summary>
private static readonly List<string> YooAssetMacros = new List<string>()
{
"YOO_ASSET_2",
"YOO_ASSET_2_3",
"YOO_ASSET_2_3_OR_NEWER",
};
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 YooAssetMacros)
{
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;
}
}
}

View File

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

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

@@ -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

@@ -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()
{ {
if (_currentPlayerSession != null) _nextRepaintIndex = -1;
{ _lastRepaintIndex = 0;
_rangeIndex = 0;
_frameSlider.label = $"Frame:"; _frameSlider.label = $"Frame:";
_frameSlider.value = 0; _frameSlider.value = 0;
_frameSlider.lowValue = 0; _frameSlider.lowValue = 0;
_frameSlider.highValue = 0; _frameSlider.highValue = 0;
_currentPlayerSession.ClearDebugReport();
_assetListViewer.ClearView(); _assetListViewer.ClearView();
_bundleListViewer.ClearView(); _bundleListViewer.ClearView();
_operationListViewer.ClearView(); _operationListViewer.ClearView();
if (_currentPlayerSession != null)
{
_currentPlayerSession.ClearDebugReport();
} }
} }
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()
{ {
// 发送采集数据的命令 // 发送采集数据的命令
@@ -347,6 +339,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 +352,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)
{ {
// 搜索匹配 // 搜索匹配
if (_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord); 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)
{ {
// 搜索匹配 // 搜索匹配
if(_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord); 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,6 +350,7 @@ namespace YooAsset.Editor
public void RebuildView(string searchKeyWord) public void RebuildView(string searchKeyWord)
{ {
// 搜索匹配 // 搜索匹配
if(_sourceDatas != null)
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord); DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
// 重建视图 // 重建视图
@@ -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();

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

@@ -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,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)
{ {

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

@@ -147,15 +147,15 @@ namespace YooAsset
} }
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION) else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
{ {
AppendFileExtension = (bool)value; AppendFileExtension = Convert.ToBoolean(value);
} }
else if (name == FileSystemParametersDefine.DISABLE_CATALOG_FILE) else if (name == FileSystemParametersDefine.DISABLE_CATALOG_FILE)
{ {
DisableCatalogFile = (bool)value; DisableCatalogFile = Convert.ToBoolean(value);
} }
else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST) else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST)
{ {
CopyBuildinPackageManifest = (bool)value; CopyBuildinPackageManifest = Convert.ToBoolean(value);
} }
else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT) else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT)
{ {
@@ -239,6 +239,11 @@ namespace YooAsset
if (Exists(bundle) == false) if (Exists(bundle) == false)
return null; return null;
#if UNITY_ANDROID
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
YooLogger.Error($"Android platform not support read buildin bundle file data !");
return null;
#else
if (bundle.Encrypted) if (bundle.Encrypted)
{ {
if (DecryptionServices == null) if (DecryptionServices == null)
@@ -261,6 +266,7 @@ namespace YooAsset
string filePath = GetBuildinFileLoadPath(bundle); string filePath = GetBuildinFileLoadPath(bundle);
return FileUtility.ReadAllBytes(filePath); return FileUtility.ReadAllBytes(filePath);
} }
#endif
} }
public virtual string ReadBundleFileText(PackageBundle bundle) public virtual string ReadBundleFileText(PackageBundle bundle)
{ {
@@ -270,6 +276,11 @@ namespace YooAsset
if (Exists(bundle) == false) if (Exists(bundle) == false)
return null; return null;
#if UNITY_ANDROID
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
YooLogger.Error($"Android platform not support read buildin bundle file text !");
return null;
#else
if (bundle.Encrypted) if (bundle.Encrypted)
{ {
if (DecryptionServices == null) if (DecryptionServices == null)
@@ -292,6 +303,7 @@ namespace YooAsset
string filePath = GetBuildinFileLoadPath(bundle); string filePath = GetBuildinFileLoadPath(bundle);
return FileUtility.ReadAllText(filePath); return FileUtility.ReadAllText(filePath);
} }
#endif
} }
#region #region

View File

@@ -176,6 +176,12 @@ namespace YooAsset
if (_steps == ESteps.LoadBuildinRawBundle) if (_steps == ESteps.LoadBuildinRawBundle)
{ {
#if UNITY_ANDROID
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
_steps = ESteps.Done;
Result = new RawBundleResult(_fileSystem, _bundle);
Status = EOperationStatus.Succeed;
#else
string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle); string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle);
if (File.Exists(filePath)) if (File.Exists(filePath))
{ {
@@ -190,6 +196,7 @@ namespace YooAsset
Error = $"Can not found buildin raw bundle file : {filePath}"; Error = $"Can not found buildin raw bundle file : {filePath}";
YooLogger.Error(Error); YooLogger.Error(Error);
} }
#endif
} }
} }
internal override void InternalWaitForAsyncComplete() internal override void InternalWaitForAsyncComplete()

View File

@@ -190,19 +190,19 @@ namespace YooAsset
} }
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION) else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
{ {
AppendFileExtension = (bool)value; AppendFileExtension = Convert.ToBoolean(value);
} }
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_CONCURRENCY) else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_CONCURRENCY)
{ {
DownloadMaxConcurrency = (int)value; DownloadMaxConcurrency = Convert.ToInt32(value);
} }
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_REQUEST_PER_FRAME) else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_REQUEST_PER_FRAME)
{ {
DownloadMaxRequestPerFrame = (int)value; DownloadMaxRequestPerFrame = Convert.ToInt32(value);
} }
else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_MINMUM_SIZE) else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_MINMUM_SIZE)
{ {
ResumeDownloadMinimumSize = (long)value; ResumeDownloadMinimumSize = Convert.ToInt64(value);
} }
else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_RESPONSE_CODES) else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_RESPONSE_CODES)
{ {

View File

@@ -94,11 +94,11 @@ namespace YooAsset
{ {
if (name == FileSystemParametersDefine.ASYNC_SIMULATE_MIN_FRAME) if (name == FileSystemParametersDefine.ASYNC_SIMULATE_MIN_FRAME)
{ {
_asyncSimulateMinFrame = (int)value; _asyncSimulateMinFrame = Convert.ToInt32(value);
} }
else if (name == FileSystemParametersDefine.ASYNC_SIMULATE_MAX_FRAME) else if (name == FileSystemParametersDefine.ASYNC_SIMULATE_MAX_FRAME)
{ {
_asyncSimulateMaxFrame = (int)value; _asyncSimulateMaxFrame = Convert.ToInt32(value);
} }
else else
{ {

View File

@@ -101,7 +101,7 @@ namespace YooAsset
{ {
if (name == FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE) if (name == FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE)
{ {
DisableUnityWebCache = (bool)value; DisableUnityWebCache = Convert.ToBoolean(value);
} }
else if (name == FileSystemParametersDefine.REMOTE_SERVICES) else if (name == FileSystemParametersDefine.REMOTE_SERVICES)
{ {

View File

@@ -110,7 +110,7 @@ namespace YooAsset
{ {
if (name == FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE) if (name == FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE)
{ {
DisableUnityWebCache = (bool)value; DisableUnityWebCache = Convert.ToBoolean(value);
} }
else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES) else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
{ {

View File

@@ -35,6 +35,11 @@ namespace YooAsset
DownloadProgress = 0; DownloadProgress = 0;
} }
internal override string InternalGetDesc()
{
return $"RefCount : {RefCount}";
}
/// <summary> /// <summary>
/// 减少引用计数 /// 减少引用计数
/// </summary> /// </summary>

View File

@@ -6,6 +6,14 @@ namespace YooAsset
{ {
internal class OperationSystem internal class OperationSystem
{ {
#if UNITY_EDITOR
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
DestroyAll();
}
#endif
private static readonly List<AsyncOperationBase> _operations = new List<AsyncOperationBase>(1000); private static readonly List<AsyncOperationBase> _operations = new List<AsyncOperationBase>(1000);
private static readonly List<AsyncOperationBase> _newList = new List<AsyncOperationBase>(1000); private static readonly List<AsyncOperationBase> _newList = new List<AsyncOperationBase>(1000);

View File

@@ -13,6 +13,11 @@ namespace YooAsset
/// </summary> /// </summary>
public string BuildPipelineName; public string BuildPipelineName;
/// <summary>
/// 用户数据
/// </summary>
public object BuildUserData;
/// <summary> /// <summary>
/// 构建类所属程序集名称 /// 构建类所属程序集名称
/// </summary> /// </summary>

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
namespace YooAsset
{
internal static class HandleFactory
{
private static readonly Dictionary<Type, Func<ProviderOperation, HandleBase>> _handleFactory = new Dictionary<Type, Func<ProviderOperation, HandleBase>>()
{
{ typeof(AssetHandle), op => new AssetHandle(op) },
{ typeof(SceneHandle), op => new SceneHandle(op) },
{ typeof(SubAssetsHandle), op => new SubAssetsHandle(op) },
{ typeof(AllAssetsHandle), op => new AllAssetsHandle(op) },
{ typeof(RawFileHandle), op => new RawFileHandle(op) }
};
public static HandleBase CreateHandle(ProviderOperation operation, Type type)
{
if (_handleFactory.TryGetValue(type, out var factory) == false)
{
throw new NotImplementedException($"Handle type {type.FullName} is not supported.");
}
return factory(operation);
}
}
}

View File

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

View File

@@ -1,7 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System; using System.Linq;
namespace YooAsset namespace YooAsset
{ {
@@ -69,8 +69,8 @@ namespace YooAsset
private ESteps _steps = ESteps.None; private ESteps _steps = ESteps.None;
private readonly LoadBundleFileOperation _mainBundleLoader; private readonly LoadBundleFileOperation _mainBundleLoader;
private readonly List<LoadBundleFileOperation> _bundleLoaders = new List<LoadBundleFileOperation>(); private readonly List<LoadBundleFileOperation> _bundleLoaders = new List<LoadBundleFileOperation>(10);
private readonly List<HandleBase> _handles = new List<HandleBase>(); private readonly HashSet<HandleBase> _handles = new HashSet<HandleBase>();
public ProviderOperation(ResourceManager manager, string providerGUID, AssetInfo assetInfo) public ProviderOperation(ResourceManager manager, string providerGUID, AssetInfo assetInfo)
@@ -220,20 +220,7 @@ namespace YooAsset
// 引用计数增加 // 引用计数增加
RefCount++; RefCount++;
HandleBase handle; HandleBase handle = HandleFactory.CreateHandle(this, typeof(T));
if (typeof(T) == typeof(AssetHandle))
handle = new AssetHandle(this);
else if (typeof(T) == typeof(SceneHandle))
handle = new SceneHandle(this);
else if (typeof(T) == typeof(SubAssetsHandle))
handle = new SubAssetsHandle(this);
else if (typeof(T) == typeof(AllAssetsHandle))
handle = new AllAssetsHandle(this);
else if (typeof(T) == typeof(RawFileHandle))
handle = new RawFileHandle(this);
else
throw new System.NotImplementedException();
_handles.Add(handle); _handles.Add(handle);
return handle as T; return handle as T;
} }
@@ -258,9 +245,9 @@ namespace YooAsset
/// </summary> /// </summary>
public void ReleaseAllHandles() public void ReleaseAllHandles()
{ {
for (int i = _handles.Count - 1; i >= 0; i--) List<HandleBase> tempers = _handles.ToList();
foreach (var handle in tempers)
{ {
var handle = _handles[i];
handle.Release(); handle.Release();
} }
} }
@@ -276,7 +263,7 @@ namespace YooAsset
// 注意:创建临时列表是为了防止外部逻辑在回调函数内创建或者释放资源句柄。 // 注意:创建临时列表是为了防止外部逻辑在回调函数内创建或者释放资源句柄。
// 注意:回调方法如果发生异常,会阻断列表里的后续回调方法! // 注意:回调方法如果发生异常,会阻断列表里的后续回调方法!
List<HandleBase> tempers = new List<HandleBase>(_handles); List<HandleBase> tempers = _handles.ToList();
foreach (var hande in tempers) foreach (var hande in tempers)
{ {
if (hande.IsValid) if (hande.IsValid)

View File

@@ -385,7 +385,7 @@ namespace YooAsset
var bundleInfo = new DebugBundleInfo(); var bundleInfo = new DebugBundleInfo();
bundleInfo.BundleName = packageBundle.BundleName; bundleInfo.BundleName = packageBundle.BundleName;
bundleInfo.RefCount = bundleLoader.RefCount; bundleInfo.RefCount = bundleLoader.RefCount;
bundleInfo.Status = bundleLoader.Status; bundleInfo.Status = bundleLoader.Status.ToString();
bundleInfo.ReferenceBundles = FilterReferenceBundles(packageBundle); bundleInfo.ReferenceBundles = FilterReferenceBundles(packageBundle);
result.Add(bundleInfo); result.Add(bundleInfo);
} }

View File

@@ -3,10 +3,18 @@ using UnityEngine;
namespace YooAsset namespace YooAsset
{ {
internal static class YooAssetSettingsData public static class YooAssetSettingsData
{ {
#if UNITY_EDITOR
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
_setting = null;
}
#endif
private static YooAssetSettings _setting = null; private static YooAssetSettings _setting = null;
public static YooAssetSettings Setting internal static YooAssetSettings Setting
{ {
get get
{ {
@@ -33,6 +41,15 @@ namespace YooAsset
} }
} }
/// <summary>
/// 获取YooAsset文件夹名称
/// </summary>
public static string GetDefaultYooFolderName()
{
return Setting.DefaultYooFolderName;
}
/// <summary> /// <summary>
/// 获取构建报告文件名 /// 获取构建报告文件名
/// </summary> /// </summary>
@@ -92,7 +109,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 获取YOO的Resources目录的加载路径 /// 获取YOO的Resources目录的加载路径
/// </summary> /// </summary>
public static string GetYooResourcesLoadPath(string packageName, string fileName) internal static string GetYooResourcesLoadPath(string packageName, string fileName)
{ {
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName)) if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return PathUtility.Combine(packageName, fileName); return PathUtility.Combine(packageName, fileName);
@@ -103,7 +120,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 获取YOO的Resources目录的全路径 /// 获取YOO的Resources目录的全路径
/// </summary> /// </summary>
public static string GetYooResourcesFullPath() internal static string GetYooResourcesFullPath()
{ {
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName)) if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return $"Assets/Resources"; return $"Assets/Resources";
@@ -114,7 +131,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 获取YOO的编辑器下缓存文件根目录 /// 获取YOO的编辑器下缓存文件根目录
/// </summary> /// </summary>
public static string GetYooEditorCacheRoot() internal static string GetYooEditorCacheRoot()
{ {
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName)) if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
{ {
@@ -132,9 +149,9 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 获取YOO的PC缓存文件根目录 /// 获取YOO的PC平台缓存文件根目录
/// </summary> /// </summary>
public static string GetYooStandaloneCacheRoot() internal static string GetYooStandaloneWinCacheRoot()
{ {
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName)) if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.dataPath; return Application.dataPath;
@@ -143,9 +160,31 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 获取YOO的移动端缓存文件根目录 /// 获取YOO的Linux平台缓存文件根目录
/// </summary> /// </summary>
public static string GetYooMobileCacheRoot() internal static string GetYooStandaloneLinuxCacheRoot()
{
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.dataPath;
else
return PathUtility.Combine(Application.dataPath, Setting.DefaultYooFolderName);
}
/// <summary>
/// 获取YOO的Mac平台缓存文件根目录
/// </summary>
internal static string GetYooStandaloneMacCacheRoot()
{
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.persistentDataPath;
else
return PathUtility.Combine(Application.persistentDataPath, Setting.DefaultYooFolderName);
}
/// <summary>
/// 获取YOO的移动平台缓存文件根目录
/// </summary>
internal static string GetYooMobileCacheRoot()
{ {
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName)) if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.persistentDataPath; return Application.persistentDataPath;
@@ -156,12 +195,16 @@ namespace YooAsset
/// <summary> /// <summary>
/// 获取YOO默认的缓存文件根目录 /// 获取YOO默认的缓存文件根目录
/// </summary> /// </summary>
public static string GetYooDefaultCacheRoot() internal static string GetYooDefaultCacheRoot()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return GetYooEditorCacheRoot(); return GetYooEditorCacheRoot();
#elif UNITY_STANDALONE #elif UNITY_STANDALONE_WIN
return GetYooStandaloneCacheRoot(); return GetYooStandaloneWinCacheRoot();
#elif UNITY_STANDALONE_LINUX
return GetYooStandaloneLinuxCacheRoot();
#elif UNITY_STANDALONE_OSX
return GetYooStandaloneMacCacheRoot();
#else #else
return GetYooMobileCacheRoot(); return GetYooMobileCacheRoot();
#endif #endif
@@ -170,7 +213,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 获取YOO默认的内置文件根目录 /// 获取YOO默认的内置文件根目录
/// </summary> /// </summary>
public static string GetYooDefaultBuildinRoot() internal static string GetYooDefaultBuildinRoot()
{ {
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName)) if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
return Application.streamingAssetsPath; return Application.streamingAssetsPath;

View File

@@ -9,6 +9,22 @@
"precompiledReferences": [], "precompiledReferences": [],
"autoReferenced": true, "autoReferenced": true,
"defineConstraints": [], "defineConstraints": [],
"versionDefines": [], "versionDefines": [
{
"name": "com.tuyoogame.yooasset",
"expression": "",
"define": "YOO_ASSET_2"
},
{
"name": "com.tuyoogame.yooasset",
"expression": "2.3",
"define": "YOO_ASSET_2_3"
},
{
"name": "com.tuyoogame.yooasset",
"expression": "2.3",
"define": "YOO_ASSET_2_3_OR_NEWER"
}
],
"noEngineReferences": false "noEngineReferences": false
} }

View File

@@ -2,12 +2,23 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
namespace YooAsset namespace YooAsset
{ {
public static partial class YooAssets public static partial class YooAssets
{ {
#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
_isInitialize = false;
_packages.Clear();
_defaultPackage = null;
}
#endif
private static bool _isInitialize = false; private static bool _isInitialize = false;
private static GameObject _driver = null; private static GameObject _driver = null;
private static readonly List<ResourcePackage> _packages = new List<ResourcePackage>(); private static readonly List<ResourcePackage> _packages = new List<ResourcePackage>();
@@ -77,9 +88,9 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 创建资源包 /// 创建资源包
/// </summary> /// </summary>
/// <param name="packageName">资源包名称</param> /// <param name="packageName">包名称</param>
public static ResourcePackage CreatePackage(string packageName) public static ResourcePackage CreatePackage(string packageName)
{ {
CheckException(packageName); CheckException(packageName);
@@ -93,9 +104,9 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 获取资源包 /// 获取资源包
/// </summary> /// </summary>
/// <param name="packageName">资源包名称</param> /// <param name="packageName">包名称</param>
public static ResourcePackage GetPackage(string packageName) public static ResourcePackage GetPackage(string packageName)
{ {
CheckException(packageName); CheckException(packageName);
@@ -106,9 +117,9 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 尝试获取资源包 /// 尝试获取资源包
/// </summary> /// </summary>
/// <param name="packageName">资源包名称</param> /// <param name="packageName">包名称</param>
public static ResourcePackage TryGetPackage(string packageName) public static ResourcePackage TryGetPackage(string packageName)
{ {
CheckException(packageName); CheckException(packageName);
@@ -116,9 +127,17 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 移除资源包 /// 获取所有资源包
/// </summary> /// </summary>
/// <param name="packageName">资源包名称</param> public static List<ResourcePackage> GetAllPackages()
{
return _packages.ToList();
}
/// <summary>
/// 移除资源包裹
/// </summary>
/// <param name="packageName">包裹名称</param>
public static bool RemovePackage(string packageName) public static bool RemovePackage(string packageName)
{ {
CheckException(packageName); CheckException(packageName);
@@ -130,9 +149,9 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 移除资源包 /// 移除资源包
/// </summary> /// </summary>
/// <param name="package">资源包实例对象</param> /// <param name="package">包实例对象</param>
public static bool RemovePackage(ResourcePackage package) public static bool RemovePackage(ResourcePackage package)
{ {
CheckException(package); CheckException(package);
@@ -149,9 +168,9 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 检测资源包是否存在 /// 检测资源包是否存在
/// </summary> /// </summary>
/// <param name="packageName">资源包名称</param> /// <param name="packageName">包名称</param>
public static bool ContainsPackage(string packageName) public static bool ContainsPackage(string packageName)
{ {
CheckException(packageName); CheckException(packageName);

View File

@@ -5,6 +5,14 @@ namespace YooAsset
{ {
internal class YooAssetsDriver : MonoBehaviour internal class YooAssetsDriver : MonoBehaviour
{ {
#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnRuntimeInitialize()
{
LastestUpdateFrame = 0;
}
#endif
private static int LastestUpdateFrame = 0; private static int LastestUpdateFrame = 0;
void Update() void Update()

View File

@@ -44,10 +44,10 @@ public class TextureSchema : ScannerSchema
string name = "扫描所有纹理资产"; string name = "扫描所有纹理资产";
string desc = GetUserGuide(); string desc = GetUserGuide();
var report = new ScanReport(name, desc); var report = new ScanReport(name, desc);
report.AddHeader("资源路径", 600, 500, 1000).SetStretchable().SetSearchable().SetSortable().SetHeaderType(EHeaderType.AssetPath); report.AddHeader("资源路径", 600, 500, 1000).SetStretchable().SetSearchable().SetSortable().SetCounter().SetHeaderType(EHeaderType.AssetPath);
report.AddHeader("图片宽度", 100).SetSortable().SetHeaderType(EHeaderType.LongValue); report.AddHeader("图片宽度", 100).SetSortable().SetHeaderType(EHeaderType.LongValue);
report.AddHeader("图片高度", 100).SetSortable().SetHeaderType(EHeaderType.LongValue); report.AddHeader("图片高度", 100).SetSortable().SetHeaderType(EHeaderType.LongValue);
report.AddHeader("内存大小", 100).SetSortable().SetHeaderType(EHeaderType.LongValue); report.AddHeader("内存大小", 120).SetSortable().SetUnits("bytes").SetHeaderType(EHeaderType.LongValue);
report.AddHeader("苹果格式", 100); report.AddHeader("苹果格式", 100);
report.AddHeader("安卓格式", 100); report.AddHeader("安卓格式", 100);
report.AddHeader("错误信息", 500).SetStretchable(); report.AddHeader("错误信息", 500).SetStretchable();

View File

@@ -70,17 +70,19 @@ internal class FsmInitializePackage : IStateNode
// WebGL运行模式 // WebGL运行模式
if (playMode == EPlayMode.WebPlayMode) if (playMode == EPlayMode.WebPlayMode)
{ {
var createParameters = new WebPlayModeParameters();
#if UNITY_WEBGL && WEIXINMINIGAME && !UNITY_EDITOR #if UNITY_WEBGL && WEIXINMINIGAME && !UNITY_EDITOR
var createParameters = new WebPlayModeParameters();
string defaultHostServer = GetHostServerURL(); string defaultHostServer = GetHostServerURL();
string fallbackHostServer = GetHostServerURL(); string fallbackHostServer = GetHostServerURL();
string packageRoot = $"{WeChatWASM.WX.env.USER_DATA_PATH}/__GAME_FILE_CACHE"; //注意:如果有子目录,请修改此处! string packageRoot = $"{WeChatWASM.WX.env.USER_DATA_PATH}/__GAME_FILE_CACHE"; //注意:如果有子目录,请修改此处!
IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer); IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
createParameters.WebServerFileSystemParameters = WechatFileSystemCreater.CreateFileSystemParameters(packageRoot, remoteServices); createParameters.WebServerFileSystemParameters = WechatFileSystemCreater.CreateFileSystemParameters(packageRoot, remoteServices);
#else
createParameters.WebServerFileSystemParameters = FileSystemParameters.CreateDefaultWebServerFileSystemParameters(new WebDecryption());
#endif
initializationOperation = package.InitializeAsync(createParameters); initializationOperation = package.InitializeAsync(createParameters);
#else
var createParameters = new WebPlayModeParameters();
createParameters.WebServerFileSystemParameters = FileSystemParameters.CreateDefaultWebServerFileSystemParameters();
initializationOperation = package.InitializeAsync(createParameters);
#endif
} }
yield return initializationOperation; yield return initializationOperation;
@@ -149,24 +151,4 @@ internal class FsmInitializePackage : IStateNode
return $"{_fallbackHostServer}/{fileName}"; return $"{_fallbackHostServer}/{fileName}";
} }
} }
private class WebDecryption : IWebDecryptionServices
{
public const byte KEY = 64;
public WebDecryptResult LoadAssetBundle(WebDecryptFileInfo fileInfo)
{
byte[] copyData = new byte[fileInfo.FileData.Length];
Buffer.BlockCopy(fileInfo.FileData, 0, copyData, 0, fileInfo.FileData.Length);
for (int i = 0; i < copyData.Length; i++)
{
copyData[i] ^= KEY;
}
WebDecryptResult decryptResult = new WebDecryptResult();
decryptResult.Result = AssetBundle.LoadFromMemory(copyData);
return decryptResult;
}
}
} }

View File

@@ -15,17 +15,22 @@ public static class TestPackageBuilder
if (buildPipelineName == EBuildPipeline.EditorSimulateBuildPipeline.ToString()) if (buildPipelineName == EBuildPipeline.EditorSimulateBuildPipeline.ToString())
{ {
string projectPath = EditorTools.GetProjectPath();
string outputRoot = $"{projectPath}/Bundles/Tester_ESBP";
var buildParameters = new EditorSimulateBuildParameters(); var buildParameters = new EditorSimulateBuildParameters();
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot(); buildParameters.BuildOutputRoot = outputRoot;
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot(); buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = EBuildPipeline.EditorSimulateBuildPipeline.ToString(); buildParameters.BuildPipeline = EBuildPipeline.EditorSimulateBuildPipeline.ToString();
buildParameters.BuildBundleType = (int)EBuildBundleType.VirtualBundle; buildParameters.BuildBundleType = (int)EBuildBundleType.VirtualBundle;
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget; buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
buildParameters.PackageName = packageName; buildParameters.PackageName = packageName;
buildParameters.PackageVersion = "ESBP_Simulate"; buildParameters.PackageVersion = "TestVersion";
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.ClearBuildCacheFiles = true;
buildParameters.UseAssetDependencyDB = true;
var pipeline = new EditorSimulateBuildPipeline(); var pipeline = new EditorSimulateBuildPipeline();
BuildResult buildResult = pipeline.Run(buildParameters, false); BuildResult buildResult = pipeline.Run(buildParameters, false);
@@ -43,16 +48,20 @@ public static class TestPackageBuilder
} }
else if (buildPipelineName == EBuildPipeline.ScriptableBuildPipeline.ToString()) else if (buildPipelineName == EBuildPipeline.ScriptableBuildPipeline.ToString())
{ {
string projectPath = EditorTools.GetProjectPath();
string outputRoot = $"{projectPath}/Bundles/Tester_SBP";
// 内置着色器资源包名称 // 内置着色器资源包名称
var builtinShaderBundleName = GetBuiltinShaderBundleName(packageName); var builtinShaderBundleName = GetBuiltinShaderBundleName(packageName);
var buildParameters = new ScriptableBuildParameters(); var buildParameters = new ScriptableBuildParameters();
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
buildParameters.BuildOutputRoot = outputRoot;
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot(); buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = EBuildPipeline.ScriptableBuildPipeline.ToString(); buildParameters.BuildPipeline = EBuildPipeline.ScriptableBuildPipeline.ToString();
buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle; buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget; buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
buildParameters.PackageName = packageName; buildParameters.PackageName = packageName;
buildParameters.PackageVersion = "SBP_Simulate"; buildParameters.PackageVersion = "TestVersion";
buildParameters.EnableSharePackRule = true; buildParameters.EnableSharePackRule = true;
buildParameters.VerifyBuildingResult = true; buildParameters.VerifyBuildingResult = true;
buildParameters.FileNameStyle = EFileNameStyle.HashName; buildParameters.FileNameStyle = EFileNameStyle.HashName;
@@ -62,6 +71,7 @@ public static class TestPackageBuilder
buildParameters.ClearBuildCacheFiles = true; buildParameters.ClearBuildCacheFiles = true;
buildParameters.UseAssetDependencyDB = true; buildParameters.UseAssetDependencyDB = true;
buildParameters.BuiltinShadersBundleName = builtinShaderBundleName; buildParameters.BuiltinShadersBundleName = builtinShaderBundleName;
buildParameters.EncryptionServices = new FileStreamEncryption();
var pipeline = new ScriptableBuildPipeline(); var pipeline = new ScriptableBuildPipeline();
BuildResult buildResult = pipeline.Run(buildParameters, false); BuildResult buildResult = pipeline.Run(buildParameters, false);
@@ -79,14 +89,17 @@ public static class TestPackageBuilder
} }
else if (buildPipelineName == EBuildPipeline.BuiltinBuildPipeline.ToString()) else if (buildPipelineName == EBuildPipeline.BuiltinBuildPipeline.ToString())
{ {
string projectPath = EditorTools.GetProjectPath();
string outputRoot = $"{projectPath}/Bundles/Tester_BBP";
var buildParameters = new BuiltinBuildParameters(); var buildParameters = new BuiltinBuildParameters();
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot(); buildParameters.BuildOutputRoot = outputRoot;
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot(); buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = EBuildPipeline.ScriptableBuildPipeline.ToString(); buildParameters.BuildPipeline = EBuildPipeline.ScriptableBuildPipeline.ToString();
buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle; buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget; buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
buildParameters.PackageName = packageName; buildParameters.PackageName = packageName;
buildParameters.PackageVersion = "BBP_Simulate"; buildParameters.PackageVersion = "TestVersion";
buildParameters.EnableSharePackRule = true; buildParameters.EnableSharePackRule = true;
buildParameters.VerifyBuildingResult = true; buildParameters.VerifyBuildingResult = true;
buildParameters.FileNameStyle = EFileNameStyle.HashName; buildParameters.FileNameStyle = EFileNameStyle.HashName;
@@ -95,6 +108,7 @@ public static class TestPackageBuilder
buildParameters.CompressOption = ECompressOption.LZ4; buildParameters.CompressOption = ECompressOption.LZ4;
buildParameters.ClearBuildCacheFiles = true; buildParameters.ClearBuildCacheFiles = true;
buildParameters.UseAssetDependencyDB = true; buildParameters.UseAssetDependencyDB = true;
buildParameters.EncryptionServices = new FileStreamEncryption();
var pipeline = new BuiltinBuildPipeline(); var pipeline = new BuiltinBuildPipeline();
BuildResult buildResult = pipeline.Run(buildParameters, false); BuildResult buildResult = pipeline.Run(buildParameters, false);
@@ -112,14 +126,17 @@ public static class TestPackageBuilder
} }
else if (buildPipelineName == EBuildPipeline.RawFileBuildPipeline.ToString()) else if (buildPipelineName == EBuildPipeline.RawFileBuildPipeline.ToString())
{ {
string projectPath = EditorTools.GetProjectPath();
string outputRoot = $"{projectPath}/Bundles/Tester_RFBP";
var buildParameters = new RawFileBuildParameters(); var buildParameters = new RawFileBuildParameters();
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot(); buildParameters.BuildOutputRoot = outputRoot;
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot(); buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = EBuildPipeline.RawFileBuildPipeline.ToString(); buildParameters.BuildPipeline = EBuildPipeline.RawFileBuildPipeline.ToString();
buildParameters.BuildBundleType = (int)EBuildBundleType.RawBundle; buildParameters.BuildBundleType = (int)EBuildBundleType.RawBundle;
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget; buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
buildParameters.PackageName = packageName; buildParameters.PackageName = packageName;
buildParameters.PackageVersion = "RFBP_Simulate"; buildParameters.PackageVersion = "TestVersion";
buildParameters.VerifyBuildingResult = true; buildParameters.VerifyBuildingResult = true;
buildParameters.FileNameStyle = EFileNameStyle.HashName; buildParameters.FileNameStyle = EFileNameStyle.HashName;
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None; buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;

View File

@@ -1,6 +0,0 @@

public class AssetBundleCollectorDefine
{
public const string TestPackageName = "TestPackage";
public const string RawPackageName = "RawPackage";
}

View File

@@ -1,28 +0,0 @@
using System;
using System.IO;
using System.Text;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.U2D;
using UnityEngine.TestTools;
using NUnit.Framework;
using YooAsset;
public class AssetBundleCollectorPreapre : IPrebuildSetup, IPostBuildCleanup
{
void IPrebuildSetup.Setup()
{
AssetBundleCollectorMaker.MakeCollectorSettingData();
}
void IPostBuildCleanup.Cleanup()
{
}
[Test]
public void InitializeYooAssets()
{
// 初始化YooAsset
YooAssets.Initialize();
}
}

View File

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

View File

@@ -3,19 +3,37 @@ using System.IO;
using System.Text; using System.Text;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using UnityEngine.U2D;
using UnityEngine.TestTools; using UnityEngine.TestTools;
using NUnit.Framework;
using YooAsset; using YooAsset;
public static class AssetBundleCollectorMaker public class T0_InitYooAssets : IPrebuildSetup, IPostBuildCleanup
{ {
public static void MakeCollectorSettingData() void IPrebuildSetup.Setup()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
// 清空旧数据 // 清空旧数据
YooAsset.Editor.AssetBundleCollectorSettingData.ClearAll(); YooAsset.Editor.AssetBundleCollectorSettingData.ClearAll();
// 创建正常文件Package // 创建包裹配置
var testPackage = YooAsset.Editor.AssetBundleCollectorSettingData.CreatePackage(AssetBundleCollectorDefine.TestPackageName); CreateAssetBundlePackageCollector();
CreateRawBundlePackageCollector();
// 修正配置路径为空导致的错误
YooAsset.Editor.AssetBundleCollectorSettingData.FixFile();
#endif
}
void IPostBuildCleanup.Cleanup()
{
}
#if UNITY_EDITOR
private static void CreateAssetBundlePackageCollector()
{
// 创建AssetBundlePackage
var testPackage = YooAsset.Editor.AssetBundleCollectorSettingData.CreatePackage(TestDefine.AssetBundlePackageName);
testPackage.EnableAddressable = true; testPackage.EnableAddressable = true;
testPackage.AutoCollectShaders = true; testPackage.AutoCollectShaders = true;
testPackage.IgnoreRuleName = "NormalIgnoreRule"; testPackage.IgnoreRuleName = "NormalIgnoreRule";
@@ -104,8 +122,67 @@ public static class AssetBundleCollectorMaker
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(scriptableObjectGroup, collector1); YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(scriptableObjectGroup, collector1);
} }
// 创建原生文件Package // 引用测试文件
var rawPackage = YooAsset.Editor.AssetBundleCollectorSettingData.CreatePackage(AssetBundleCollectorDefine.RawPackageName); var referenceGroup = YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(testPackage, "ReferenceGroup");
{
var collector1 = new YooAsset.Editor.AssetBundleCollector();
collector1.CollectPath = "";
collector1.CollectorGUID = "26b9f7e0454f2bc4a84b44a018075d8f"; //TestRes2/PanelA目录
collector1.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
collector1.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(referenceGroup, collector1);
var collector2 = new YooAsset.Editor.AssetBundleCollector();
collector2.CollectPath = "";
collector2.CollectorGUID = "b5cace4be4d008e408c0738f157708a0"; //TestRes2/PanelB目录
collector2.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
collector2.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(referenceGroup, collector2);
var collector3 = new YooAsset.Editor.AssetBundleCollector();
collector3.CollectPath = "";
collector3.CollectorGUID = "aa7f70ef09d60844ba62f85ff2414a9c"; //TestRes2/PanelAImage目录
collector3.CollectorType = YooAsset.Editor.ECollectorType.DependAssetCollector;
collector3.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(referenceGroup, collector3);
var collector4 = new YooAsset.Editor.AssetBundleCollector();
collector4.CollectPath = "";
collector4.CollectorGUID = "96d800f068cc69c4dbd20ffdcec40920"; //TestRes2/PanelBImage目录
collector4.CollectorType = YooAsset.Editor.ECollectorType.DependAssetCollector;
collector4.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(referenceGroup, collector4);
var collector5 = new YooAsset.Editor.AssetBundleCollector();
collector5.CollectPath = "";
collector5.CollectorGUID = "4264f3aa222d7f548a028d6c3411b1b0"; //TestRes2/PanelMat目录
collector5.CollectorType = YooAsset.Editor.ECollectorType.DependAssetCollector;
collector5.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(referenceGroup, collector5);
}
// 加密测试文件
var encryptGroup = YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(testPackage, "EncryptGroup");
{
var collector1 = new YooAsset.Editor.AssetBundleCollector();
collector1.CollectPath = "";
collector1.CollectorGUID = "e082d492b9da65e499cee3495be3645d"; //TestRes3/music目录
collector1.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
collector1.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(referenceGroup, collector1);
var collector2 = new YooAsset.Editor.AssetBundleCollector();
collector2.CollectPath = "";
collector2.CollectorGUID = "8c5a1726d94498e4cbe30f5f510cc796"; //TestRes3/prefab目录
collector2.CollectorType = YooAsset.Editor.ECollectorType.MainAssetCollector;
collector2.PackRuleName = nameof(YooAsset.Editor.PackDirectory);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(referenceGroup, collector2);
}
}
private static void CreateRawBundlePackageCollector()
{
// 创建RawBundlePackage
var rawPackage = YooAsset.Editor.AssetBundleCollectorSettingData.CreatePackage(TestDefine.RawBundlePackageName);
rawPackage.EnableAddressable = true; rawPackage.EnableAddressable = true;
rawPackage.AutoCollectShaders = true; rawPackage.AutoCollectShaders = true;
rawPackage.IgnoreRuleName = "RawFileIgnoreRule"; rawPackage.IgnoreRuleName = "RawFileIgnoreRule";
@@ -131,9 +208,13 @@ public static class AssetBundleCollectorMaker
collector1.PackRuleName = nameof(YooAsset.Editor.PackVideoFile); collector1.PackRuleName = nameof(YooAsset.Editor.PackVideoFile);
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(videoFileGroup, collector1); YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(videoFileGroup, collector1);
} }
}
// 修正配置路径为空导致的错误
YooAsset.Editor.AssetBundleCollectorSettingData.FixFile();
#endif #endif
[Test]
public void InitializeYooAssets()
{
// 初始化YooAsset
YooAssets.Initialize();
} }
} }

View File

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

View File

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

View File

@@ -9,34 +9,34 @@ using UnityEngine.TestTools;
using NUnit.Framework; using NUnit.Framework;
using YooAsset; using YooAsset;
public class EditorFileSystemTester : IPrebuildSetup, IPostBuildCleanup public class T1_TestEditorFileSystem : IPrebuildSetup, IPostBuildCleanup
{ {
private const string EFS_TEST_PACKAGE_ROOT_KEY = "EFS_TEST_PACKAGE_ROOT_KEY"; private const string ASSET_BUNDLE_PACKAGE_ROOT_KEY = "T1_ASSET_BUNDLE_PACKAGE_ROOT_KEY";
private const string EFS_RAW_PACKAGE_ROOT_KEY = "EFS_RAW_PACKAGE_ROOT_KEY"; private const string RAW_BUNDLE_PACKAGE_ROOT_KEY = "T1_RAW_BUNDLE_PACKAGE_ROOT_KEY";
void IPrebuildSetup.Setup() void IPrebuildSetup.Setup()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
// 构建TestPackage // 构建资源包
{ {
var simulateParams = new PackageInvokeBuildParam(AssetBundleCollectorDefine.TestPackageName); var simulateParams = new PackageInvokeBuildParam(TestDefine.AssetBundlePackageName);
simulateParams.BuildPipelineName = "EditorSimulateBuildPipeline"; simulateParams.BuildPipelineName = "EditorSimulateBuildPipeline";
simulateParams.InvokeAssmeblyName = "YooAsset.Test.Editor"; simulateParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
simulateParams.InvokeClassFullName = "TestPackageBuilder"; simulateParams.InvokeClassFullName = "TestPackageBuilder";
simulateParams.InvokeMethodName = "BuildPackage"; simulateParams.InvokeMethodName = "BuildPackage";
var simulateResult = PakcageInvokeBuilder.InvokeBuilder(simulateParams); var simulateResult = PakcageInvokeBuilder.InvokeBuilder(simulateParams);
UnityEditor.EditorPrefs.SetString(EFS_TEST_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory); UnityEditor.EditorPrefs.SetString(ASSET_BUNDLE_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory);
} }
// 构建RawPackage // 构建资源包
{ {
var simulateParams = new PackageInvokeBuildParam(AssetBundleCollectorDefine.RawPackageName); var simulateParams = new PackageInvokeBuildParam(TestDefine.RawBundlePackageName);
simulateParams.BuildPipelineName = "EditorSimulateBuildPipeline"; simulateParams.BuildPipelineName = "EditorSimulateBuildPipeline";
simulateParams.InvokeAssmeblyName = "YooAsset.Test.Editor"; simulateParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
simulateParams.InvokeClassFullName = "TestPackageBuilder"; simulateParams.InvokeClassFullName = "TestPackageBuilder";
simulateParams.InvokeMethodName = "BuildPackage"; simulateParams.InvokeMethodName = "BuildPackage";
var simulateResult = PakcageInvokeBuilder.InvokeBuilder(simulateParams); var simulateResult = PakcageInvokeBuilder.InvokeBuilder(simulateParams);
UnityEditor.EditorPrefs.SetString(EFS_RAW_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory); UnityEditor.EditorPrefs.SetString(RAW_BUNDLE_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory);
} }
#endif #endif
} }
@@ -45,48 +45,18 @@ public class EditorFileSystemTester : IPrebuildSetup, IPostBuildCleanup
} }
[UnityTest] [UnityTest]
public IEnumerator DestroyPackage() public IEnumerator A_InitializePackage()
{ {
// 销毁旧资源包 // 初始化资源包
{
var package = YooAssets.GetPackage(AssetBundleCollectorDefine.TestPackageName);
var destroyOp = package.DestroyAsync();
yield return destroyOp;
if (destroyOp.Status != EOperationStatus.Succeed)
Debug.LogError(destroyOp.Error);
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
bool result = YooAssets.RemovePackage(AssetBundleCollectorDefine.TestPackageName);
Assert.IsTrue(result);
}
// 销毁旧资源包
{
var package = YooAssets.GetPackage(AssetBundleCollectorDefine.RawPackageName);
var destroyOp = package.DestroyAsync();
yield return destroyOp;
if (destroyOp.Status != EOperationStatus.Succeed)
Debug.LogError(destroyOp.Error);
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
bool result = YooAssets.RemovePackage(AssetBundleCollectorDefine.RawPackageName);
Assert.IsTrue(result);
}
}
[UnityTest]
public IEnumerator InitializePackage()
{
// 初始化TestPackage
{ {
string packageRoot = string.Empty; string packageRoot = string.Empty;
#if UNITY_EDITOR #if UNITY_EDITOR
packageRoot = UnityEditor.EditorPrefs.GetString(EFS_TEST_PACKAGE_ROOT_KEY); packageRoot = UnityEditor.EditorPrefs.GetString(ASSET_BUNDLE_PACKAGE_ROOT_KEY);
#endif #endif
if (Directory.Exists(packageRoot) == false) if (Directory.Exists(packageRoot) == false)
throw new Exception($"Not found package root : {packageRoot}"); throw new Exception($"Not found package root : {packageRoot}");
var package = YooAssets.CreatePackage(AssetBundleCollectorDefine.TestPackageName); var package = YooAssets.CreatePackage(TestDefine.AssetBundlePackageName);
// 初始化资源包 // 初始化资源包
var initParams = new EditorSimulateModeParameters(); var initParams = new EditorSimulateModeParameters();
@@ -112,16 +82,16 @@ public class EditorFileSystemTester : IPrebuildSetup, IPostBuildCleanup
Assert.AreEqual(EOperationStatus.Succeed, updateManifestOp.Status); Assert.AreEqual(EOperationStatus.Succeed, updateManifestOp.Status);
} }
// 初始化RawPackage // 初始化资源包
{ {
string packageRoot = string.Empty; string packageRoot = string.Empty;
#if UNITY_EDITOR #if UNITY_EDITOR
packageRoot = UnityEditor.EditorPrefs.GetString(EFS_RAW_PACKAGE_ROOT_KEY); packageRoot = UnityEditor.EditorPrefs.GetString(RAW_BUNDLE_PACKAGE_ROOT_KEY);
#endif #endif
if (Directory.Exists(packageRoot) == false) if (Directory.Exists(packageRoot) == false)
throw new Exception($"Not found package root : {packageRoot}"); throw new Exception($"Not found package root : {packageRoot}");
var package = YooAssets.CreatePackage(AssetBundleCollectorDefine.RawPackageName); var package = YooAssets.CreatePackage(TestDefine.RawBundlePackageName);
// 初始化资源包 // 初始化资源包
var initParams = new EditorSimulateModeParameters(); var initParams = new EditorSimulateModeParameters();
@@ -149,65 +119,95 @@ public class EditorFileSystemTester : IPrebuildSetup, IPostBuildCleanup
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadAsyncTask() public IEnumerator B1_TestLoadAsyncTask()
{ {
var tester = new TestLoadPanel(); var tester = new TestLoadPanel();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadAudio() public IEnumerator B2_TestLoadAudio()
{ {
var tester = new TestLoadAudio(); var tester = new TestLoadAudio();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadImage() public IEnumerator B3_TestLoadImage()
{ {
var tester = new TestLoadImage(); var tester = new TestLoadImage();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadPrefab() public IEnumerator B4_TestLoadPrefab()
{ {
var tester = new TestLoadPrefab(); var tester = new TestLoadPrefab();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadScene() public IEnumerator B5_TestLoadSpriteAtlas()
{
var tester = new TestLoadScene();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator TestLoadScriptableObject()
{
var tester = new TestLoadScriptableObject();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator TestLoadSpriteAtlas()
{ {
var tester = new TestLoadSpriteAtlas(); var tester = new TestLoadSpriteAtlas();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadRawFile() public IEnumerator B6_TestLoadScriptableObject()
{
var tester = new TestLoadScriptableObject();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator B7_TestLoadScene()
{
var tester = new TestLoadScene();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator B8_TestLoadRawFile()
{ {
var tester = new TestLoadRawFile(); var tester = new TestLoadRawFile();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadVideo() public IEnumerator B9_TestLoadVideo()
{ {
var tester = new TestLoadVideo(); var tester = new TestLoadVideo();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest]
public IEnumerator C_DestroyPackage()
{
// 销毁旧资源包
{
var package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
var destroyOp = package.DestroyAsync();
yield return destroyOp;
if (destroyOp.Status != EOperationStatus.Succeed)
Debug.LogError(destroyOp.Error);
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
bool result = YooAssets.RemovePackage(TestDefine.AssetBundlePackageName);
Assert.IsTrue(result);
}
// 销毁旧资源包
{
var package = YooAssets.GetPackage(TestDefine.RawBundlePackageName);
var destroyOp = package.DestroyAsync();
yield return destroyOp;
if (destroyOp.Status != EOperationStatus.Succeed)
Debug.LogError(destroyOp.Error);
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
bool result = YooAssets.RemovePackage(TestDefine.RawBundlePackageName);
Assert.IsTrue(result);
}
}
} }

View File

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

View File

@@ -9,34 +9,34 @@ using UnityEngine.TestTools;
using NUnit.Framework; using NUnit.Framework;
using YooAsset; using YooAsset;
public class BuildinFileSystemTester : IPrebuildSetup, IPostBuildCleanup public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
{ {
private const string BFS_TEST_PACKAGE_ROOT_KEY = "BFS_TEST_PACKAGE_ROOT_KEY"; private const string ASSET_BUNDLE_PACKAGE_ROOT_KEY = "T2_ASSET_BUNDLE_PACKAGE_ROOT_KEY";
private const string BFS_RAW_PACKAGE_ROOT_KEY = "BFS_RAW_PACKAGE_ROOT_KEY"; private const string RAW_BUNDLE_PACKAGE_ROOT_KEY = "T2_RAW_BUNDLE_PACKAGE_ROOT_KEY";
void IPrebuildSetup.Setup() void IPrebuildSetup.Setup()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
// 构建TestPackage // 构建AssetBundlePackage
{ {
var buildParams = new PackageInvokeBuildParam(AssetBundleCollectorDefine.TestPackageName); var buildParams = new PackageInvokeBuildParam(TestDefine.AssetBundlePackageName);
buildParams.BuildPipelineName = "ScriptableBuildPipeline"; buildParams.BuildPipelineName = "ScriptableBuildPipeline";
buildParams.InvokeAssmeblyName = "YooAsset.Test.Editor"; buildParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
buildParams.InvokeClassFullName = "TestPackageBuilder"; buildParams.InvokeClassFullName = "TestPackageBuilder";
buildParams.InvokeMethodName = "BuildPackage"; buildParams.InvokeMethodName = "BuildPackage";
var simulateResult = PakcageInvokeBuilder.InvokeBuilder(buildParams); var simulateResult = PakcageInvokeBuilder.InvokeBuilder(buildParams);
UnityEditor.EditorPrefs.SetString(BFS_TEST_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory); UnityEditor.EditorPrefs.SetString(ASSET_BUNDLE_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory);
} }
// 构建RawPackage // 构建RawBundlePackage
{ {
var buildParams = new PackageInvokeBuildParam(AssetBundleCollectorDefine.RawPackageName); var buildParams = new PackageInvokeBuildParam(TestDefine.RawBundlePackageName);
buildParams.BuildPipelineName = "RawFileBuildPipeline"; buildParams.BuildPipelineName = "RawFileBuildPipeline";
buildParams.InvokeAssmeblyName = "YooAsset.Test.Editor"; buildParams.InvokeAssmeblyName = "YooAsset.Test.Editor";
buildParams.InvokeClassFullName = "TestPackageBuilder"; buildParams.InvokeClassFullName = "TestPackageBuilder";
buildParams.InvokeMethodName = "BuildPackage"; buildParams.InvokeMethodName = "BuildPackage";
var simulateResult = PakcageInvokeBuilder.InvokeBuilder(buildParams); var simulateResult = PakcageInvokeBuilder.InvokeBuilder(buildParams);
UnityEditor.EditorPrefs.SetString(BFS_RAW_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory); UnityEditor.EditorPrefs.SetString(RAW_BUNDLE_PACKAGE_ROOT_KEY, simulateResult.PackageRootDirectory);
} }
#endif #endif
} }
@@ -45,22 +45,23 @@ public class BuildinFileSystemTester : IPrebuildSetup, IPostBuildCleanup
} }
[UnityTest] [UnityTest]
public IEnumerator InitializePackage() public IEnumerator A_InitializePackage()
{ {
// 初始化TestPackage // 初始化资源包
{ {
string packageRoot = string.Empty; string packageRoot = string.Empty;
#if UNITY_EDITOR #if UNITY_EDITOR
packageRoot = UnityEditor.EditorPrefs.GetString(BFS_TEST_PACKAGE_ROOT_KEY); packageRoot = UnityEditor.EditorPrefs.GetString(ASSET_BUNDLE_PACKAGE_ROOT_KEY);
#endif #endif
if (Directory.Exists(packageRoot) == false) if (Directory.Exists(packageRoot) == false)
throw new Exception($"Not found package root : {packageRoot}"); throw new Exception($"Not found package root : {packageRoot}");
var package = YooAssets.CreatePackage(AssetBundleCollectorDefine.TestPackageName); var package = YooAssets.CreatePackage(TestDefine.AssetBundlePackageName);
// 初始化资源包 // 初始化资源包
var initParams = new OfflinePlayModeParameters(); var initParams = new OfflinePlayModeParameters();
initParams.BuildinFileSystemParameters = FileSystemParameters.CreateDefaultBuildinFileSystemParameters(null, packageRoot); var decryption = new FileStreamDecryption();
initParams.BuildinFileSystemParameters = FileSystemParameters.CreateDefaultBuildinFileSystemParameters(decryption, packageRoot);
var initializeOp = package.InitializeAsync(initParams); var initializeOp = package.InitializeAsync(initParams);
yield return initializeOp; yield return initializeOp;
if (initializeOp.Status != EOperationStatus.Succeed) if (initializeOp.Status != EOperationStatus.Succeed)
@@ -82,16 +83,16 @@ public class BuildinFileSystemTester : IPrebuildSetup, IPostBuildCleanup
Assert.AreEqual(EOperationStatus.Succeed, updateManifestOp.Status); Assert.AreEqual(EOperationStatus.Succeed, updateManifestOp.Status);
} }
// 初始化RawPackage // 初始化资源包
{ {
string packageRoot = string.Empty; string packageRoot = string.Empty;
#if UNITY_EDITOR #if UNITY_EDITOR
packageRoot = UnityEditor.EditorPrefs.GetString(BFS_RAW_PACKAGE_ROOT_KEY); packageRoot = UnityEditor.EditorPrefs.GetString(RAW_BUNDLE_PACKAGE_ROOT_KEY);
#endif #endif
if (Directory.Exists(packageRoot) == false) if (Directory.Exists(packageRoot) == false)
throw new Exception($"Not found package root : {packageRoot}"); throw new Exception($"Not found package root : {packageRoot}");
var package = YooAssets.CreatePackage(AssetBundleCollectorDefine.RawPackageName); var package = YooAssets.CreatePackage(TestDefine.RawBundlePackageName);
// 初始化资源包 // 初始化资源包
var initParams = new OfflinePlayModeParameters(); var initParams = new OfflinePlayModeParameters();
@@ -120,65 +121,109 @@ public class BuildinFileSystemTester : IPrebuildSetup, IPostBuildCleanup
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadAsyncTask() public IEnumerator B1_TestLoadAsyncTask()
{ {
var tester = new TestLoadPanel(); var tester = new TestLoadPanel();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadAudio() public IEnumerator B2_TestLoadAudio()
{ {
var tester = new TestLoadAudio(); var tester = new TestLoadAudio();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadImage() public IEnumerator B3_TestLoadImage()
{ {
var tester = new TestLoadImage(); var tester = new TestLoadImage();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadPrefab() public IEnumerator B4_TestLoadPrefab()
{ {
var tester = new TestLoadPrefab(); var tester = new TestLoadPrefab();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadScene() public IEnumerator B5_TestLoadSpriteAtlas()
{
var tester = new TestLoadScene();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator TestLoadScriptableObject()
{
var tester = new TestLoadScriptableObject();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator TestLoadSpriteAtlas()
{ {
var tester = new TestLoadSpriteAtlas(); var tester = new TestLoadSpriteAtlas();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadRawFile() public IEnumerator B6_TestLoadScriptableObject()
{
var tester = new TestLoadScriptableObject();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator B7_TestLoadScene()
{
var tester = new TestLoadScene();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator B8_TestLoadRawFile()
{ {
var tester = new TestLoadRawFile(); var tester = new TestLoadRawFile();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest] [UnityTest]
public IEnumerator TestLoadVideo() public IEnumerator B9_TestLoadVideo()
{ {
var tester = new TestLoadVideo(); var tester = new TestLoadVideo();
yield return tester.RuntimeTester(); yield return tester.RuntimeTester();
} }
[UnityTest]
public IEnumerator C1_TestBundleReference()
{
var tester = new TestBundleReference();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator C2_TestBundleEncryption()
{
var tester = new TestBundleEncryption();
yield return tester.RuntimeTester();
}
[UnityTest]
public IEnumerator D_DestroyPackage()
{
// 销毁旧资源包
{
var package = YooAssets.GetPackage(TestDefine.AssetBundlePackageName);
var destroyOp = package.DestroyAsync();
yield return destroyOp;
if (destroyOp.Status != EOperationStatus.Succeed)
Debug.LogError(destroyOp.Error);
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
bool result = YooAssets.RemovePackage(TestDefine.AssetBundlePackageName);
Assert.IsTrue(result);
}
// 销毁旧资源包
{
var package = YooAssets.GetPackage(TestDefine.RawBundlePackageName);
var destroyOp = package.DestroyAsync();
yield return destroyOp;
if (destroyOp.Status != EOperationStatus.Succeed)
Debug.LogError(destroyOp.Error);
Assert.AreEqual(EOperationStatus.Succeed, destroyOp.Status);
bool result = YooAssets.RemovePackage(TestDefine.RawBundlePackageName);
Assert.IsTrue(result);
}
}
} }

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