mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-28 19:48:47 +00:00
Compare commits
47 Commits
b74a44dc36
...
2.3.5-prev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6155256fb6 | ||
|
|
0d4f2bc893 | ||
|
|
600e928ab4 | ||
|
|
4599ff098c | ||
|
|
4d2df5b705 | ||
|
|
79a7732cfd | ||
|
|
79467bbf13 | ||
|
|
c7d678282b | ||
|
|
d376afc217 | ||
|
|
a62f808591 | ||
|
|
b334a4986b | ||
|
|
a4111349a0 | ||
|
|
bdcf95384f | ||
|
|
d910af589d | ||
|
|
0531864534 | ||
|
|
72b1278f5c | ||
|
|
875cd24cba | ||
|
|
fcc729a0bf | ||
|
|
d10e54248b | ||
|
|
b84800a905 | ||
|
|
8ccd7e552c | ||
|
|
772ba484eb | ||
|
|
cdbedee705 | ||
|
|
10cce48e71 | ||
|
|
13e8410d80 | ||
|
|
6f07faf4da | ||
|
|
e3228d406e | ||
|
|
daf2133535 | ||
|
|
9bcbc10862 | ||
|
|
e6958d205e | ||
|
|
b03d9db2b0 | ||
|
|
30853b6d62 | ||
|
|
a7cafcb328 | ||
|
|
d03bca5512 | ||
|
|
af3fc50188 | ||
|
|
b71eeeb855 | ||
|
|
317c42521a | ||
|
|
064d69269e | ||
|
|
9e6401d3c0 | ||
|
|
2aaba328ee | ||
|
|
62fdc93a82 | ||
|
|
408f0942ee | ||
|
|
ddda9e29db | ||
|
|
c2b33f5ec4 | ||
|
|
e58999e484 | ||
|
|
ed9692574c | ||
|
|
f7e078e064 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -20,6 +20,8 @@
|
|||||||
/Assets/StreamingAssets.meta
|
/Assets/StreamingAssets.meta
|
||||||
/Assets/Samples
|
/Assets/Samples
|
||||||
/Assets/Samples.meta
|
/Assets/Samples.meta
|
||||||
|
/Assets/csc.rsp
|
||||||
|
/Assets/csc.rsp.meta
|
||||||
/UserSettings
|
/UserSettings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,56 @@
|
|||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
|
## [2.3.5-preview] - 2025-03-14
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#502) 修复了原生缓存文件由于文件格式变动导致的加载本地缓存文件失败的问题。
|
||||||
|
- (#504) 修复了MacOS平台Offline Play Mode模式请求本地资源清单失败的问题。
|
||||||
|
- (#506) 修复了v2.3x版本LoadAllAssets方法计算依赖Bundle不完整的问题。
|
||||||
|
- (#506) 修复了微信小游戏文件系统,在启用加密算法后卸载bundle报错的问题。
|
||||||
|
|
||||||
|
## [2.3.4-preview] - 2025-03-08
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|||||||
8
Assets/YooAsset/Editor/Assembly.meta
Normal file
8
Assets/YooAsset/Editor/Assembly.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fab3cd742c11be2479b07f5d447a78c9
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
17
Assets/YooAsset/Editor/Assembly/MacroDefine.cs
Normal file
17
Assets/YooAsset/Editor/Assembly/MacroDefine.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class MacroDefine
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// YooAsset版本宏定义
|
||||||
|
/// </summary>
|
||||||
|
public static readonly List<string> Macros = new List<string>()
|
||||||
|
{
|
||||||
|
"YOO_ASSET_2",
|
||||||
|
"YOO_ASSET_2_3",
|
||||||
|
"YOO_ASSET_2_3_OR_NEWER",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 07f7c95e8e42fd04f81b9925b2dcf0d0
|
guid: a61e5c2ca04aab647b1ed0492086aa8f
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
96
Assets/YooAsset/Editor/Assembly/MacroProcessor.cs
Normal file
96
Assets/YooAsset/Editor/Assembly/MacroProcessor.cs
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
[InitializeOnLoad]
|
||||||
|
public class MacroProcessor : AssetPostprocessor
|
||||||
|
{
|
||||||
|
static string OnGeneratedCSProject(string path, string content)
|
||||||
|
{
|
||||||
|
XmlDocument xmlDoc = new XmlDocument();
|
||||||
|
xmlDoc.LoadXml(content);
|
||||||
|
|
||||||
|
if (IsCSProjectReferenced(xmlDoc.DocumentElement) == false)
|
||||||
|
return content;
|
||||||
|
|
||||||
|
if (ProcessDefineConstants(xmlDoc.DocumentElement) == false)
|
||||||
|
return content;
|
||||||
|
|
||||||
|
// 将修改后的XML结构重新输出为文本
|
||||||
|
var stringWriter = new StringWriter();
|
||||||
|
var writerSettings = new XmlWriterSettings();
|
||||||
|
writerSettings.Indent = true;
|
||||||
|
var xmlWriter = XmlWriter.Create(stringWriter, writerSettings);
|
||||||
|
xmlDoc.WriteTo(xmlWriter);
|
||||||
|
xmlWriter.Flush();
|
||||||
|
return stringWriter.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理宏定义
|
||||||
|
/// </summary>
|
||||||
|
private static bool ProcessDefineConstants(XmlElement element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool processed = false;
|
||||||
|
foreach (XmlNode node in element.ChildNodes)
|
||||||
|
{
|
||||||
|
if (node.Name != "PropertyGroup")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
foreach (XmlNode childNode in node.ChildNodes)
|
||||||
|
{
|
||||||
|
if (childNode.Name != "DefineConstants")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string[] defines = childNode.InnerText.Split(';');
|
||||||
|
HashSet<string> hashSets = new HashSet<string>(defines);
|
||||||
|
foreach (string yooMacro in MacroDefine.Macros)
|
||||||
|
{
|
||||||
|
string tmpMacro = yooMacro.Trim();
|
||||||
|
if (hashSets.Contains(tmpMacro) == false)
|
||||||
|
hashSets.Add(tmpMacro);
|
||||||
|
}
|
||||||
|
childNode.InnerText = string.Join(";", hashSets.ToArray());
|
||||||
|
processed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return processed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检测工程是否引用了YooAsset
|
||||||
|
/// </summary>
|
||||||
|
private static bool IsCSProjectReferenced(XmlElement element)
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
foreach (XmlNode node in element.ChildNodes)
|
||||||
|
{
|
||||||
|
if (node.Name != "ItemGroup")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
foreach (XmlNode childNode in node.ChildNodes)
|
||||||
|
{
|
||||||
|
if (childNode.Name != "Reference" && childNode.Name != "ProjectReference")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string include = childNode.Attributes["Include"].Value;
|
||||||
|
if (include.Contains("YooAsset"))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 88e4ec854876f3f40bce38bc880c0f6a
|
guid: 88d5a41d078a82e40b82265ed4c3631a
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
115
Assets/YooAsset/Editor/Assembly/RspGenerator.cs
Normal file
115
Assets/YooAsset/Editor/Assembly/RspGenerator.cs
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
#if YOO_ASSET_EXPERIMENT
|
||||||
|
namespace YooAsset.Editor.Experiment
|
||||||
|
{
|
||||||
|
[InitializeOnLoad]
|
||||||
|
public class RspGenerator
|
||||||
|
{
|
||||||
|
// csc.rsp文件路径
|
||||||
|
private static string RspFilePath => Path.Combine(Application.dataPath, "csc.rsp");
|
||||||
|
|
||||||
|
static RspGenerator()
|
||||||
|
{
|
||||||
|
UpdateRspFile(MacroDefine.Macros, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新csc.rsp文件
|
||||||
|
/// </summary>
|
||||||
|
private static void UpdateRspFile(List<string> addMacros, List<string> removeMacros)
|
||||||
|
{
|
||||||
|
var existingDefines = new HashSet<string>();
|
||||||
|
var otherLines = new List<string>();
|
||||||
|
|
||||||
|
// 1. 读取现有内容
|
||||||
|
ReadRspFile(existingDefines, otherLines);
|
||||||
|
|
||||||
|
// 2. 添加新宏
|
||||||
|
if (addMacros != null && addMacros.Count > 0)
|
||||||
|
{
|
||||||
|
addMacros.ForEach(x =>
|
||||||
|
{
|
||||||
|
if (existingDefines.Contains(x) == false)
|
||||||
|
existingDefines.Add(x);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 移除指定宏
|
||||||
|
if (removeMacros != null && removeMacros.Count > 0)
|
||||||
|
{
|
||||||
|
removeMacros.ForEach(x =>
|
||||||
|
{
|
||||||
|
existingDefines.Remove(x);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 重新生成内容
|
||||||
|
WriteRspFile(existingDefines, otherLines);
|
||||||
|
|
||||||
|
// 5. 刷新AssetDatabase
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
EditorUtility.RequestScriptReload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取csc.rsp文件,返回宏定义和其他行
|
||||||
|
/// </summary>
|
||||||
|
private static void ReadRspFile(HashSet<string> defines, List<string> others)
|
||||||
|
{
|
||||||
|
if (defines == null)
|
||||||
|
defines = new HashSet<string>();
|
||||||
|
|
||||||
|
if (others == null)
|
||||||
|
others = new List<string>();
|
||||||
|
|
||||||
|
if (File.Exists(RspFilePath) == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (string line in File.ReadAllLines(RspFilePath))
|
||||||
|
{
|
||||||
|
if (line.StartsWith("-define:"))
|
||||||
|
{
|
||||||
|
string[] parts = line.Split(new[] { ':' }, 2);
|
||||||
|
if (parts.Length == 2)
|
||||||
|
{
|
||||||
|
defines.Add(parts[1].Trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
others.Add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重新写入csc.rsp文件
|
||||||
|
/// </summary>
|
||||||
|
private static void WriteRspFile(HashSet<string> defines, List<string> others)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if (others != null && others.Count > 0)
|
||||||
|
{
|
||||||
|
others.ForEach(o => sb.AppendLine(o));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defines != null && defines.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (string define in defines)
|
||||||
|
{
|
||||||
|
sb.AppendLine($"-define:{define}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllText(RspFilePath, sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
11
Assets/YooAsset/Editor/Assembly/RspGenerator.cs.meta
Normal file
11
Assets/YooAsset/Editor/Assembly/RspGenerator.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c2662e1d33b1eea469695b68d18b1739
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -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 = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 忽略的文件类型
|
/// 忽略的文件类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly static HashSet<string> IgnoreFileExtensions = new HashSet<string>() { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
|
public readonly static HashSet<string> IgnoreFileExtensions = new HashSet<string>() { "", ".so", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ namespace YooAsset.Editor
|
|||||||
private string _searchKeyWord;
|
private string _searchKeyWord;
|
||||||
private DebugReport _currentReport;
|
private DebugReport _currentReport;
|
||||||
private RemotePlayerSession _currentPlayerSession;
|
private RemotePlayerSession _currentPlayerSession;
|
||||||
|
|
||||||
|
private double _lastRepaintTime = 0;
|
||||||
|
private int _nextRepaintIndex = -1;
|
||||||
|
private int _lastRepaintIndex = 0;
|
||||||
private int _rangeIndex = 0;
|
private int _rangeIndex = 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -161,6 +165,19 @@ namespace YooAsset.Editor
|
|||||||
RemoteEditorConnection.Instance.Unregister(RemoteDebuggerDefine.kMsgPlayerSendToEditor);
|
RemoteEditorConnection.Instance.Unregister(RemoteDebuggerDefine.kMsgPlayerSendToEditor);
|
||||||
_playerSessions.Clear();
|
_playerSessions.Clear();
|
||||||
}
|
}
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
// 每间隔1秒绘制一次页面
|
||||||
|
if (EditorApplication.timeSinceStartup - _lastRepaintTime > 1f)
|
||||||
|
{
|
||||||
|
_lastRepaintTime = EditorApplication.timeSinceStartup;
|
||||||
|
if (_nextRepaintIndex >= 0)
|
||||||
|
{
|
||||||
|
RepaintFrame(_nextRepaintIndex);
|
||||||
|
_nextRepaintIndex = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnHandleConnectionEvent(int playerId)
|
private void OnHandleConnectionEvent(int playerId)
|
||||||
{
|
{
|
||||||
@@ -174,21 +191,27 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
private void OnHandlePlayerMessage(MessageEventArgs args)
|
private void OnHandlePlayerMessage(MessageEventArgs args)
|
||||||
{
|
{
|
||||||
var debugReport = DebugReport.Deserialize(args.data);
|
|
||||||
int playerId = args.playerId;
|
int playerId = args.playerId;
|
||||||
Debug.Log($"Handle player {playerId} debug report !");
|
var debugReport = DebugReport.Deserialize(args.data);
|
||||||
|
|
||||||
|
if (debugReport.DebuggerVersion != RemoteDebuggerDefine.DebuggerVersion)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Debugger versions are inconsistent : {debugReport.DebuggerVersion} != {RemoteDebuggerDefine.DebuggerVersion}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Debug.Log($"Handle player {playerId} debug report !");
|
||||||
_currentPlayerSession = GetOrCreatePlayerSession(playerId);
|
_currentPlayerSession = GetOrCreatePlayerSession(playerId);
|
||||||
_currentPlayerSession.AddDebugReport(debugReport);
|
_currentPlayerSession.AddDebugReport(debugReport);
|
||||||
_frameSlider.highValue = _currentPlayerSession.MaxRangeValue;
|
_nextRepaintIndex = _currentPlayerSession.MaxRangeValue;
|
||||||
_frameSlider.value = _currentPlayerSession.MaxRangeValue;
|
|
||||||
UpdateFrameView(_currentPlayerSession);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFrameSliderChange(int sliderValue)
|
private void OnFrameSliderChange(int sliderValue)
|
||||||
{
|
{
|
||||||
if (_currentPlayerSession != null)
|
if (_currentPlayerSession != null)
|
||||||
{
|
{
|
||||||
_rangeIndex = _currentPlayerSession.ClampRangeIndex(sliderValue); ;
|
_rangeIndex = _currentPlayerSession.ClampRangeIndex(sliderValue); ;
|
||||||
UpdateFrameView(_currentPlayerSession, _rangeIndex);
|
RepaintFrame(_rangeIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnFrameLast_clicked()
|
private void OnFrameLast_clicked()
|
||||||
@@ -197,7 +220,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex - 1);
|
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex - 1);
|
||||||
_frameSlider.value = _rangeIndex;
|
_frameSlider.value = _rangeIndex;
|
||||||
UpdateFrameView(_currentPlayerSession, _rangeIndex);
|
RepaintFrame(_rangeIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnFrameNext_clicked()
|
private void OnFrameNext_clicked()
|
||||||
@@ -206,21 +229,26 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex + 1);
|
_rangeIndex = _currentPlayerSession.ClampRangeIndex(_rangeIndex + 1);
|
||||||
_frameSlider.value = _rangeIndex;
|
_frameSlider.value = _rangeIndex;
|
||||||
UpdateFrameView(_currentPlayerSession, _rangeIndex);
|
RepaintFrame(_rangeIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnFrameClear_clicked()
|
private void OnFrameClear_clicked()
|
||||||
{
|
{
|
||||||
|
_nextRepaintIndex = -1;
|
||||||
|
_lastRepaintIndex = 0;
|
||||||
|
_rangeIndex = 0;
|
||||||
|
|
||||||
|
_frameSlider.label = $"Frame:";
|
||||||
|
_frameSlider.value = 0;
|
||||||
|
_frameSlider.lowValue = 0;
|
||||||
|
_frameSlider.highValue = 0;
|
||||||
|
_assetListViewer.ClearView();
|
||||||
|
_bundleListViewer.ClearView();
|
||||||
|
_operationListViewer.ClearView();
|
||||||
|
|
||||||
if (_currentPlayerSession != null)
|
if (_currentPlayerSession != null)
|
||||||
{
|
{
|
||||||
_frameSlider.label = $"Frame:";
|
|
||||||
_frameSlider.value = 0;
|
|
||||||
_frameSlider.lowValue = 0;
|
|
||||||
_frameSlider.highValue = 0;
|
|
||||||
_currentPlayerSession.ClearDebugReport();
|
_currentPlayerSession.ClearDebugReport();
|
||||||
_assetListViewer.ClearView();
|
|
||||||
_bundleListViewer.ClearView();
|
|
||||||
_operationListViewer.ClearView();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnRecordToggleValueChange(ChangeEvent<bool> evt)
|
private void OnRecordToggleValueChange(ChangeEvent<bool> evt)
|
||||||
@@ -234,42 +262,6 @@ namespace YooAsset.Editor
|
|||||||
RemoteEditorConnection.Instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
|
RemoteEditorConnection.Instance.Send(RemoteDebuggerDefine.kMsgEditorSendToPlayer, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RemotePlayerSession GetOrCreatePlayerSession(int playerId)
|
|
||||||
{
|
|
||||||
if (_playerSessions.TryGetValue(playerId, out RemotePlayerSession session))
|
|
||||||
{
|
|
||||||
return session;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RemotePlayerSession newSession = new RemotePlayerSession(playerId);
|
|
||||||
_playerSessions.Add(playerId, newSession);
|
|
||||||
return newSession;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void UpdateFrameView(RemotePlayerSession playerSession)
|
|
||||||
{
|
|
||||||
if (playerSession != null)
|
|
||||||
{
|
|
||||||
UpdateFrameView(playerSession, playerSession.MaxRangeValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void UpdateFrameView(RemotePlayerSession playerSession, int rangeIndex)
|
|
||||||
{
|
|
||||||
if (playerSession == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var debugReport = playerSession.GetDebugReport(rangeIndex);
|
|
||||||
if (debugReport != null)
|
|
||||||
{
|
|
||||||
_currentReport = debugReport;
|
|
||||||
_frameSlider.label = $"Frame: {debugReport.FrameCount}";
|
|
||||||
_assetListViewer.FillViewData(debugReport);
|
|
||||||
_bundleListViewer.FillViewData(debugReport);
|
|
||||||
_operationListViewer.FillViewData(debugReport);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SampleBtn_onClick()
|
private void SampleBtn_onClick()
|
||||||
{
|
{
|
||||||
// 发送采集数据的命令
|
// 发送采集数据的命令
|
||||||
@@ -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
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ namespace YooAsset.Editor
|
|||||||
private VisualTreeAsset _visualAsset;
|
private VisualTreeAsset _visualAsset;
|
||||||
private TemplateContainer _root;
|
private TemplateContainer _root;
|
||||||
|
|
||||||
private TableView _providerTableView;
|
private TableViewer _providerTableView;
|
||||||
private TableView _dependTableView;
|
private TableViewer _dependTableView;
|
||||||
|
|
||||||
private List<ITableData> _sourceDatas;
|
private List<ITableData> _sourceDatas;
|
||||||
|
|
||||||
@@ -44,12 +44,12 @@ namespace YooAsset.Editor
|
|||||||
_root.style.flexGrow = 1f;
|
_root.style.flexGrow = 1f;
|
||||||
|
|
||||||
// 资源列表
|
// 资源列表
|
||||||
_providerTableView = _root.Q<TableView>("TopTableView");
|
_providerTableView = _root.Q<TableViewer>("TopTableView");
|
||||||
_providerTableView.SelectionChangedEvent = OnProviderTableViewSelectionChanged;
|
_providerTableView.SelectionChangedEvent = OnProviderTableViewSelectionChanged;
|
||||||
CreateAssetTableViewColumns();
|
CreateAssetTableViewColumns();
|
||||||
|
|
||||||
// 依赖列表
|
// 依赖列表
|
||||||
_dependTableView = _root.Q<TableView>("BottomTableView");
|
_dependTableView = _root.Q<TableViewer>("BottomTableView");
|
||||||
CreateDependTableViewColumns();
|
CreateDependTableViewColumns();
|
||||||
|
|
||||||
// 面板分屏
|
// 面板分屏
|
||||||
@@ -148,10 +148,11 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// LoadingTime
|
// LoadingTime
|
||||||
{
|
{
|
||||||
var columnStyle = new ColumnStyle(100);
|
var columnStyle = new ColumnStyle(130);
|
||||||
columnStyle.Stretchable = false;
|
columnStyle.Stretchable = false;
|
||||||
columnStyle.Searchable = false;
|
columnStyle.Searchable = false;
|
||||||
columnStyle.Sortable = true;
|
columnStyle.Sortable = true;
|
||||||
|
columnStyle.Units = "ms";
|
||||||
var column = new TableColumn("LoadingTime", "Loading Time", columnStyle);
|
var column = new TableColumn("LoadingTime", "Loading Time", columnStyle);
|
||||||
column.MakeCell = () =>
|
column.MakeCell = () =>
|
||||||
{
|
{
|
||||||
@@ -279,7 +280,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
StyleColor textColor;
|
StyleColor textColor;
|
||||||
var dependTableData = data as DependTableData;
|
var dependTableData = data as DependTableData;
|
||||||
if (dependTableData.BundleInfo.Status == EOperationStatus.Failed)
|
if (dependTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
|
||||||
textColor = new StyleColor(Color.yellow);
|
textColor = new StyleColor(Color.yellow);
|
||||||
else
|
else
|
||||||
textColor = new StyleColor(Color.white);
|
textColor = new StyleColor(Color.white);
|
||||||
@@ -332,8 +333,10 @@ namespace YooAsset.Editor
|
|||||||
public void ClearView()
|
public void ClearView()
|
||||||
{
|
{
|
||||||
_providerTableView.ClearAll(false, true);
|
_providerTableView.ClearAll(false, true);
|
||||||
|
_providerTableView.RebuildView();
|
||||||
|
|
||||||
_dependTableView.ClearAll(false, true);
|
_dependTableView.ClearAll(false, true);
|
||||||
RebuildView(null);
|
_dependTableView.RebuildView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -342,10 +345,12 @@ namespace YooAsset.Editor
|
|||||||
public void RebuildView(string searchKeyWord)
|
public void RebuildView(string searchKeyWord)
|
||||||
{
|
{
|
||||||
// 搜索匹配
|
// 搜索匹配
|
||||||
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
if (_sourceDatas != null)
|
||||||
|
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||||
|
|
||||||
// 重建视图
|
// 重建视图
|
||||||
_providerTableView.RebuildView();
|
_providerTableView.RebuildView();
|
||||||
|
_dependTableView.RebuildView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ namespace YooAsset.Editor
|
|||||||
private VisualTreeAsset _visualAsset;
|
private VisualTreeAsset _visualAsset;
|
||||||
private TemplateContainer _root;
|
private TemplateContainer _root;
|
||||||
|
|
||||||
private TableView _bundleTableView;
|
private TableViewer _bundleTableView;
|
||||||
private TableView _usingTableView;
|
private TableViewer _usingTableView;
|
||||||
private TableView _referenceTableView;
|
private TableViewer _referenceTableView;
|
||||||
|
|
||||||
private List<ITableData> _sourceDatas;
|
private List<ITableData> _sourceDatas;
|
||||||
|
|
||||||
@@ -48,16 +48,16 @@ namespace YooAsset.Editor
|
|||||||
_root.style.flexGrow = 1f;
|
_root.style.flexGrow = 1f;
|
||||||
|
|
||||||
// 资源包列表
|
// 资源包列表
|
||||||
_bundleTableView = _root.Q<TableView>("BundleTableView");
|
_bundleTableView = _root.Q<TableViewer>("BundleTableView");
|
||||||
_bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged;
|
_bundleTableView.SelectionChangedEvent = OnBundleTableViewSelectionChanged;
|
||||||
CreateBundleTableViewColumns();
|
CreateBundleTableViewColumns();
|
||||||
|
|
||||||
// 使用列表
|
// 使用列表
|
||||||
_usingTableView = _root.Q<TableView>("UsingTableView");
|
_usingTableView = _root.Q<TableViewer>("UsingTableView");
|
||||||
CreateUsingTableViewColumns();
|
CreateUsingTableViewColumns();
|
||||||
|
|
||||||
// 引用列表
|
// 引用列表
|
||||||
_referenceTableView = _root.Q<TableView>("ReferenceTableView");
|
_referenceTableView = _root.Q<TableViewer>("ReferenceTableView");
|
||||||
CreateReferenceTableViewColumns();
|
CreateReferenceTableViewColumns();
|
||||||
|
|
||||||
// 面板分屏
|
// 面板分屏
|
||||||
@@ -151,7 +151,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
StyleColor textColor;
|
StyleColor textColor;
|
||||||
var bundleTableData = data as BundleTableData;
|
var bundleTableData = data as BundleTableData;
|
||||||
if (bundleTableData.BundleInfo.Status == EOperationStatus.Failed)
|
if (bundleTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
|
||||||
textColor = new StyleColor(Color.yellow);
|
textColor = new StyleColor(Color.yellow);
|
||||||
else
|
else
|
||||||
textColor = new StyleColor(Color.white);
|
textColor = new StyleColor(Color.white);
|
||||||
@@ -341,7 +341,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
StyleColor textColor;
|
StyleColor textColor;
|
||||||
var feferenceTableData = data as ReferenceTableData;
|
var feferenceTableData = data as ReferenceTableData;
|
||||||
if (feferenceTableData.BundleInfo.Status == EOperationStatus.Failed)
|
if (feferenceTableData.BundleInfo.Status == EOperationStatus.Failed.ToString())
|
||||||
textColor = new StyleColor(Color.yellow);
|
textColor = new StyleColor(Color.yellow);
|
||||||
else
|
else
|
||||||
textColor = new StyleColor(Color.white);
|
textColor = new StyleColor(Color.white);
|
||||||
@@ -393,8 +393,10 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
_bundleTableView.ClearAll(false, true);
|
_bundleTableView.ClearAll(false, true);
|
||||||
_bundleTableView.RebuildView();
|
_bundleTableView.RebuildView();
|
||||||
|
|
||||||
_usingTableView.ClearAll(false, true);
|
_usingTableView.ClearAll(false, true);
|
||||||
_usingTableView.RebuildView();
|
_usingTableView.RebuildView();
|
||||||
|
|
||||||
_referenceTableView.ClearAll(false, true);
|
_referenceTableView.ClearAll(false, true);
|
||||||
_referenceTableView.RebuildView();
|
_referenceTableView.RebuildView();
|
||||||
}
|
}
|
||||||
@@ -405,10 +407,13 @@ namespace YooAsset.Editor
|
|||||||
public void RebuildView(string searchKeyWord)
|
public void RebuildView(string searchKeyWord)
|
||||||
{
|
{
|
||||||
// 搜索匹配
|
// 搜索匹配
|
||||||
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
if(_sourceDatas != null)
|
||||||
|
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||||
|
|
||||||
// 重建视图
|
// 重建视图
|
||||||
_bundleTableView.RebuildView();
|
_bundleTableView.RebuildView();
|
||||||
|
_usingTableView.RebuildView();
|
||||||
|
_referenceTableView.RebuildView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace YooAsset.Editor
|
|||||||
private VisualTreeAsset _visualAsset;
|
private VisualTreeAsset _visualAsset;
|
||||||
private TemplateContainer _root;
|
private TemplateContainer _root;
|
||||||
|
|
||||||
private TableView _operationTableView;
|
private TableViewer _operationTableView;
|
||||||
private Toolbar _bottomToolbar;
|
private Toolbar _bottomToolbar;
|
||||||
private TreeViewer _childTreeView;
|
private TreeViewer _childTreeView;
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ namespace YooAsset.Editor
|
|||||||
_root.style.flexGrow = 1f;
|
_root.style.flexGrow = 1f;
|
||||||
|
|
||||||
// 任务列表
|
// 任务列表
|
||||||
_operationTableView = _root.Q<TableView>("TopTableView");
|
_operationTableView = _root.Q<TableViewer>("TopTableView");
|
||||||
_operationTableView.SelectionChangedEvent = OnOperationTableViewSelectionChanged;
|
_operationTableView.SelectionChangedEvent = OnOperationTableViewSelectionChanged;
|
||||||
CreateOperationTableViewColumns();
|
CreateOperationTableViewColumns();
|
||||||
|
|
||||||
@@ -170,10 +170,11 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// ProcessTime
|
// ProcessTime
|
||||||
{
|
{
|
||||||
var columnStyle = new ColumnStyle(100);
|
var columnStyle = new ColumnStyle(130);
|
||||||
columnStyle.Stretchable = false;
|
columnStyle.Stretchable = false;
|
||||||
columnStyle.Searchable = false;
|
columnStyle.Searchable = false;
|
||||||
columnStyle.Sortable = true;
|
columnStyle.Sortable = true;
|
||||||
|
columnStyle.Units = "ms";
|
||||||
var column = new TableColumn("ProcessTime", "Process Time", columnStyle);
|
var column = new TableColumn("ProcessTime", "Process Time", columnStyle);
|
||||||
column.MakeCell = () =>
|
column.MakeCell = () =>
|
||||||
{
|
{
|
||||||
@@ -270,9 +271,9 @@ namespace YooAsset.Editor
|
|||||||
// ProcessTime
|
// ProcessTime
|
||||||
{
|
{
|
||||||
ToolbarButton button = new ToolbarButton();
|
ToolbarButton button = new ToolbarButton();
|
||||||
button.text = "ProcessTime";
|
button.text = "ProcessTime (ms)";
|
||||||
button.style.flexGrow = 0;
|
button.style.flexGrow = 0;
|
||||||
button.style.width = 100;
|
button.style.width = 130;
|
||||||
_bottomToolbar.Add(button);
|
_bottomToolbar.Add(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,8 +338,10 @@ namespace YooAsset.Editor
|
|||||||
public void ClearView()
|
public void ClearView()
|
||||||
{
|
{
|
||||||
_operationTableView.ClearAll(false, true);
|
_operationTableView.ClearAll(false, true);
|
||||||
|
_operationTableView.RebuildView();
|
||||||
|
|
||||||
_childTreeView.ClearAll();
|
_childTreeView.ClearAll();
|
||||||
RebuildView(null);
|
_childTreeView.RebuildView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -347,7 +350,8 @@ namespace YooAsset.Editor
|
|||||||
public void RebuildView(string searchKeyWord)
|
public void RebuildView(string searchKeyWord)
|
||||||
{
|
{
|
||||||
// 搜索匹配
|
// 搜索匹配
|
||||||
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
if(_sourceDatas != null)
|
||||||
|
DefaultSearchSystem.Search(_sourceDatas, searchKeyWord);
|
||||||
|
|
||||||
// 重建视图
|
// 重建视图
|
||||||
_operationTableView.RebuildView();
|
_operationTableView.RebuildView();
|
||||||
@@ -419,7 +423,7 @@ namespace YooAsset.Editor
|
|||||||
var label = new Label();
|
var label = new Label();
|
||||||
label.name = "ProcessTime";
|
label.name = "ProcessTime";
|
||||||
label.style.flexGrow = 0f;
|
label.style.flexGrow = 0f;
|
||||||
label.style.width = 100;
|
label.style.width = 130;
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
container.Add(label);
|
container.Add(label);
|
||||||
}
|
}
|
||||||
@@ -446,7 +450,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
private void BindTreeViewItem(VisualElement container, object userData)
|
private void BindTreeViewItem(VisualElement container, object userData)
|
||||||
{
|
{
|
||||||
var operationInfo = userData as DebugOperationInfo;
|
var operationInfo = (DebugOperationInfo)userData;
|
||||||
|
|
||||||
// OperationName
|
// OperationName
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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" />
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -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)
|
||||||
{
|
{
|
||||||
8
Assets/YooAsset/Runtime/Assembly.meta
Normal file
8
Assets/YooAsset/Runtime/Assembly.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 569f60ef80f74a642bac91eca0b20a2b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -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>
|
||||||
/// 谁引用了该资源包
|
/// 谁引用了该资源包
|
||||||
|
|||||||
@@ -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>
|
||||||
/// 任务名称
|
/// 任务名称
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
/// 包裹名
|
/// 包裹名
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
@@ -9,6 +10,14 @@ namespace YooAsset
|
|||||||
|
|
||||||
internal class DownloadSystemHelper
|
internal class DownloadSystemHelper
|
||||||
{
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
|
private static void OnRuntimeInitialize()
|
||||||
|
{
|
||||||
|
UnityWebRequestCreater = null;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public static UnityWebRequestDelegate UnityWebRequestCreater = null;
|
public static UnityWebRequestDelegate UnityWebRequestCreater = null;
|
||||||
public static UnityWebRequest NewUnityWebRequestGet(string requestURL)
|
public static UnityWebRequest NewUnityWebRequestGet(string requestURL)
|
||||||
{
|
{
|
||||||
@@ -28,7 +37,9 @@ namespace YooAsset
|
|||||||
string url;
|
string url;
|
||||||
|
|
||||||
// 获取对应平台的URL地址
|
// 获取对应平台的URL地址
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR_OSX
|
||||||
|
url = StringUtility.Format("file://{0}", path);
|
||||||
|
#elif UNITY_EDITOR
|
||||||
url = StringUtility.Format("file:///{0}", path);
|
url = StringUtility.Format("file:///{0}", path);
|
||||||
#elif UNITY_WEBGL
|
#elif UNITY_WEBGL
|
||||||
url = path;
|
url = path;
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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 内部方法
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -333,6 +333,13 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
return _records.Keys.ToList();
|
return _records.Keys.ToList();
|
||||||
}
|
}
|
||||||
|
public RecordFileElement GetRecordFileElement(PackageBundle bundle)
|
||||||
|
{
|
||||||
|
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element))
|
||||||
|
return element;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public string GetTempFilePath(PackageBundle bundle)
|
public string GetTempFilePath(PackageBundle bundle)
|
||||||
{
|
{
|
||||||
@@ -384,10 +391,10 @@ namespace YooAsset
|
|||||||
|
|
||||||
public EFileVerifyResult VerifyCacheFile(PackageBundle bundle)
|
public EFileVerifyResult VerifyCacheFile(PackageBundle bundle)
|
||||||
{
|
{
|
||||||
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement wrapper) == false)
|
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element) == false)
|
||||||
return EFileVerifyResult.CacheNotFound;
|
return EFileVerifyResult.CacheNotFound;
|
||||||
|
|
||||||
EFileVerifyResult result = FileVerifyHelper.FileVerify(wrapper.DataFilePath, wrapper.DataFileSize, wrapper.DataFileCRC, EFileVerifyLevel.High);
|
EFileVerifyResult result = FileVerifyHelper.FileVerify(element.DataFilePath, element.DataFileSize, element.DataFileCRC, EFileVerifyLevel.High);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public bool WriteCacheBundleFile(PackageBundle bundle, string copyPath)
|
public bool WriteCacheBundleFile(PackageBundle bundle, string copyPath)
|
||||||
@@ -427,22 +434,10 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
public bool DeleteCacheBundleFile(string bundleGUID)
|
public bool DeleteCacheBundleFile(string bundleGUID)
|
||||||
{
|
{
|
||||||
if (_records.TryGetValue(bundleGUID, out RecordFileElement wrapper))
|
if (_records.TryGetValue(bundleGUID, out RecordFileElement element))
|
||||||
{
|
{
|
||||||
try
|
_records.Remove(bundleGUID);
|
||||||
{
|
return element.DeleteFolder();
|
||||||
string dataFilePath = wrapper.DataFilePath;
|
|
||||||
FileInfo fileInfo = new FileInfo(dataFilePath);
|
|
||||||
if (fileInfo.Exists)
|
|
||||||
fileInfo.Directory.Delete(true);
|
|
||||||
_records.Remove(bundleGUID);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
YooLogger.Error($"Failed to delete cache file ! {e.Message}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class RecordFileElement
|
internal class RecordFileElement
|
||||||
@@ -15,5 +17,31 @@ namespace YooAsset
|
|||||||
DataFileCRC = dataFileCRC;
|
DataFileCRC = dataFileCRC;
|
||||||
DataFileSize = dataFileSize;
|
DataFileSize = dataFileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除记录文件
|
||||||
|
/// </summary>
|
||||||
|
public bool DeleteFolder()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string directory = Path.GetDirectoryName(InfoFilePath);
|
||||||
|
DirectoryInfo directoryInfo = new DirectoryInfo(directory);
|
||||||
|
if (directoryInfo.Exists)
|
||||||
|
{
|
||||||
|
directoryInfo.Delete(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
YooLogger.Error($"Failed to delete cache file ! {e.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.IO;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
@@ -260,9 +261,30 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_fileSystem.Exists(_bundle))
|
if (_fileSystem.Exists(_bundle))
|
||||||
{
|
{
|
||||||
DownloadProgress = 1f;
|
// 注意:缓存的原生文件的格式,可能会在业务端根据需求发生变动!
|
||||||
DownloadedBytes = _bundle.FileSize;
|
// 注意:这里需要校验文件格式,如果不一致对本地文件进行修正!
|
||||||
_steps = ESteps.LoadCacheRawBundle;
|
string filePath = _fileSystem.GetCacheBundleFileLoadPath(_bundle);
|
||||||
|
if (File.Exists(filePath) == false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var recordFileElement = _fileSystem.GetRecordFileElement(_bundle);
|
||||||
|
File.Move(recordFileElement.DataFilePath, filePath);
|
||||||
|
_steps = ESteps.LoadCacheRawBundle;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = $"Faild rename raw data file : {e.Message}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DownloadProgress = 1f;
|
||||||
|
DownloadedBytes = _bundle.FileSize;
|
||||||
|
_steps = ESteps.LoadCacheRawBundle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ namespace YooAsset
|
|||||||
private enum ESteps
|
private enum ESteps
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
CheckManifest,
|
||||||
CheckArgs,
|
CheckArgs,
|
||||||
GetTagsCacheFiles,
|
GetClearCacheFiles,
|
||||||
ClearTagsCacheFiles,
|
ClearFilterCacheFiles,
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,13 +30,27 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
_steps = ESteps.CheckArgs;
|
_steps = ESteps.CheckManifest;
|
||||||
}
|
}
|
||||||
internal override void InternalUpdate()
|
internal override void InternalUpdate()
|
||||||
{
|
{
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.CheckManifest)
|
||||||
|
{
|
||||||
|
if (_manifest == null)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = "Can not found active package manifest !";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.CheckArgs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_steps == ESteps.CheckArgs)
|
if (_steps == ESteps.CheckArgs)
|
||||||
{
|
{
|
||||||
if (_clearParam == null)
|
if (_clearParam == null)
|
||||||
@@ -67,17 +82,17 @@ namespace YooAsset
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_steps = ESteps.GetTagsCacheFiles;
|
_steps = ESteps.GetClearCacheFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_steps == ESteps.GetTagsCacheFiles)
|
if (_steps == ESteps.GetClearCacheFiles)
|
||||||
{
|
{
|
||||||
_clearBundleGUIDs = GetTagsBundleGUIDs();
|
_clearBundleGUIDs = GetBundleGUIDsByTag();
|
||||||
_clearFileTotalCount = _clearBundleGUIDs.Count;
|
_clearFileTotalCount = _clearBundleGUIDs.Count;
|
||||||
_steps = ESteps.ClearTagsCacheFiles;
|
_steps = ESteps.ClearFilterCacheFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_steps == ESteps.ClearTagsCacheFiles)
|
if (_steps == ESteps.ClearFilterCacheFiles)
|
||||||
{
|
{
|
||||||
for (int i = _clearBundleGUIDs.Count - 1; i >= 0; i--)
|
for (int i = _clearBundleGUIDs.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
@@ -100,7 +115,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private List<string> GetTagsBundleGUIDs()
|
private List<string> GetBundleGUIDsByTag()
|
||||||
{
|
{
|
||||||
var allBundleGUIDs = _fileSystem.GetAllCachedBundleGUIDs();
|
var allBundleGUIDs = _fileSystem.GetAllCachedBundleGUIDs();
|
||||||
List<string> result = new List<string>(allBundleGUIDs.Count);
|
List<string> result = new List<string>(allBundleGUIDs.Count);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace YooAsset
|
|||||||
private enum ESteps
|
private enum ESteps
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
CheckManifest,
|
||||||
GetUnusedCacheFiles,
|
GetUnusedCacheFiles,
|
||||||
ClearUnusedCacheFiles,
|
ClearUnusedCacheFiles,
|
||||||
Done,
|
Done,
|
||||||
@@ -27,13 +28,27 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
_steps = ESteps.GetUnusedCacheFiles;
|
_steps = ESteps.CheckManifest;
|
||||||
}
|
}
|
||||||
internal override void InternalUpdate()
|
internal override void InternalUpdate()
|
||||||
{
|
{
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.CheckManifest)
|
||||||
|
{
|
||||||
|
if (_manifest == null)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = "Can not found active package manifest !";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.GetUnusedCacheFiles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_steps == ESteps.GetUnusedCacheFiles)
|
if (_steps == ESteps.GetUnusedCacheFiles)
|
||||||
{
|
{
|
||||||
_unusedBundleGUIDs = GetUnusedBundleGUIDs();
|
_unusedBundleGUIDs = GetUnusedBundleGUIDs();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace YooAsset
|
|||||||
private enum ESteps
|
private enum ESteps
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
CheckManifest,
|
||||||
ClearUnusedCacheFiles,
|
ClearUnusedCacheFiles,
|
||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
@@ -24,13 +25,27 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
internal override void InternalStart()
|
internal override void InternalStart()
|
||||||
{
|
{
|
||||||
_steps = ESteps.ClearUnusedCacheFiles;
|
_steps = ESteps.CheckManifest;
|
||||||
}
|
}
|
||||||
internal override void InternalUpdate()
|
internal override void InternalUpdate()
|
||||||
{
|
{
|
||||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.CheckManifest)
|
||||||
|
{
|
||||||
|
if (_manifest == null)
|
||||||
|
{
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
Error = "Can not found active package manifest !";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_steps = ESteps.ClearUnusedCacheFiles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_steps == ESteps.ClearUnusedCacheFiles)
|
if (_steps == ESteps.ClearUnusedCacheFiles)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -85,15 +85,17 @@ namespace YooAsset
|
|||||||
|
|
||||||
// 创建验证元素类
|
// 创建验证元素类
|
||||||
string fileRootPath = chidDirectory.FullName;
|
string fileRootPath = chidDirectory.FullName;
|
||||||
string dataFilePath = $"{fileRootPath}/{ DefaultCacheFileSystemDefine.BundleDataFileName}";
|
string dataFilePath = $"{fileRootPath}/{DefaultCacheFileSystemDefine.BundleDataFileName}";
|
||||||
string infoFilePath = $"{fileRootPath}/{ DefaultCacheFileSystemDefine.BundleInfoFileName}";
|
string infoFilePath = $"{fileRootPath}/{DefaultCacheFileSystemDefine.BundleInfoFileName}";
|
||||||
|
|
||||||
// 存储的数据文件追加文件格式
|
// 存储的数据文件追加文件格式
|
||||||
if (_fileSystem.AppendFileExtension)
|
if (_fileSystem.AppendFileExtension)
|
||||||
{
|
{
|
||||||
string dataFileExtension = FindDataFileExtension(chidDirectory);
|
string dataFileExtension = FindDataFileExtension(chidDirectory);
|
||||||
if (string.IsNullOrEmpty(dataFileExtension) == false)
|
if (string.IsNullOrEmpty(dataFileExtension) == false)
|
||||||
|
{
|
||||||
dataFilePath += dataFileExtension;
|
dataFilePath += dataFileExtension;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var element = new VerifyFileElement(_fileSystem.PackageName, bundleGUID, fileRootPath, dataFilePath, infoFilePath);
|
var element = new VerifyFileElement(_fileSystem.PackageName, bundleGUID, fileRootPath, dataFilePath, infoFilePath);
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ namespace YooAsset
|
|||||||
DownloadProgress = 0;
|
DownloadProgress = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal override string InternalGetDesc()
|
||||||
|
{
|
||||||
|
return $"RefCount : {RefCount}";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 减少引用计数
|
/// 减少引用计数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -83,6 +83,6 @@ namespace YooAsset
|
|||||||
/// 文件系统初始化参数列表
|
/// 文件系统初始化参数列表
|
||||||
/// 注意:列表最后一个元素作为主文件系统!
|
/// 注意:列表最后一个元素作为主文件系统!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<FileSystemParameters> FileSystemParameterList;
|
public readonly List<FileSystemParameters> FileSystemParameterList = new List<FileSystemParameters>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string BuildPipelineName;
|
public string BuildPipelineName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户数据
|
||||||
|
/// </summary>
|
||||||
|
public object BuildUserData;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建类所属程序集名称
|
/// 构建类所属程序集名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4d6ef91e069948c48b7ca60be4c218ee
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -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)
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,16 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
public class AssetInfo
|
public class AssetInfo
|
||||||
{
|
{
|
||||||
|
internal enum ELoadMethod
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
LoadAsset,
|
||||||
|
LoadSubAssets,
|
||||||
|
LoadAllAssets,
|
||||||
|
LoadScene,
|
||||||
|
LoadRawFile,
|
||||||
|
}
|
||||||
|
|
||||||
private readonly PackageAsset _packageAsset;
|
private readonly PackageAsset _packageAsset;
|
||||||
private string _providerGUID;
|
private string _providerGUID;
|
||||||
|
|
||||||
@@ -21,6 +31,11 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Error { private set; get; }
|
public string Error { private set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载方法
|
||||||
|
/// </summary>
|
||||||
|
internal ELoadMethod LoadMethod;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源对象
|
/// 资源对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源依赖列表
|
/// 获取依赖列表
|
||||||
/// 注意:传入的资源对象一定合法有效!
|
/// 注意:传入的资源对象一定合法有效!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PackageBundle[] GetAllDependencies(PackageAsset packageAsset)
|
public PackageBundle[] GetAllDependencies(PackageAsset packageAsset)
|
||||||
@@ -188,6 +188,21 @@ namespace YooAsset
|
|||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取依赖列表
|
||||||
|
/// 注意:传入的资源包对象一定合法有效!
|
||||||
|
/// </summary>
|
||||||
|
public PackageBundle[] GetAllDependencies(PackageBundle packageBundle)
|
||||||
|
{
|
||||||
|
List<PackageBundle> result = new List<PackageBundle>(packageBundle.DependBundleIDs.Length);
|
||||||
|
foreach (var dependID in packageBundle.DependBundleIDs)
|
||||||
|
{
|
||||||
|
var dependBundle = GetMainPackageBundle(dependID);
|
||||||
|
result.Add(dependBundle);
|
||||||
|
}
|
||||||
|
return result.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 尝试获取包裹的资源
|
/// 尝试获取包裹的资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -176,7 +176,17 @@ namespace YooAsset
|
|||||||
throw new Exception("Should never get here !");
|
throw new Exception("Should never get here !");
|
||||||
|
|
||||||
// 注意:如果清单里未找到资源包会抛出异常!
|
// 注意:如果清单里未找到资源包会抛出异常!
|
||||||
var depends = ActiveManifest.GetAllDependencies(assetInfo.Asset);
|
PackageBundle[] depends;
|
||||||
|
if (assetInfo.LoadMethod == AssetInfo.ELoadMethod.LoadAllAssets)
|
||||||
|
{
|
||||||
|
var mainBundle = ActiveManifest.GetMainPackageBundle(assetInfo.Asset);
|
||||||
|
depends = ActiveManifest.GetAllDependencies(mainBundle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
depends = ActiveManifest.GetAllDependencies(assetInfo.Asset);
|
||||||
|
}
|
||||||
|
|
||||||
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
|
List<BundleInfo> result = new List<BundleInfo>(depends.Length);
|
||||||
foreach (var packageBundle in depends)
|
foreach (var packageBundle in depends)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ namespace YooAsset
|
|||||||
/// <param name="clearParam">执行参数</param>
|
/// <param name="clearParam">执行参数</param>
|
||||||
public ClearCacheFilesOperation ClearCacheFilesAsync(EFileClearMode clearMode, object clearParam = null)
|
public ClearCacheFilesOperation ClearCacheFilesAsync(EFileClearMode clearMode, object clearParam = null)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize(false);
|
||||||
var operation = _playModeImpl.ClearCacheFilesAsync(clearMode.ToString(), clearParam);
|
var operation = _playModeImpl.ClearCacheFilesAsync(clearMode.ToString(), clearParam);
|
||||||
OperationSystem.StartOperation(PackageName, operation);
|
OperationSystem.StartOperation(PackageName, operation);
|
||||||
return operation;
|
return operation;
|
||||||
@@ -276,7 +276,7 @@ namespace YooAsset
|
|||||||
/// <param name="clearParam">执行参数</param>
|
/// <param name="clearParam">执行参数</param>
|
||||||
public ClearCacheFilesOperation ClearCacheFilesAsync(string clearMode, object clearParam = null)
|
public ClearCacheFilesOperation ClearCacheFilesAsync(string clearMode, object clearParam = null)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize(false);
|
||||||
var operation = _playModeImpl.ClearCacheFilesAsync(clearMode, clearParam);
|
var operation = _playModeImpl.ClearCacheFilesAsync(clearMode, clearParam);
|
||||||
OperationSystem.StartOperation(PackageName, operation);
|
OperationSystem.StartOperation(PackageName, operation);
|
||||||
return operation;
|
return operation;
|
||||||
@@ -610,6 +610,7 @@ namespace YooAsset
|
|||||||
private SceneHandle LoadSceneInternal(AssetInfo assetInfo, bool waitForAsyncComplete, LoadSceneMode sceneMode, LocalPhysicsMode physicsMode, bool suspendLoad, uint priority)
|
private SceneHandle LoadSceneInternal(AssetInfo assetInfo, bool waitForAsyncComplete, LoadSceneMode sceneMode, LocalPhysicsMode physicsMode, bool suspendLoad, uint priority)
|
||||||
{
|
{
|
||||||
DebugCheckAssetLoadType(assetInfo.AssetType);
|
DebugCheckAssetLoadType(assetInfo.AssetType);
|
||||||
|
assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadScene;
|
||||||
var loadSceneParams = new LoadSceneParameters(sceneMode, physicsMode);
|
var loadSceneParams = new LoadSceneParameters(sceneMode, physicsMode);
|
||||||
var handle = _resourceManager.LoadSceneAsync(assetInfo, loadSceneParams, suspendLoad, priority);
|
var handle = _resourceManager.LoadSceneAsync(assetInfo, loadSceneParams, suspendLoad, priority);
|
||||||
if (waitForAsyncComplete)
|
if (waitForAsyncComplete)
|
||||||
@@ -720,6 +721,7 @@ namespace YooAsset
|
|||||||
private AssetHandle LoadAssetInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
|
private AssetHandle LoadAssetInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
|
||||||
{
|
{
|
||||||
DebugCheckAssetLoadType(assetInfo.AssetType);
|
DebugCheckAssetLoadType(assetInfo.AssetType);
|
||||||
|
assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadAsset;
|
||||||
var handle = _resourceManager.LoadAssetAsync(assetInfo, priority);
|
var handle = _resourceManager.LoadAssetAsync(assetInfo, priority);
|
||||||
if (waitForAsyncComplete)
|
if (waitForAsyncComplete)
|
||||||
handle.WaitForAsyncComplete();
|
handle.WaitForAsyncComplete();
|
||||||
@@ -829,6 +831,7 @@ namespace YooAsset
|
|||||||
private SubAssetsHandle LoadSubAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
|
private SubAssetsHandle LoadSubAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
|
||||||
{
|
{
|
||||||
DebugCheckAssetLoadType(assetInfo.AssetType);
|
DebugCheckAssetLoadType(assetInfo.AssetType);
|
||||||
|
assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadSubAssets;
|
||||||
var handle = _resourceManager.LoadSubAssetsAsync(assetInfo, priority);
|
var handle = _resourceManager.LoadSubAssetsAsync(assetInfo, priority);
|
||||||
if (waitForAsyncComplete)
|
if (waitForAsyncComplete)
|
||||||
handle.WaitForAsyncComplete();
|
handle.WaitForAsyncComplete();
|
||||||
@@ -938,6 +941,7 @@ namespace YooAsset
|
|||||||
private AllAssetsHandle LoadAllAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
|
private AllAssetsHandle LoadAllAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
|
||||||
{
|
{
|
||||||
DebugCheckAssetLoadType(assetInfo.AssetType);
|
DebugCheckAssetLoadType(assetInfo.AssetType);
|
||||||
|
assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadAllAssets;
|
||||||
var handle = _resourceManager.LoadAllAssetsAsync(assetInfo, priority);
|
var handle = _resourceManager.LoadAllAssetsAsync(assetInfo, priority);
|
||||||
if (waitForAsyncComplete)
|
if (waitForAsyncComplete)
|
||||||
handle.WaitForAsyncComplete();
|
handle.WaitForAsyncComplete();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user