mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 17:20:12 +00:00
Compare commits
28 Commits
2.2.12
...
d9c911d89b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9c911d89b | ||
|
|
a3ceb3dcb6 | ||
|
|
a5b68b28b2 | ||
|
|
bd285faf37 | ||
|
|
8a4960b560 | ||
|
|
83c6ae2057 | ||
|
|
b71563e889 | ||
|
|
79e0cf85f9 | ||
|
|
e996eaa008 | ||
|
|
5088c9e985 | ||
|
|
610b3c6d32 | ||
|
|
cc7290f10e | ||
|
|
576b842368 | ||
|
|
d23c0ba715 | ||
|
|
98e19baebd | ||
|
|
f5947db44a | ||
|
|
e978164329 | ||
|
|
966c8f2efa | ||
|
|
a57fec3d71 | ||
|
|
84844eda20 | ||
|
|
698cdcba61 | ||
|
|
1d6c9393d4 | ||
|
|
b654ac156d | ||
|
|
d133a9a692 | ||
|
|
d55db19f0e | ||
|
|
e3fc3df32c | ||
|
|
f2334da72d | ||
|
|
2902b6c2cf |
@@ -2,6 +2,49 @@
|
|||||||
|
|
||||||
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.0-preview] - 2025-02-19
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
资源收集窗口列表元素支持手动上下拖拽排序!
|
||||||
|
|
||||||
|
资源扫描窗口列表元素支持手动上下拖拽排序!
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 新增了UIElements扩展类ReorderableListView
|
||||||
|
|
||||||
|
- 新增初始化方法
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public class YooAssets
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设置异步系统参数,快速启动模式的开关
|
||||||
|
/// 注意:该模式默认开启
|
||||||
|
/// </summary>
|
||||||
|
public static void SetOperationSystemQuickStartMode(bool state)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- 新增打包构建参数
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public class BuildParameters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 旧版依赖模式
|
||||||
|
/// 说明:兼容YooAssets1.5.x版本
|
||||||
|
/// </summary>
|
||||||
|
public bool LegacyDependency = false;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (#472) 修复了Unity6平台,TableView视图无法显示问题。
|
||||||
|
- 修复了微信小游戏和抖音小游戏未正确使用插件的卸载方法。
|
||||||
|
|
||||||
## [2.2.12] - 2025-02-14
|
## [2.2.12] - 2025-02-14
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ namespace YooAsset.Editor
|
|||||||
_scannerListView = root.Q<ListView>("ScannerListView");
|
_scannerListView = root.Q<ListView>("ScannerListView");
|
||||||
_scannerListView.makeItem = MakeScannerListViewItem;
|
_scannerListView.makeItem = MakeScannerListViewItem;
|
||||||
_scannerListView.bindItem = BindScannerListViewItem;
|
_scannerListView.bindItem = BindScannerListViewItem;
|
||||||
|
|
||||||
#if UNITY_2022_3_OR_NEWER
|
#if UNITY_2022_3_OR_NEWER
|
||||||
_scannerListView.selectionChanged += ScannerListView_onSelectionChange;
|
_scannerListView.selectionChanged += ScannerListView_onSelectionChange;
|
||||||
#elif UNITY_2020_1_OR_NEWER
|
#elif UNITY_2020_1_OR_NEWER
|
||||||
@@ -277,12 +276,23 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
_scannerListView.Clear();
|
_scannerListView.Clear();
|
||||||
_scannerListView.ClearSelection();
|
_scannerListView.ClearSelection();
|
||||||
_scannerListView.itemsSource = FilterScanners();
|
|
||||||
_scannerListView.Rebuild();
|
|
||||||
|
|
||||||
if (_lastModifyScannerIndex >= 0 && _lastModifyScannerIndex < _scannerListView.itemsSource.Count)
|
var filterItems = FilterScanners();
|
||||||
|
if (AssetArtScannerSettingData.Setting.Scanners.Count == filterItems.Count)
|
||||||
{
|
{
|
||||||
_scannerListView.selectedIndex = _lastModifyScannerIndex;
|
#if UNITY_2020_3_OR_NEWER
|
||||||
|
_scannerListView.reorderable = true;
|
||||||
|
#endif
|
||||||
|
_scannerListView.itemsSource = AssetArtScannerSettingData.Setting.Scanners;
|
||||||
|
_scannerListView.Rebuild();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if UNITY_2020_3_OR_NEWER
|
||||||
|
_scannerListView.reorderable = false;
|
||||||
|
#endif
|
||||||
|
_scannerListView.itemsSource = filterItems;
|
||||||
|
_scannerListView.Rebuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private List<AssetArtScanner> FilterScanners()
|
private List<AssetArtScanner> FilterScanners()
|
||||||
@@ -344,31 +354,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// 显示检视面板
|
// 显示检视面板
|
||||||
var scanSchema = selectScanner.LoadSchema();
|
var scanSchema = selectScanner.LoadSchema();
|
||||||
if (scanSchema != null)
|
RefreshInspector(scanSchema);
|
||||||
{
|
|
||||||
var inspector = scanSchema.CreateInspector();
|
|
||||||
if (inspector == null)
|
|
||||||
{
|
|
||||||
UIElementsTools.SetElementVisible(_inspectorContainer, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (inspector.Containner is VisualElement container)
|
|
||||||
{
|
|
||||||
UIElementsTools.SetElementVisible(_inspectorContainer, true);
|
|
||||||
_inspectorContainer.Clear();
|
|
||||||
_inspectorContainer.Add(container);
|
|
||||||
_inspectorContainer.style.width = inspector.Width;
|
|
||||||
_inspectorContainer.style.minWidth = inspector.MinWidth;
|
|
||||||
_inspectorContainer.style.maxWidth = inspector.MaxWidth;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"{nameof(ScannerSchema)} inspector container is invalid !");
|
|
||||||
UIElementsTools.SetElementVisible(_inspectorContainer, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置Schema对象
|
// 设置Schema对象
|
||||||
if (scanSchema == null)
|
if (scanSchema == null)
|
||||||
@@ -521,6 +507,38 @@ namespace YooAsset.Editor
|
|||||||
AssetArtScannerSettingData.RemoveCollector(selectSacnner, selectCollector);
|
AssetArtScannerSettingData.RemoveCollector(selectSacnner, selectCollector);
|
||||||
FillCollectorViewData();
|
FillCollectorViewData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 属性面板相关
|
||||||
|
private void RefreshInspector(ScannerSchema scanSchema)
|
||||||
|
{
|
||||||
|
if (scanSchema == null)
|
||||||
|
{
|
||||||
|
UIElementsTools.SetElementVisible(_inspectorContainer, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var inspector = scanSchema.CreateInspector();
|
||||||
|
if (inspector == null)
|
||||||
|
{
|
||||||
|
UIElementsTools.SetElementVisible(_inspectorContainer, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inspector.Containner is VisualElement container)
|
||||||
|
{
|
||||||
|
UIElementsTools.SetElementVisible(_inspectorContainer, true);
|
||||||
|
_inspectorContainer.Clear();
|
||||||
|
_inspectorContainer.Add(container);
|
||||||
|
_inspectorContainer.style.width = inspector.Width;
|
||||||
|
_inspectorContainer.style.minWidth = inspector.MinWidth;
|
||||||
|
_inspectorContainer.style.maxWidth = inspector.MaxWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"{nameof(ScannerSchema)} inspector container is invalid !");
|
||||||
|
UIElementsTools.SetElementVisible(_inspectorContainer, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<ui:VisualElement name="ScannerListContainer" style="width: 250px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
<ui:VisualElement name="ScannerListContainer" style="width: 250px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
||||||
<ui:Label text="Scanner List" display-tooltip-when-elided="true" name="ScannerListTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 3px; border-right-width: 3px; border-top-width: 3px; border-bottom-width: 3px; font-size: 12px;" />
|
<ui:Label text="Scanner List" display-tooltip-when-elided="true" name="ScannerListTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 3px; border-right-width: 3px; border-top-width: 3px; border-bottom-width: 3px; font-size: 12px;" />
|
||||||
<uie:ToolbarSearchField focusable="true" name="ScannerSearchField" style="width: 230px;" />
|
<uie:ToolbarSearchField focusable="true" name="ScannerSearchField" style="width: 230px;" />
|
||||||
<ui:ListView focusable="true" name="ScannerListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
|
<ui:ListView focusable="true" name="ScannerListView" item-height="20" virtualization-method="DynamicHeight" reorder-mode="Animated" reorderable="true" style="flex-grow: 1;" />
|
||||||
<ui:VisualElement name="ScannerAddContainer" style="justify-content: center; flex-direction: row; flex-shrink: 0;">
|
<ui:VisualElement name="ScannerAddContainer" style="justify-content: center; flex-direction: row; flex-shrink: 0;">
|
||||||
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
|
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
|
||||||
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
|
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ namespace YooAsset.Editor
|
|||||||
public string EncryptedFilePath { set; get; }
|
public string EncryptedFilePath { set; get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private readonly HashSet<string> _assetPaths = new HashSet<string>();
|
private readonly Dictionary<string, BuildAssetInfo> _packAssetDic = new Dictionary<string, BuildAssetInfo>(100);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 参与构建的资源列表
|
/// 参与构建的资源列表
|
||||||
/// 注意:不包含零依赖资源和冗余资源
|
/// 注意:不包含零依赖资源和冗余资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly List<BuildAssetInfo> MainAssets = new List<BuildAssetInfo>();
|
public readonly List<BuildAssetInfo> AllPackAssets = new List<BuildAssetInfo>(100);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源包名称
|
/// 资源包名称
|
||||||
@@ -86,51 +86,68 @@ namespace YooAsset.Editor
|
|||||||
public void PackAsset(BuildAssetInfo buildAsset)
|
public void PackAsset(BuildAssetInfo buildAsset)
|
||||||
{
|
{
|
||||||
string assetPath = buildAsset.AssetInfo.AssetPath;
|
string assetPath = buildAsset.AssetInfo.AssetPath;
|
||||||
if (_assetPaths.Contains(assetPath))
|
if (_packAssetDic.ContainsKey(assetPath))
|
||||||
throw new System.Exception($"Should never get here ! Asset is existed : {assetPath}");
|
throw new System.Exception($"Should never get here ! Asset is existed : {assetPath}");
|
||||||
|
|
||||||
_assetPaths.Add(assetPath);
|
_packAssetDic.Add(assetPath, buildAsset);
|
||||||
MainAssets.Add(buildAsset);
|
AllPackAssets.Add(buildAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否包含指定资源
|
/// 是否包含指定资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsContainsAsset(string assetPath)
|
public bool IsContainsPackAsset(string assetPath)
|
||||||
{
|
{
|
||||||
return _assetPaths.Contains(assetPath);
|
return _packAssetDic.ContainsKey(assetPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取构建的资源路径列表
|
/// 获取构建的资源路径列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] GetAllMainAssetPaths()
|
public string[] GetAllPackAssetPaths()
|
||||||
{
|
{
|
||||||
return MainAssets.Select(t => t.AssetInfo.AssetPath).ToArray();
|
return AllPackAssets.Select(t => t.AssetInfo.AssetPath).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取该资源包内的所有资源(包括零依赖资源和冗余资源)
|
/// 获取构建的主资源信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> GetAllBuiltinAssetPaths()
|
public BuildAssetInfo GetPackAssetInfo(string assetPath)
|
||||||
{
|
{
|
||||||
var packAssets = GetAllMainAssetPaths();
|
if (_packAssetDic.TryGetValue(assetPath, out BuildAssetInfo value))
|
||||||
List<string> result = new List<string>(packAssets);
|
|
||||||
foreach (var buildAsset in MainAssets)
|
|
||||||
{
|
{
|
||||||
if (buildAsset.AllDependAssetInfos == null)
|
return value;
|
||||||
continue;
|
}
|
||||||
foreach (var dependAssetInfo in buildAsset.AllDependAssetInfos)
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"Can not found pack asset info {assetPath} in bundle : {BundleName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取资源包内部所有资产
|
||||||
|
/// </summary>
|
||||||
|
public List<AssetInfo> GetBundleContents()
|
||||||
|
{
|
||||||
|
Dictionary<string, AssetInfo> result = new Dictionary<string, AssetInfo>(AllPackAssets.Count);
|
||||||
|
foreach (var packAsset in AllPackAssets)
|
||||||
|
{
|
||||||
|
result.Add(packAsset.AssetInfo.AssetPath, packAsset.AssetInfo);
|
||||||
|
if (packAsset.AllDependAssetInfos != null)
|
||||||
{
|
{
|
||||||
// 注意:依赖资源里只添加零依赖资源和冗余资源
|
foreach (var dependAssetInfo in packAsset.AllDependAssetInfos)
|
||||||
if (dependAssetInfo.HasBundleName() == false)
|
|
||||||
{
|
{
|
||||||
if (result.Contains(dependAssetInfo.AssetInfo.AssetPath) == false)
|
// 注意:依赖资源里只添加零依赖资源和冗余资源
|
||||||
result.Add(dependAssetInfo.AssetInfo.AssetPath);
|
if (dependAssetInfo.HasBundleName() == false)
|
||||||
|
{
|
||||||
|
string dependAssetPath = dependAssetInfo.AssetInfo.AssetPath;
|
||||||
|
if (result.ContainsKey(dependAssetPath) == false)
|
||||||
|
result.Add(dependAssetPath, dependAssetInfo.AssetInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result.Values.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -142,7 +159,7 @@ namespace YooAsset.Editor
|
|||||||
AssetBundleBuild build = new AssetBundleBuild();
|
AssetBundleBuild build = new AssetBundleBuild();
|
||||||
build.assetBundleName = BundleName;
|
build.assetBundleName = BundleName;
|
||||||
build.assetBundleVariant = string.Empty;
|
build.assetBundleVariant = string.Empty;
|
||||||
build.assetNames = GetAllMainAssetPaths();
|
build.assetNames = GetAllPackAssetPaths();
|
||||||
return build;
|
return build;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +168,7 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildAssetInfo[] GetAllManifestAssetInfos()
|
public BuildAssetInfo[] GetAllManifestAssetInfos()
|
||||||
{
|
{
|
||||||
return MainAssets.Where(t => t.CollectorType == ECollectorType.MainAssetCollector).ToArray();
|
return AllPackAssets.Where(t => t.CollectorType == ECollectorType.MainAssetCollector).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -51,6 +51,12 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string PackageNote;
|
public string PackageNote;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 怀旧版依赖模式
|
||||||
|
/// 说明:兼容YooAsset1.5.x版本
|
||||||
|
/// </summary>
|
||||||
|
public bool LegacyDependency = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清空构建缓存文件
|
/// 清空构建缓存文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace YooAsset.Editor
|
|||||||
// 创建新补丁清单
|
// 创建新补丁清单
|
||||||
PackageManifest manifest = new PackageManifest();
|
PackageManifest manifest = new PackageManifest();
|
||||||
manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
|
manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
|
||||||
|
manifest.LegacyDependency = buildParameters.LegacyDependency;
|
||||||
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||||
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||||
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||||
@@ -43,17 +44,25 @@ namespace YooAsset.Editor
|
|||||||
manifest.AssetList = CreatePackageAssetList(buildMapContext);
|
manifest.AssetList = CreatePackageAssetList(buildMapContext);
|
||||||
manifest.BundleList = CreatePackageBundleList(buildMapContext);
|
manifest.BundleList = CreatePackageBundleList(buildMapContext);
|
||||||
|
|
||||||
// 处理资源清单的ID数据
|
// 1. 处理资源清单的资源对象
|
||||||
ProcessPacakgeIDs(manifest);
|
ProcessPacakgeAsset(manifest);
|
||||||
|
|
||||||
// 处理资源包的依赖列表
|
// 2. 处理资源包的依赖列表
|
||||||
if (processBundleDepends)
|
if (processBundleDepends)
|
||||||
ProcessBundleDepends(context, manifest);
|
ProcessBundleDepends(context, manifest);
|
||||||
|
|
||||||
// 处理资源包的标签集合
|
// 3. 处理资源包的标签集合
|
||||||
if (processBundleTags)
|
if (processBundleTags)
|
||||||
ProcessBundleTags(manifest);
|
ProcessBundleTags(manifest);
|
||||||
|
|
||||||
|
#region YOOASSET_LEGACY_DEPENDENCY
|
||||||
|
if (buildParameters.LegacyDependency)
|
||||||
|
{
|
||||||
|
if (processBundleDepends)
|
||||||
|
ProcessLegacyDependency(context, manifest);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
// 创建补丁清单文本文件
|
// 创建补丁清单文本文件
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
string fileName = YooAssetSettingsData.GetManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
@@ -137,7 +146,7 @@ namespace YooAsset.Editor
|
|||||||
packageAsset.AssetPath = assetInfo.AssetInfo.AssetPath;
|
packageAsset.AssetPath = assetInfo.AssetInfo.AssetPath;
|
||||||
packageAsset.AssetGUID = buildMapContext.Command.IncludeAssetGUID ? assetInfo.AssetInfo.AssetGUID : string.Empty;
|
packageAsset.AssetGUID = buildMapContext.Command.IncludeAssetGUID ? assetInfo.AssetInfo.AssetGUID : string.Empty;
|
||||||
packageAsset.AssetTags = assetInfo.AssetTags.ToArray();
|
packageAsset.AssetTags = assetInfo.AssetTags.ToArray();
|
||||||
packageAsset.BundleNameInEditor = assetInfo.BundleName;
|
packageAsset.TempDataInEditor = assetInfo;
|
||||||
result.Add(packageAsset);
|
result.Add(packageAsset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,9 +174,9 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 处理资源清单的ID数据
|
/// 处理资源清单的资源对象列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ProcessPacakgeIDs(PackageManifest manifest)
|
private void ProcessPacakgeAsset(PackageManifest manifest)
|
||||||
{
|
{
|
||||||
// 注意:优先缓存资源包索引
|
// 注意:优先缓存资源包索引
|
||||||
for (int index = 0; index < manifest.BundleList.Count; index++)
|
for (int index = 0; index < manifest.BundleList.Count; index++)
|
||||||
@@ -176,11 +185,25 @@ namespace YooAsset.Editor
|
|||||||
_cachedBundleIndexIDs.Add(bundleName, index);
|
_cachedBundleIndexIDs.Add(bundleName, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 记录资源对象所属的资源包ID
|
||||||
foreach (var packageAsset in manifest.AssetList)
|
foreach (var packageAsset in manifest.AssetList)
|
||||||
{
|
{
|
||||||
string bundleName = packageAsset.BundleNameInEditor;
|
var assetInfo = packageAsset.TempDataInEditor as BuildAssetInfo;
|
||||||
packageAsset.BundleID = GetCachedBundleIndexID(bundleName);
|
packageAsset.BundleID = GetCachedBundleIndexID(assetInfo.BundleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region YOOASSET_LEGACY_DEPENDENCY
|
||||||
|
if (manifest.LegacyDependency)
|
||||||
|
{
|
||||||
|
// 记录资源对象依赖的资源包ID集合
|
||||||
|
// 注意:依赖关系非引擎构建结果里查询!
|
||||||
|
foreach (var packageAsset in manifest.AssetList)
|
||||||
|
{
|
||||||
|
var mainAssetInfo = packageAsset.TempDataInEditor as BuildAssetInfo;
|
||||||
|
packageAsset.DependBundleIDs = GetAssetDependBundleIDs(mainAssetInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -192,7 +215,7 @@ namespace YooAsset.Editor
|
|||||||
foreach (var packageBundle in manifest.BundleList)
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
{
|
{
|
||||||
int mainBundleID = GetCachedBundleIndexID(packageBundle.BundleName);
|
int mainBundleID = GetCachedBundleIndexID(packageBundle.BundleName);
|
||||||
var depends = GetBundleDepends(context, packageBundle.BundleName);
|
string[] depends = GetBundleDepends(context, packageBundle.BundleName);
|
||||||
List<int> dependIDs = new List<int>(depends.Length);
|
List<int> dependIDs = new List<int>(depends.Length);
|
||||||
foreach (var dependBundleName in depends)
|
foreach (var dependBundleName in depends)
|
||||||
{
|
{
|
||||||
@@ -202,6 +225,23 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
packageBundle.DependIDs = dependIDs.ToArray();
|
packageBundle.DependIDs = dependIDs.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region YOOASSET_LEGACY_DEPENDENCY
|
||||||
|
if (manifest.LegacyDependency)
|
||||||
|
{
|
||||||
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
|
{
|
||||||
|
var dependIDs = packageBundle.DependIDs;
|
||||||
|
packageBundle.TempDataInEditor = new DependencyQuery(dependIDs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录引用该资源包的资源包ID集合
|
||||||
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
|
{
|
||||||
|
packageBundle.ReferenceBundleIDs = GetBundleReferenceBundleIDs(manifest, packageBundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -209,23 +249,51 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void ProcessBundleTags(PackageManifest manifest)
|
private void ProcessBundleTags(PackageManifest manifest)
|
||||||
{
|
{
|
||||||
// 将主资源的标签信息传染给其依赖的资源包集合
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
foreach (var packageAsset in manifest.AssetList)
|
|
||||||
{
|
{
|
||||||
var assetTags = packageAsset.AssetTags;
|
packageBundle.Tags = Array.Empty<string>();
|
||||||
int bundleID = packageAsset.BundleID;
|
}
|
||||||
CacheBundleTags(bundleID, assetTags);
|
|
||||||
|
|
||||||
var packageBundle = manifest.BundleList[bundleID];
|
// YOOASSET_LEGACY_DEPENDENCY
|
||||||
if (packageBundle.DependIDs != null)
|
if (manifest.LegacyDependency)
|
||||||
|
{
|
||||||
|
// 将主资源的标签信息传染给其依赖的资源包集合
|
||||||
|
foreach (var packageAsset in manifest.AssetList)
|
||||||
{
|
{
|
||||||
foreach (var dependBundleID in packageBundle.DependIDs)
|
var assetTags = packageAsset.AssetTags;
|
||||||
|
int bundleID = packageAsset.BundleID;
|
||||||
|
CacheBundleTags(bundleID, assetTags);
|
||||||
|
|
||||||
|
if (packageAsset.DependBundleIDs != null)
|
||||||
{
|
{
|
||||||
CacheBundleTags(dependBundleID, assetTags);
|
foreach (var dependBundleID in packageAsset.DependBundleIDs)
|
||||||
|
{
|
||||||
|
CacheBundleTags(dependBundleID, assetTags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 将主资源的标签信息传染给其依赖的资源包集合
|
||||||
|
foreach (var packageAsset in manifest.AssetList)
|
||||||
|
{
|
||||||
|
var assetTags = packageAsset.AssetTags;
|
||||||
|
int bundleID = packageAsset.BundleID;
|
||||||
|
CacheBundleTags(bundleID, assetTags);
|
||||||
|
|
||||||
|
var packageBundle = manifest.BundleList[bundleID];
|
||||||
|
if (packageBundle.DependIDs != null)
|
||||||
|
{
|
||||||
|
foreach (var dependBundleID in packageBundle.DependIDs)
|
||||||
|
{
|
||||||
|
CacheBundleTags(dependBundleID, assetTags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将缓存的资源标签赋值给资源包
|
||||||
for (int index = 0; index < manifest.BundleList.Count; index++)
|
for (int index = 0; index < manifest.BundleList.Count; index++)
|
||||||
{
|
{
|
||||||
var packageBundle = manifest.BundleList[index];
|
var packageBundle = manifest.BundleList[index];
|
||||||
@@ -264,5 +332,120 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否包含该资源包的索引ID
|
||||||
|
/// </summary>
|
||||||
|
private bool ContainsCachedBundleIndexID(string bundleName)
|
||||||
|
{
|
||||||
|
return _cachedBundleIndexIDs.ContainsKey(bundleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region YOOASSET_LEGACY_DEPENDENCY
|
||||||
|
private class DependencyQuery
|
||||||
|
{
|
||||||
|
private readonly HashSet<int> _dependIDs;
|
||||||
|
|
||||||
|
public DependencyQuery(int[] dependIDs)
|
||||||
|
{
|
||||||
|
_dependIDs = new HashSet<int>(dependIDs);
|
||||||
|
}
|
||||||
|
public bool Contains(int bundleID)
|
||||||
|
{
|
||||||
|
return _dependIDs.Contains(bundleID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ProcessLegacyDependency(BuildContext context, PackageManifest manifest)
|
||||||
|
{
|
||||||
|
// 注意:如果是可编程构建管线,需要补充内置资源包
|
||||||
|
// 注意:该步骤依赖前面的操作!
|
||||||
|
var buildResultContext = context.TryGetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
||||||
|
if (buildResultContext != null)
|
||||||
|
{
|
||||||
|
ProcessBuiltinBundleReference(context, manifest, buildResultContext.BuiltinShadersBundleName);
|
||||||
|
ProcessBuiltinBundleReference(context, manifest, buildResultContext.MonoScriptsBundleName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ProcessBuiltinBundleReference(BuildContext context, PackageManifest manifest, string builtinBundleName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(builtinBundleName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 查询内置资源包是否存在
|
||||||
|
if (ContainsCachedBundleIndexID(builtinBundleName) == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 获取内置资源包
|
||||||
|
int builtinBundleID = GetCachedBundleIndexID(builtinBundleName);
|
||||||
|
var builtinPackageBundle = manifest.BundleList[builtinBundleID];
|
||||||
|
|
||||||
|
// 更新依赖资源包ID集合
|
||||||
|
HashSet<int> cacheBundleIDs = new HashSet<int>(builtinPackageBundle.ReferenceBundleIDs);
|
||||||
|
HashSet<string> tempTags = new HashSet<string>();
|
||||||
|
foreach (var packageAsset in manifest.AssetList)
|
||||||
|
{
|
||||||
|
if (cacheBundleIDs.Contains(packageAsset.BundleID))
|
||||||
|
{
|
||||||
|
if (packageAsset.DependBundleIDs.Contains(builtinBundleID) == false)
|
||||||
|
{
|
||||||
|
var tempBundleIDs = new List<int>(packageAsset.DependBundleIDs);
|
||||||
|
tempBundleIDs.Add(builtinBundleID);
|
||||||
|
packageAsset.DependBundleIDs = tempBundleIDs.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var tag in packageAsset.AssetTags)
|
||||||
|
{
|
||||||
|
if (tempTags.Contains(tag) == false)
|
||||||
|
tempTags.Add(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新内置资源包的标签集合
|
||||||
|
foreach (var tag in builtinPackageBundle.Tags)
|
||||||
|
{
|
||||||
|
if (tempTags.Contains(tag) == false)
|
||||||
|
tempTags.Add(tag);
|
||||||
|
}
|
||||||
|
builtinPackageBundle.Tags = tempTags.ToArray();
|
||||||
|
}
|
||||||
|
private int[] GetAssetDependBundleIDs(BuildAssetInfo mainAssetInfo)
|
||||||
|
{
|
||||||
|
HashSet<int> result = new HashSet<int>();
|
||||||
|
int mainBundleID = GetCachedBundleIndexID(mainAssetInfo.BundleName);
|
||||||
|
foreach (var dependAssetInfo in mainAssetInfo.AllDependAssetInfos)
|
||||||
|
{
|
||||||
|
if (dependAssetInfo.HasBundleName())
|
||||||
|
{
|
||||||
|
int bundleID = GetCachedBundleIndexID(dependAssetInfo.BundleName);
|
||||||
|
if (mainBundleID != bundleID)
|
||||||
|
{
|
||||||
|
if (result.Contains(bundleID) == false)
|
||||||
|
result.Add(bundleID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.ToArray();
|
||||||
|
}
|
||||||
|
private int[] GetBundleReferenceBundleIDs(PackageManifest manifest, PackageBundle queryBundle)
|
||||||
|
{
|
||||||
|
int queryBundleID = GetCachedBundleIndexID(queryBundle.BundleName);
|
||||||
|
List<int> result = new List<int>();
|
||||||
|
foreach (var packageBundle in manifest.BundleList)
|
||||||
|
{
|
||||||
|
if (packageBundle == queryBundle)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var dependencyQuery = packageBundle.TempDataInEditor as DependencyQuery;
|
||||||
|
if (dependencyQuery.Contains(queryBundleID))
|
||||||
|
{
|
||||||
|
int referenceBundleID = GetCachedBundleIndexID(packageBundle.BundleName);
|
||||||
|
if (result.Contains(referenceBundleID) == false)
|
||||||
|
result.Add(referenceBundleID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.ToArray();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,11 +18,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// 概述信息
|
// 概述信息
|
||||||
{
|
{
|
||||||
#if UNITY_2019_4_OR_NEWER
|
buildReport.Summary.YooVersion = EditorTools.GetPackageManagerYooVersion();
|
||||||
UnityEditor.PackageManager.PackageInfo packageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssembly(typeof(BuildReport).Assembly);
|
|
||||||
if (packageInfo != null)
|
|
||||||
buildReport.Summary.YooVersion = packageInfo.version;
|
|
||||||
#endif
|
|
||||||
buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion;
|
buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion;
|
||||||
buildReport.Summary.BuildDate = DateTime.Now.ToString();
|
buildReport.Summary.BuildDate = DateTime.Now.ToString();
|
||||||
buildReport.Summary.BuildSeconds = BuildRunner.TotalSeconds;
|
buildReport.Summary.BuildSeconds = BuildRunner.TotalSeconds;
|
||||||
@@ -38,36 +34,35 @@ namespace YooAsset.Editor
|
|||||||
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
|
||||||
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
|
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
|
||||||
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
|
||||||
buildReport.Summary.IgnoreRuleName = buildMapContext.Command.IgnoreRule.GetType().FullName;
|
|
||||||
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
||||||
|
buildReport.Summary.IgnoreRuleName = buildMapContext.Command.IgnoreRule.GetType().FullName;
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
|
buildReport.Summary.LegacyDependency = buildParameters.LegacyDependency;
|
||||||
buildReport.Summary.ClearBuildCacheFiles = buildParameters.ClearBuildCacheFiles;
|
buildReport.Summary.ClearBuildCacheFiles = buildParameters.ClearBuildCacheFiles;
|
||||||
buildReport.Summary.UseAssetDependencyDB = buildParameters.UseAssetDependencyDB;
|
buildReport.Summary.UseAssetDependencyDB = buildParameters.UseAssetDependencyDB;
|
||||||
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
||||||
|
buildReport.Summary.SingleReferencedPackAlone = buildParameters.SingleReferencedPackAlone;
|
||||||
|
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
||||||
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
||||||
if (buildParameters.BuildPipeline == nameof(BuiltinBuildPipeline))
|
if (buildParameters is BuiltinBuildParameters)
|
||||||
{
|
{
|
||||||
var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
|
var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
|
||||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
|
||||||
buildReport.Summary.CompressOption = builtinBuildParameters.CompressOption;
|
buildReport.Summary.CompressOption = builtinBuildParameters.CompressOption;
|
||||||
buildReport.Summary.DisableWriteTypeTree = builtinBuildParameters.DisableWriteTypeTree;
|
buildReport.Summary.DisableWriteTypeTree = builtinBuildParameters.DisableWriteTypeTree;
|
||||||
buildReport.Summary.IgnoreTypeTreeChanges = builtinBuildParameters.IgnoreTypeTreeChanges;
|
buildReport.Summary.IgnoreTypeTreeChanges = builtinBuildParameters.IgnoreTypeTreeChanges;
|
||||||
}
|
}
|
||||||
else if (buildParameters.BuildPipeline == nameof(ScriptableBuildPipeline))
|
else if (buildParameters is ScriptableBuildParameters)
|
||||||
{
|
{
|
||||||
var scriptableBuildParameters = buildParameters as ScriptableBuildParameters;
|
var scriptableBuildParameters = buildParameters as ScriptableBuildParameters;
|
||||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
|
||||||
buildReport.Summary.CompressOption = scriptableBuildParameters.CompressOption;
|
buildReport.Summary.CompressOption = scriptableBuildParameters.CompressOption;
|
||||||
buildReport.Summary.DisableWriteTypeTree = scriptableBuildParameters.DisableWriteTypeTree;
|
buildReport.Summary.DisableWriteTypeTree = scriptableBuildParameters.DisableWriteTypeTree;
|
||||||
buildReport.Summary.IgnoreTypeTreeChanges = scriptableBuildParameters.IgnoreTypeTreeChanges;
|
buildReport.Summary.IgnoreTypeTreeChanges = scriptableBuildParameters.IgnoreTypeTreeChanges;
|
||||||
}
|
buildReport.Summary.WriteLinkXML = scriptableBuildParameters.WriteLinkXML;
|
||||||
else
|
buildReport.Summary.CacheServerHost = scriptableBuildParameters.CacheServerHost;
|
||||||
{
|
buildReport.Summary.CacheServerPort = scriptableBuildParameters.CacheServerPort;
|
||||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
buildReport.Summary.BuiltinShadersBundleName = scriptableBuildParameters.BuiltinShadersBundleName;
|
||||||
buildReport.Summary.CompressOption = ECompressOption.Uncompressed;
|
buildReport.Summary.MonoScriptsBundleName = scriptableBuildParameters.MonoScriptsBundleName;
|
||||||
buildReport.Summary.DisableWriteTypeTree = false;
|
|
||||||
buildReport.Summary.IgnoreTypeTreeChanges = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建结果
|
// 构建结果
|
||||||
@@ -91,7 +86,8 @@ namespace YooAsset.Editor
|
|||||||
reportAssetInfo.AssetGUID = AssetDatabase.AssetPathToGUID(packageAsset.AssetPath);
|
reportAssetInfo.AssetGUID = AssetDatabase.AssetPathToGUID(packageAsset.AssetPath);
|
||||||
reportAssetInfo.MainBundleName = mainBundle.BundleName;
|
reportAssetInfo.MainBundleName = mainBundle.BundleName;
|
||||||
reportAssetInfo.MainBundleSize = mainBundle.FileSize;
|
reportAssetInfo.MainBundleSize = mainBundle.FileSize;
|
||||||
reportAssetInfo.DependAssets = GetDependAssets(buildMapContext, mainBundle.BundleName, packageAsset.AssetPath);
|
reportAssetInfo.DependAssets = GetAssetDependAssets(buildMapContext, mainBundle.BundleName, packageAsset.AssetPath);
|
||||||
|
reportAssetInfo.DependBundles = GetAssetDependBundles(manifest, packageAsset);
|
||||||
buildReport.AssetInfos.Add(reportAssetInfo);
|
buildReport.AssetInfos.Add(reportAssetInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,8 +103,9 @@ namespace YooAsset.Editor
|
|||||||
reportBundleInfo.FileSize = packageBundle.FileSize;
|
reportBundleInfo.FileSize = packageBundle.FileSize;
|
||||||
reportBundleInfo.Encrypted = packageBundle.Encrypted;
|
reportBundleInfo.Encrypted = packageBundle.Encrypted;
|
||||||
reportBundleInfo.Tags = packageBundle.Tags;
|
reportBundleInfo.Tags = packageBundle.Tags;
|
||||||
reportBundleInfo.DependBundles = GetDependBundles(manifest, packageBundle);
|
reportBundleInfo.DependBundles = GetBundleDependBundles(manifest, packageBundle);
|
||||||
reportBundleInfo.AllBuiltinAssets = GetAllBuiltinAssets(buildMapContext, packageBundle.BundleName);
|
reportBundleInfo.ReferenceBundles = GetBundleReferenceBundles(manifest, packageBundle);
|
||||||
|
reportBundleInfo.BundleContents = GetBundleContents(buildMapContext, packageBundle.BundleName);
|
||||||
buildReport.BundleInfos.Add(reportBundleInfo);
|
buildReport.BundleInfos.Add(reportBundleInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,9 +120,40 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源对象依赖的所有资源包
|
/// 获取资源对象依赖的其它所有资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<string> GetDependBundles(PackageManifest manifest, PackageBundle packageBundle)
|
private List<AssetInfo> GetAssetDependAssets(BuildMapContext buildMapContext, string bundleName, string assetPath)
|
||||||
|
{
|
||||||
|
List<AssetInfo> result = new List<AssetInfo>();
|
||||||
|
var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
|
||||||
|
var assetInfo = bundleInfo.GetPackAssetInfo(assetPath);
|
||||||
|
foreach (var dependAssetInfo in assetInfo.AllDependAssetInfos)
|
||||||
|
{
|
||||||
|
result.Add(dependAssetInfo.AssetInfo);
|
||||||
|
}
|
||||||
|
result.Sort();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取资源对象依赖的资源包集合
|
||||||
|
/// </summary>
|
||||||
|
private List<string> GetAssetDependBundles(PackageManifest manifest, PackageAsset packageAsset)
|
||||||
|
{
|
||||||
|
List<string> dependBundles = new List<string>(packageAsset.DependBundleIDs.Length);
|
||||||
|
foreach (int index in packageAsset.DependBundleIDs)
|
||||||
|
{
|
||||||
|
string dependBundleName = manifest.BundleList[index].BundleName;
|
||||||
|
dependBundles.Add(dependBundleName);
|
||||||
|
}
|
||||||
|
dependBundles.Sort();
|
||||||
|
return dependBundles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取资源包依赖的资源包集合
|
||||||
|
/// </summary>
|
||||||
|
private List<string> GetBundleDependBundles(PackageManifest manifest, PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
List<string> dependBundles = new List<string>(packageBundle.DependIDs.Length);
|
List<string> dependBundles = new List<string>(packageBundle.DependIDs.Length);
|
||||||
foreach (int index in packageBundle.DependIDs)
|
foreach (int index in packageBundle.DependIDs)
|
||||||
@@ -138,42 +166,27 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源对象依赖的其它所有资源
|
/// 获取引用该资源包的资源包集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<string> GetDependAssets(BuildMapContext buildMapContext, string bundleName, string assetPath)
|
private List<string> GetBundleReferenceBundles(PackageManifest manifest, PackageBundle packageBundle)
|
||||||
{
|
{
|
||||||
List<string> result = new List<string>();
|
List<string> referenceBundles = new List<string>(packageBundle.ReferenceBundleIDs.Length);
|
||||||
var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
|
foreach (int index in packageBundle.ReferenceBundleIDs)
|
||||||
{
|
{
|
||||||
BuildAssetInfo findAssetInfo = null;
|
string dependBundleName = manifest.BundleList[index].BundleName;
|
||||||
foreach (var buildAsset in bundleInfo.MainAssets)
|
referenceBundles.Add(dependBundleName);
|
||||||
{
|
|
||||||
if (buildAsset.AssetInfo.AssetPath == assetPath)
|
|
||||||
{
|
|
||||||
findAssetInfo = buildAsset;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (findAssetInfo == null)
|
|
||||||
{
|
|
||||||
throw new Exception($"Should never get here ! Not found asset {assetPath} in bunlde {bundleName}");
|
|
||||||
}
|
|
||||||
foreach (var dependAssetInfo in findAssetInfo.AllDependAssetInfos)
|
|
||||||
{
|
|
||||||
result.Add(dependAssetInfo.AssetInfo.AssetPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result.Sort();
|
referenceBundles.Sort();
|
||||||
return result;
|
return referenceBundles;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取该资源包内的所有资源
|
/// 获取资源包内部所有资产
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<string> GetAllBuiltinAssets(BuildMapContext buildMapContext, string bundleName)
|
private List<AssetInfo> GetBundleContents(BuildMapContext buildMapContext, string bundleName)
|
||||||
{
|
{
|
||||||
var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
|
var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
|
||||||
List<string> result = bundleInfo.GetAllBuiltinAssetPaths();
|
List<AssetInfo> result = bundleInfo.GetBundleContents();
|
||||||
result.Sort();
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
long tempSize = 0;
|
long tempSize = 0;
|
||||||
|
|
||||||
var assetPaths = bundleInfo.GetAllMainAssetPaths();
|
var assetPaths = bundleInfo.GetAllPackAssetPaths();
|
||||||
foreach (var assetPath in assetPaths)
|
foreach (var assetPath in assetPaths)
|
||||||
{
|
{
|
||||||
long size = FileUtility.GetFileSize(assetPath);
|
long size = FileUtility.GetFileSize(assetPath);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace YooAsset.Editor
|
|||||||
foreach (var bundleInfo in buildMapContext.Collection)
|
foreach (var bundleInfo in buildMapContext.Collection)
|
||||||
{
|
{
|
||||||
string dest = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
|
string dest = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
|
||||||
foreach (var buildAsset in bundleInfo.MainAssets)
|
foreach (var buildAsset in bundleInfo.AllPackAssets)
|
||||||
{
|
{
|
||||||
EditorTools.CopyFile(buildAsset.AssetInfo.AssetPath, dest, true);
|
EditorTools.CopyFile(buildAsset.AssetInfo.AssetPath, dest, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace YooAsset.Editor
|
|||||||
// 注意:原生文件资源包只能包含一个原生文件
|
// 注意:原生文件资源包只能包含一个原生文件
|
||||||
foreach (var bundleInfo in buildMapContext.Collection)
|
foreach (var bundleInfo in buildMapContext.Collection)
|
||||||
{
|
{
|
||||||
if (bundleInfo.MainAssets.Count != 1)
|
if (bundleInfo.AllPackAssets.Count != 1)
|
||||||
{
|
{
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.NotSupportMultipleRawAsset, $"The bundle does not support multiple raw asset : {bundleInfo.BundleName}");
|
string message = BuildLogger.GetErrorMessage(ErrorCode.NotSupportMultipleRawAsset, $"The bundle does not support multiple raw asset : {bundleInfo.BundleName}");
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ namespace YooAsset.Editor
|
|||||||
public class BuildResultContext : IContextObject
|
public class BuildResultContext : IContextObject
|
||||||
{
|
{
|
||||||
public IBundleBuildResults Results;
|
public IBundleBuildResults Results;
|
||||||
|
public string BuiltinShadersBundleName;
|
||||||
|
public string MonoScriptsBundleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
@@ -53,6 +55,8 @@ namespace YooAsset.Editor
|
|||||||
BuildLogger.Log("UnityEngine build success!");
|
BuildLogger.Log("UnityEngine build success!");
|
||||||
BuildResultContext buildResultContext = new BuildResultContext();
|
BuildResultContext buildResultContext = new BuildResultContext();
|
||||||
buildResultContext.Results = buildResults;
|
buildResultContext.Results = buildResults;
|
||||||
|
buildResultContext.BuiltinShadersBundleName = builtinShadersBundleName;
|
||||||
|
buildResultContext.MonoScriptsBundleName = monoScriptsBundleName;
|
||||||
context.SetContextObject(buildResultContext);
|
context.SetContextObject(buildResultContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace YooAsset.Editor
|
|||||||
private readonly Dictionary<System.Type, IContextObject> _contextObjects = new Dictionary<System.Type, IContextObject>();
|
private readonly Dictionary<System.Type, IContextObject> _contextObjects = new Dictionary<System.Type, IContextObject>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清空所有情景对象
|
/// 清空所有上下文对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ClearAllContext()
|
public void ClearAllContext()
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置情景对象
|
/// 设置上下文对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetContextObject(IContextObject contextObject)
|
public void SetContextObject(IContextObject contextObject)
|
||||||
{
|
{
|
||||||
@@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取情景对象
|
/// 获取上下文对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public T GetContextObject<T>() where T : IContextObject
|
public T GetContextObject<T>() where T : IContextObject
|
||||||
{
|
{
|
||||||
@@ -46,5 +46,21 @@ namespace YooAsset.Editor
|
|||||||
throw new Exception($"Not found context object : {type}");
|
throw new Exception($"Not found context object : {type}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取上下文对象
|
||||||
|
/// </summary>
|
||||||
|
public T TryGetContextObject<T>() where T : IContextObject
|
||||||
|
{
|
||||||
|
var type = typeof(T);
|
||||||
|
if (_contextObjects.TryGetValue(type, out IContextObject contextObject))
|
||||||
|
{
|
||||||
|
return (T)contextObject;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,7 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
|
buildParameters.LegacyDependency = false;
|
||||||
buildParameters.EnableSharePackRule = true;
|
buildParameters.EnableSharePackRule = true;
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
|
buildParameters.LegacyDependency = false;
|
||||||
buildParameters.EnableSharePackRule = true;
|
buildParameters.EnableSharePackRule = true;
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
|
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
|
||||||
<ui:VisualElement name="PackageContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
<ui:VisualElement name="PackageContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
||||||
<ui:Label text="Packages" display-tooltip-when-elided="true" name="PackageTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
|
<ui:Label text="Packages" display-tooltip-when-elided="true" name="PackageTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
|
||||||
<ui:ListView focusable="true" name="PackageListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
|
<ui:ListView focusable="true" name="PackageListView" item-height="20" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" style="flex-grow: 1;" />
|
||||||
<ui:VisualElement name="PackageAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
|
<ui:VisualElement name="PackageAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
|
||||||
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
|
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
|
||||||
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
|
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<ui:Label text="Groups" display-tooltip-when-elided="true" name="GroupTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
|
<ui:Label text="Groups" display-tooltip-when-elided="true" name="GroupTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
|
||||||
<ui:TextField picking-mode="Ignore" label="Package Name" name="PackageName" style="flex-direction: column;" />
|
<ui:TextField picking-mode="Ignore" label="Package Name" name="PackageName" style="flex-direction: column;" />
|
||||||
<ui:TextField picking-mode="Ignore" label="Package Desc" name="PackageDesc" style="flex-direction: column;" />
|
<ui:TextField picking-mode="Ignore" label="Package Desc" name="PackageDesc" style="flex-direction: column;" />
|
||||||
<ui:ListView focusable="true" name="GroupListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
|
<ui:ListView focusable="true" name="GroupListView" item-height="20" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" style="flex-grow: 1;" />
|
||||||
<ui:VisualElement name="GroupAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
|
<ui:VisualElement name="GroupAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
|
||||||
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
|
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
|
||||||
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
|
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
|
||||||
|
|||||||
@@ -39,8 +39,14 @@ namespace YooAsset.Editor
|
|||||||
public long MainBundleSize;
|
public long MainBundleSize;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 依赖的资源路径列表
|
/// 依赖的资源集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> DependAssets = new List<string>();
|
public List<AssetInfo> DependAssets = new List<AssetInfo>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 依赖的资源包集合
|
||||||
|
/// 说明:框架层收集查询结果
|
||||||
|
/// </summary>
|
||||||
|
public List<string> DependBundles = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,14 +44,21 @@ namespace YooAsset.Editor
|
|||||||
public string[] Tags;
|
public string[] Tags;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源包的依赖集合
|
/// 依赖的资源包集合
|
||||||
|
/// 说明:引擎层构建查询结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> DependBundles;
|
public List<string> DependBundles = new List<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 该资源包内包含的所有资源
|
/// 引用该资源包的资源包集合
|
||||||
|
/// 说明:谁依赖该资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> AllBuiltinAssets = new List<string>();
|
public List<string> ReferenceBundles = new List<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源包内部所有资产
|
||||||
|
/// </summary>
|
||||||
|
public List<AssetInfo> BundleContents = new List<AssetInfo>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源分类标签的字符串
|
/// 获取资源分类标签的字符串
|
||||||
|
|||||||
@@ -67,14 +67,23 @@ namespace YooAsset.Editor
|
|||||||
public string IgnoreRuleName;
|
public string IgnoreRuleName;
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
|
public bool LegacyDependency;
|
||||||
public bool ClearBuildCacheFiles;
|
public bool ClearBuildCacheFiles;
|
||||||
public bool UseAssetDependencyDB;
|
public bool UseAssetDependencyDB;
|
||||||
public bool EnableSharePackRule;
|
public bool EnableSharePackRule;
|
||||||
|
public bool SingleReferencedPackAlone;
|
||||||
public string EncryptionClassName;
|
public string EncryptionClassName;
|
||||||
public EFileNameStyle FileNameStyle;
|
public EFileNameStyle FileNameStyle;
|
||||||
|
|
||||||
|
// 引擎参数
|
||||||
public ECompressOption CompressOption;
|
public ECompressOption CompressOption;
|
||||||
public bool DisableWriteTypeTree;
|
public bool DisableWriteTypeTree;
|
||||||
public bool IgnoreTypeTreeChanges;
|
public bool IgnoreTypeTreeChanges;
|
||||||
|
public bool WriteLinkXML = true;
|
||||||
|
public string CacheServerHost;
|
||||||
|
public int CacheServerPort;
|
||||||
|
public string BuiltinShadersBundleName;
|
||||||
|
public string MonoScriptsBundleName;
|
||||||
|
|
||||||
// 构建结果
|
// 构建结果
|
||||||
public int AssetFileTotalCount;
|
public int AssetFileTotalCount;
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ namespace YooAsset.Editor
|
|||||||
columnStyle.Stretchable = true;
|
columnStyle.Stretchable = true;
|
||||||
columnStyle.Searchable = true;
|
columnStyle.Searchable = true;
|
||||||
columnStyle.Sortable = true;
|
columnStyle.Sortable = true;
|
||||||
|
columnStyle.Counter = true;
|
||||||
var column = new TableColumn("DependBundles", "Depend Bundles", columnStyle);
|
var column = new TableColumn("DependBundles", "Depend Bundles", columnStyle);
|
||||||
column.MakeCell = () =>
|
column.MakeCell = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -320,15 +320,15 @@ namespace YooAsset.Editor
|
|||||||
sourceDatas.Add(rowData);
|
sourceDatas.Add(rowData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (string assetPath in bundleInfo.AllBuiltinAssets)
|
foreach (var assetInfo in bundleInfo.BundleContents)
|
||||||
{
|
{
|
||||||
if (mainAssetDic.Contains(assetPath) == false)
|
if (mainAssetDic.Contains(assetInfo.AssetPath) == false)
|
||||||
{
|
{
|
||||||
var rowData = new IncludeTableData();
|
var rowData = new IncludeTableData();
|
||||||
rowData.AssetInfo = null;
|
rowData.AssetInfo = null;
|
||||||
rowData.AddAssetPathCell("IncludeAssets", assetPath);
|
rowData.AddAssetPathCell("IncludeAssets", assetInfo.AssetPath);
|
||||||
rowData.AddStringValueCell("AssetSource", "BuiltinAsset");
|
rowData.AddStringValueCell("AssetSource", "BuiltinAsset");
|
||||||
rowData.AddStringValueCell("AssetGUID", "--");
|
rowData.AddStringValueCell("AssetGUID", assetInfo.AssetGUID);
|
||||||
sourceDatas.Add(rowData);
|
sourceDatas.Add(rowData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,24 +11,9 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
internal class ReporterSummaryViewer
|
internal class ReporterSummaryViewer
|
||||||
{
|
{
|
||||||
private class ItemWrapper
|
|
||||||
{
|
|
||||||
public string Title { private set; get; }
|
|
||||||
public string Value { private set; get; }
|
|
||||||
|
|
||||||
public ItemWrapper(string title, string value)
|
|
||||||
{
|
|
||||||
Title = title;
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private VisualTreeAsset _visualAsset;
|
private VisualTreeAsset _visualAsset;
|
||||||
private TemplateContainer _root;
|
private TemplateContainer _root;
|
||||||
|
private ScrollView _scrollView;
|
||||||
private ListView _listView;
|
|
||||||
private readonly List<ItemWrapper> _items = new List<ItemWrapper>();
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化页面
|
/// 初始化页面
|
||||||
@@ -44,9 +29,7 @@ namespace YooAsset.Editor
|
|||||||
_root.style.flexGrow = 1f;
|
_root.style.flexGrow = 1f;
|
||||||
|
|
||||||
// 概述列表
|
// 概述列表
|
||||||
_listView = _root.Q<ListView>("ListView");
|
_scrollView = _root.Q<ScrollView>("ScrollView");
|
||||||
_listView.makeItem = MakeListViewItem;
|
|
||||||
_listView.bindItem = BindListViewItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -54,52 +37,50 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void FillViewData(BuildReport buildReport)
|
public void FillViewData(BuildReport buildReport)
|
||||||
{
|
{
|
||||||
_items.Clear();
|
_scrollView.Clear();
|
||||||
|
|
||||||
_items.Add(new ItemWrapper("YooAsset Version", buildReport.Summary.YooVersion));
|
BindListViewHeader("Build Infos");
|
||||||
_items.Add(new ItemWrapper("UnityEngine Version", buildReport.Summary.UnityVersion));
|
BindListViewItem("YooAsset Version", buildReport.Summary.YooVersion);
|
||||||
_items.Add(new ItemWrapper("Build Date", buildReport.Summary.BuildDate));
|
BindListViewItem("UnityEngine Version", buildReport.Summary.UnityVersion);
|
||||||
_items.Add(new ItemWrapper("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds)));
|
BindListViewItem("Build Date", buildReport.Summary.BuildDate);
|
||||||
_items.Add(new ItemWrapper("Build Target", $"{buildReport.Summary.BuildTarget}"));
|
BindListViewItem("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds));
|
||||||
_items.Add(new ItemWrapper("Build Pipeline", $"{buildReport.Summary.BuildPipeline}"));
|
BindListViewItem("Build Target", $"{buildReport.Summary.BuildTarget}");
|
||||||
_items.Add(new ItemWrapper("Build Bundle Type", buildReport.Summary.BuildBundleType.ToString()));
|
BindListViewItem("Build Pipeline", $"{buildReport.Summary.BuildPipeline}");
|
||||||
_items.Add(new ItemWrapper("Package Name", buildReport.Summary.BuildPackageName));
|
BindListViewItem("Build Bundle Type", buildReport.Summary.BuildBundleType.ToString());
|
||||||
_items.Add(new ItemWrapper("Package Version", buildReport.Summary.BuildPackageVersion));
|
BindListViewItem("Package Name", buildReport.Summary.BuildPackageName);
|
||||||
_items.Add(new ItemWrapper("Package Note", buildReport.Summary.BuildPackageNote));
|
BindListViewItem("Package Version", buildReport.Summary.BuildPackageVersion);
|
||||||
|
BindListViewItem("Package Note", buildReport.Summary.BuildPackageNote);
|
||||||
|
BindListViewItem(string.Empty, string.Empty);
|
||||||
|
|
||||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
BindListViewHeader("Collect Settings");
|
||||||
_items.Add(new ItemWrapper("Collect Settings", string.Empty));
|
BindListViewItem("Unique Bundle Name", $"{buildReport.Summary.UniqueBundleName}");
|
||||||
_items.Add(new ItemWrapper("Unique Bundle Name", $"{buildReport.Summary.UniqueBundleName}"));
|
BindListViewItem("Enable Addressable", $"{buildReport.Summary.EnableAddressable}");
|
||||||
_items.Add(new ItemWrapper("Enable Addressable", $"{buildReport.Summary.EnableAddressable}"));
|
BindListViewItem("Location To Lower", $"{buildReport.Summary.LocationToLower}");
|
||||||
_items.Add(new ItemWrapper("Location To Lower", $"{buildReport.Summary.LocationToLower}"));
|
BindListViewItem("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}");
|
||||||
_items.Add(new ItemWrapper("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}"));
|
BindListViewItem("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}");
|
||||||
_items.Add(new ItemWrapper("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}"));
|
BindListViewItem("Ignore Rule Name", $"{buildReport.Summary.IgnoreRuleName}");
|
||||||
_items.Add(new ItemWrapper("Ignore Rule Name", $"{buildReport.Summary.IgnoreRuleName}"));
|
BindListViewItem(string.Empty, string.Empty);
|
||||||
|
|
||||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
BindListViewHeader("Build Params");
|
||||||
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
BindListViewItem("Legacy Dependency Mode", $"{buildReport.Summary.LegacyDependency}");
|
||||||
_items.Add(new ItemWrapper("Clear Build Cache Files", $"{buildReport.Summary.ClearBuildCacheFiles}"));
|
BindListViewItem("Clear Build Cache Files", $"{buildReport.Summary.ClearBuildCacheFiles}");
|
||||||
_items.Add(new ItemWrapper("Use Asset Dependency DB", $"{buildReport.Summary.UseAssetDependencyDB}"));
|
BindListViewItem("Use Asset Dependency DB", $"{buildReport.Summary.UseAssetDependencyDB}");
|
||||||
_items.Add(new ItemWrapper("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}"));
|
BindListViewItem("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}");
|
||||||
_items.Add(new ItemWrapper("Encryption Class Name", buildReport.Summary.EncryptionClassName));
|
BindListViewItem("Single Referenced Pack Alone", $"{buildReport.Summary.SingleReferencedPackAlone}");
|
||||||
_items.Add(new ItemWrapper("FileNameStyle", $"{buildReport.Summary.FileNameStyle}"));
|
BindListViewItem("Encryption Class Name", buildReport.Summary.EncryptionClassName);
|
||||||
_items.Add(new ItemWrapper("CompressOption", $"{buildReport.Summary.CompressOption}"));
|
BindListViewItem("FileNameStyle", $"{buildReport.Summary.FileNameStyle}");
|
||||||
_items.Add(new ItemWrapper("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}"));
|
BindListViewItem("CompressOption", $"{buildReport.Summary.CompressOption}");
|
||||||
_items.Add(new ItemWrapper("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}"));
|
BindListViewItem("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}");
|
||||||
|
BindListViewItem("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}");
|
||||||
|
BindListViewItem(string.Empty, string.Empty);
|
||||||
|
|
||||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
BindListViewHeader("Build Results");
|
||||||
_items.Add(new ItemWrapper("Build Results", string.Empty));
|
BindListViewItem("Asset File Total Count", $"{buildReport.Summary.AssetFileTotalCount}");
|
||||||
_items.Add(new ItemWrapper("Asset File Total Count", $"{buildReport.Summary.AssetFileTotalCount}"));
|
BindListViewItem("Main Asset Total Count", $"{buildReport.Summary.MainAssetTotalCount}");
|
||||||
_items.Add(new ItemWrapper("Main Asset Total Count", $"{buildReport.Summary.MainAssetTotalCount}"));
|
BindListViewItem("All Bundle Total Count", $"{buildReport.Summary.AllBundleTotalCount}");
|
||||||
_items.Add(new ItemWrapper("All Bundle Total Count", $"{buildReport.Summary.AllBundleTotalCount}"));
|
BindListViewItem("All Bundle Total Size", ConvertSize(buildReport.Summary.AllBundleTotalSize));
|
||||||
_items.Add(new ItemWrapper("All Bundle Total Size", ConvertSize(buildReport.Summary.AllBundleTotalSize)));
|
BindListViewItem("Encrypted Bundle Total Count", $"{buildReport.Summary.EncryptedBundleTotalCount}");
|
||||||
_items.Add(new ItemWrapper("Encrypted Bundle Total Count", $"{buildReport.Summary.EncryptedBundleTotalCount}"));
|
BindListViewItem("Encrypted Bundle Total Size", ConvertSize(buildReport.Summary.EncryptedBundleTotalSize));
|
||||||
_items.Add(new ItemWrapper("Encrypted Bundle Total Size", ConvertSize(buildReport.Summary.EncryptedBundleTotalSize)));
|
|
||||||
|
|
||||||
_listView.Clear();
|
|
||||||
_listView.ClearSelection();
|
|
||||||
_listView.itemsSource = _items;
|
|
||||||
_listView.Rebuild();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -119,45 +100,60 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 列表相关
|
// 列表相关
|
||||||
|
private void BindListViewHeader(string titile)
|
||||||
|
{
|
||||||
|
Toolbar toolbar = new Toolbar();
|
||||||
|
_scrollView.Add(toolbar);
|
||||||
|
|
||||||
|
ToolbarButton titleButton = new ToolbarButton();
|
||||||
|
titleButton.text = titile;
|
||||||
|
titleButton.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||||
|
titleButton.style.width = 200;
|
||||||
|
toolbar.Add(titleButton);
|
||||||
|
|
||||||
|
ToolbarButton valueButton = new ToolbarButton();
|
||||||
|
valueButton.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||||
|
valueButton.style.width = 150;
|
||||||
|
valueButton.style.flexShrink = 1;
|
||||||
|
valueButton.style.flexGrow = 1;
|
||||||
|
valueButton.SetEnabled(false);
|
||||||
|
toolbar.Add(valueButton);
|
||||||
|
}
|
||||||
|
private void BindListViewItem(string name, string value)
|
||||||
|
{
|
||||||
|
VisualElement element = MakeListViewItem();
|
||||||
|
_scrollView.Add(element);
|
||||||
|
|
||||||
|
// Title
|
||||||
|
var titleLabel = element.Q<Label>("TitleLabel");
|
||||||
|
titleLabel.text = name;
|
||||||
|
|
||||||
|
// Value
|
||||||
|
var valueLabel = element.Q<Label>("ValueLabel");
|
||||||
|
valueLabel.text = value;
|
||||||
|
}
|
||||||
private VisualElement MakeListViewItem()
|
private VisualElement MakeListViewItem()
|
||||||
{
|
{
|
||||||
VisualElement element = new VisualElement();
|
VisualElement element = new VisualElement();
|
||||||
element.style.flexDirection = FlexDirection.Row;
|
element.style.flexDirection = FlexDirection.Row;
|
||||||
|
|
||||||
{
|
var titleLabel = new Label();
|
||||||
var label = new Label();
|
titleLabel.name = "TitleLabel";
|
||||||
label.name = "Label1";
|
titleLabel.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
titleLabel.style.marginLeft = 3f;
|
||||||
label.style.marginLeft = 3f;
|
titleLabel.style.width = 200;
|
||||||
//label.style.flexGrow = 1f;
|
element.Add(titleLabel);
|
||||||
label.style.width = 200;
|
|
||||||
element.Add(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
var valueLabel = new Label();
|
||||||
var label = new Label();
|
valueLabel.name = "ValueLabel";
|
||||||
label.name = "Label2";
|
valueLabel.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
valueLabel.style.marginLeft = 3f;
|
||||||
label.style.marginLeft = 3f;
|
valueLabel.style.flexGrow = 1f;
|
||||||
label.style.flexGrow = 1f;
|
valueLabel.style.width = 150;
|
||||||
label.style.width = 150;
|
element.Add(valueLabel);
|
||||||
element.Add(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
private void BindListViewItem(VisualElement element, int index)
|
|
||||||
{
|
|
||||||
var itemWrapper = _items[index];
|
|
||||||
|
|
||||||
// Title
|
|
||||||
var label1 = element.Q<Label>("Label1");
|
|
||||||
label1.text = itemWrapper.Title;
|
|
||||||
|
|
||||||
// Value
|
|
||||||
var label2 = element.Q<Label>("Label2");
|
|
||||||
label2.text = itemWrapper.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string ConvertTime(int time)
|
private string ConvertTime(int time)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<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;">
|
||||||
<uie:Toolbar name="TopBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
|
<ui:ScrollView name="ScrollView" horizontal-scroller-visibility="Hidden" />
|
||||||
<uie:ToolbarButton text="Info" display-tooltip-when-elided="true" name="TopBar1" style="width: 200px; -unity-text-align: middle-left; flex-grow: 0;" />
|
|
||||||
<uie:ToolbarButton text="Param" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 1;" />
|
|
||||||
</uie:Toolbar>
|
|
||||||
<ui:ListView focusable="true" name="ListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
|
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
</ui:UXML>
|
</ui:UXML>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Collections.Generic;
|
|||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class AssetInfo
|
public class AssetInfo : IComparable<AssetInfo>
|
||||||
{
|
{
|
||||||
private string _fileExtension = null;
|
private string _fileExtension = null;
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AssetInfo(string assetPath)
|
public AssetInfo(string assetPath)
|
||||||
{
|
{
|
||||||
AssetPath = assetPath;
|
AssetPath = assetPath;
|
||||||
@@ -60,5 +61,10 @@ namespace YooAsset.Editor
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int CompareTo(AssetInfo other)
|
||||||
|
{
|
||||||
|
return this.AssetPath.CompareTo(other.AssetPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,6 +129,21 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region PackageManager
|
||||||
|
public static string GetPackageManagerYooVersion()
|
||||||
|
{
|
||||||
|
#if UNITY_2019_4_OR_NEWER
|
||||||
|
UnityEditor.PackageManager.PackageInfo packageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssembly(typeof(YooAssets).Assembly);
|
||||||
|
if (packageInfo != null)
|
||||||
|
return packageInfo.version;
|
||||||
|
else
|
||||||
|
return string.Empty;
|
||||||
|
#else
|
||||||
|
return string.Empty;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region EditorUtility
|
#region EditorUtility
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 搜集资源
|
/// 搜集资源
|
||||||
@@ -559,7 +574,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式
|
return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 移除路径里的后缀名
|
/// 移除路径里的后缀名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -12,15 +12,9 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PanelSplitView : TwoPaneSplitView
|
public class PanelSplitView : TwoPaneSplitView
|
||||||
{
|
{
|
||||||
#if UNITY_6000_0_OR_NEWER
|
|
||||||
public new class UxmlFactory : UxmlElementAttribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
public new class UxmlFactory : UxmlFactory<PanelSplitView, UxmlTraits>
|
public new class UxmlFactory : UxmlFactory<PanelSplitView, UxmlTraits>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 竖版分屏
|
/// 竖版分屏
|
||||||
|
|||||||
@@ -0,0 +1,627 @@
|
|||||||
|
#if UNITY_2021_3_OR_NEWER
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor.UIElements;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class ReorderableListView : VisualElement
|
||||||
|
{
|
||||||
|
public new class UxmlFactory : UxmlFactory<ReorderableListView, UxmlTraits>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 制作元素委托
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public delegate VisualElement MakeElementDelegate();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绑定元素委托
|
||||||
|
/// </summary>
|
||||||
|
public delegate void BindElementDelegqate(VisualElement element, int index);
|
||||||
|
|
||||||
|
private Foldout _foldout;
|
||||||
|
private ListView _listView;
|
||||||
|
private Label _headerLabel;
|
||||||
|
private Button _addButton;
|
||||||
|
private Button _removeButton;
|
||||||
|
private string _headerName = nameof(ReorderableListView);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 源数据
|
||||||
|
/// </summary>
|
||||||
|
public IList SourceData
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value is ArrayList)
|
||||||
|
throw new Exception($"{nameof(SourceData)} not support {nameof(ArrayList)}");
|
||||||
|
|
||||||
|
_listView.Clear();
|
||||||
|
_listView.ClearSelection();
|
||||||
|
_listView.itemsSource = value;
|
||||||
|
_listView.Rebuild();
|
||||||
|
RefreshFoldoutName();
|
||||||
|
RefreshRemoveButton();
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _listView.itemsSource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 元素固定高度
|
||||||
|
/// </summary>
|
||||||
|
public float ElementHeight
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_listView.fixedItemHeight = value;
|
||||||
|
_listView.Rebuild();
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _listView.fixedItemHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 增加按钮显隐
|
||||||
|
/// </summary>
|
||||||
|
public bool DisplayAdd
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
UIElementsTools.SetElementVisible(_addButton, value);
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _addButton.style.visibility == Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移除按钮显隐
|
||||||
|
/// </summary>
|
||||||
|
public bool DisplayRemove
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
UIElementsTools.SetElementVisible(_removeButton, value);
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _removeButton.style.visibility == Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标题名称
|
||||||
|
/// </summary>
|
||||||
|
public string HeaderName
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_headerName = value;
|
||||||
|
RefreshFoldoutName();
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _headerName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 制作元素的回调
|
||||||
|
/// </summary>
|
||||||
|
public MakeElementDelegate MakeElementCallback;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绑定元素的回调
|
||||||
|
/// </summary>
|
||||||
|
public BindElementDelegqate BindElementCallback;
|
||||||
|
|
||||||
|
|
||||||
|
public ReorderableListView()
|
||||||
|
{
|
||||||
|
CreateView(true);
|
||||||
|
}
|
||||||
|
public ReorderableListView(bool foldout)
|
||||||
|
{
|
||||||
|
CreateView(foldout);
|
||||||
|
}
|
||||||
|
private void CreateView(bool foldout)
|
||||||
|
{
|
||||||
|
this.style.flexGrow = 1;
|
||||||
|
this.style.flexShrink = 1;
|
||||||
|
|
||||||
|
// 折叠栏
|
||||||
|
if (foldout)
|
||||||
|
{
|
||||||
|
_foldout = new Foldout();
|
||||||
|
_foldout.style.flexGrow = 1f;
|
||||||
|
_foldout.style.flexShrink = 1f;
|
||||||
|
_foldout.text = $"{nameof(ReorderableListView)}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_headerLabel = new Label();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 列表视图
|
||||||
|
_listView = new ListView();
|
||||||
|
_listView.style.flexGrow = 1;
|
||||||
|
_listView.style.flexShrink = 1;
|
||||||
|
_listView.reorderable = true;
|
||||||
|
_listView.reorderMode = ListViewReorderMode.Animated;
|
||||||
|
_listView.makeItem = MakeListViewElement;
|
||||||
|
_listView.bindItem = BindListViewElement;
|
||||||
|
#if UNITY_2022_3_OR_NEWER
|
||||||
|
_listView.selectionChanged += OnSelectionChanged;
|
||||||
|
#elif UNITY_2020_1_OR_NEWER
|
||||||
|
_listView.onSelectionChange += OnSelectionChanged;
|
||||||
|
#else
|
||||||
|
_listView.onSelectionChanged += OnSelectionChanged;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 按钮组
|
||||||
|
var buttonContainer = new VisualElement();
|
||||||
|
buttonContainer.style.flexDirection = FlexDirection.RowReverse;
|
||||||
|
|
||||||
|
// 移除按钮
|
||||||
|
_removeButton = new Button();
|
||||||
|
_removeButton.text = " - ";
|
||||||
|
_removeButton.clicked += OnClickRemoveButton;
|
||||||
|
_removeButton.SetEnabled(false);
|
||||||
|
buttonContainer.Add(_removeButton);
|
||||||
|
|
||||||
|
// 增加按钮
|
||||||
|
_addButton = new Button();
|
||||||
|
_addButton.text = " + ";
|
||||||
|
_addButton.clicked += OnClickAddButton;
|
||||||
|
buttonContainer.Add(_addButton);
|
||||||
|
|
||||||
|
// 组织页面
|
||||||
|
if (foldout)
|
||||||
|
{
|
||||||
|
_foldout.Add(_listView);
|
||||||
|
_foldout.Add(buttonContainer);
|
||||||
|
this.Add(_foldout);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Add(_headerLabel);
|
||||||
|
this.Add(_listView);
|
||||||
|
this.Add(buttonContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void OnClickAddButton()
|
||||||
|
{
|
||||||
|
if (_listView.itemsSource != null)
|
||||||
|
{
|
||||||
|
object defaultValue = GetElementDefaultValue();
|
||||||
|
_listView.itemsSource.Add(defaultValue);
|
||||||
|
_listView.Rebuild();
|
||||||
|
RefreshFoldoutName();
|
||||||
|
RefreshRemoveButton();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning("The source data is null !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void OnClickRemoveButton()
|
||||||
|
{
|
||||||
|
if (_listView.itemsSource != null)
|
||||||
|
{
|
||||||
|
if (_listView.selectedIndex >= 0)
|
||||||
|
{
|
||||||
|
_listView.itemsSource.RemoveAt(_listView.selectedIndex);
|
||||||
|
_listView.Rebuild();
|
||||||
|
RefreshFoldoutName();
|
||||||
|
RefreshRemoveButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning("The source data is null !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void OnSelectionChanged(IEnumerable<object> objs)
|
||||||
|
{
|
||||||
|
RefreshRemoveButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成元素
|
||||||
|
/// </summary>
|
||||||
|
private VisualElement MakeListViewElement()
|
||||||
|
{
|
||||||
|
if (MakeElementCallback != null)
|
||||||
|
{
|
||||||
|
return MakeElementCallback.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
Type elementType = GetElementType();
|
||||||
|
if (elementType == typeof(string))
|
||||||
|
{
|
||||||
|
TextField textField = new TextField();
|
||||||
|
textField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)textField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = textField.value;
|
||||||
|
});
|
||||||
|
return textField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(int))
|
||||||
|
{
|
||||||
|
IntegerField intField = new IntegerField();
|
||||||
|
intField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)intField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = intField.value;
|
||||||
|
});
|
||||||
|
return intField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(long))
|
||||||
|
{
|
||||||
|
LongField longField = new LongField();
|
||||||
|
longField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)longField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = longField.value;
|
||||||
|
});
|
||||||
|
return longField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(float))
|
||||||
|
{
|
||||||
|
FloatField floatField = new FloatField();
|
||||||
|
floatField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)floatField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = floatField.value;
|
||||||
|
});
|
||||||
|
return floatField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(double))
|
||||||
|
{
|
||||||
|
DoubleField doubleField = new DoubleField();
|
||||||
|
doubleField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)doubleField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = doubleField.value;
|
||||||
|
});
|
||||||
|
return doubleField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(bool))
|
||||||
|
{
|
||||||
|
Toggle toggle = new Toggle();
|
||||||
|
toggle.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)toggle.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = toggle.value;
|
||||||
|
});
|
||||||
|
return toggle;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Hash128))
|
||||||
|
{
|
||||||
|
Hash128Field hash128Field = new Hash128Field();
|
||||||
|
hash128Field.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)hash128Field.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = hash128Field.value;
|
||||||
|
});
|
||||||
|
return hash128Field;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Vector2))
|
||||||
|
{
|
||||||
|
Vector2Field vector2Field = new Vector2Field();
|
||||||
|
vector2Field.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)vector2Field.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = vector2Field.value;
|
||||||
|
});
|
||||||
|
return vector2Field;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Vector3))
|
||||||
|
{
|
||||||
|
Vector3Field vector3Field = new Vector3Field();
|
||||||
|
vector3Field.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)vector3Field.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = vector3Field.value;
|
||||||
|
});
|
||||||
|
return vector3Field;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Vector4))
|
||||||
|
{
|
||||||
|
Vector4Field vector4Field = new Vector4Field();
|
||||||
|
vector4Field.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)vector4Field.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = vector4Field.value;
|
||||||
|
});
|
||||||
|
return vector4Field;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Rect))
|
||||||
|
{
|
||||||
|
RectField rectField = new RectField();
|
||||||
|
rectField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)rectField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = rectField.value;
|
||||||
|
});
|
||||||
|
return rectField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Bounds))
|
||||||
|
{
|
||||||
|
BoundsField boundsField = new BoundsField();
|
||||||
|
boundsField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)boundsField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = boundsField.value;
|
||||||
|
});
|
||||||
|
return boundsField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Color))
|
||||||
|
{
|
||||||
|
ColorField colorField = new ColorField();
|
||||||
|
colorField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)colorField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = colorField.value;
|
||||||
|
});
|
||||||
|
return colorField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Gradient))
|
||||||
|
{
|
||||||
|
GradientField gradientField = new GradientField();
|
||||||
|
gradientField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)gradientField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = gradientField.value;
|
||||||
|
});
|
||||||
|
return gradientField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(AnimationCurve))
|
||||||
|
{
|
||||||
|
CurveField curveField = new CurveField();
|
||||||
|
curveField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)curveField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = curveField.value;
|
||||||
|
});
|
||||||
|
return curveField;
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(UnityEngine.Object))
|
||||||
|
{
|
||||||
|
ObjectField objectField = new ObjectField();
|
||||||
|
objectField.objectType = typeof(UnityEngine.Object);
|
||||||
|
objectField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)objectField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = objectField.value;
|
||||||
|
});
|
||||||
|
return objectField;
|
||||||
|
}
|
||||||
|
else if (elementType.IsEnum)
|
||||||
|
{
|
||||||
|
EnumField enumField = new EnumField();
|
||||||
|
enumField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
int itemIndex = (int)enumField.userData;
|
||||||
|
_listView.itemsSource[itemIndex] = enumField.value;
|
||||||
|
});
|
||||||
|
return enumField;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Label label = new Label();
|
||||||
|
label.text = $"Not support element type : {elementType.Name}";
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绑定元素
|
||||||
|
/// </summary>
|
||||||
|
private void BindListViewElement(VisualElement listViewElement, int index)
|
||||||
|
{
|
||||||
|
if (BindElementCallback != null)
|
||||||
|
{
|
||||||
|
BindElementCallback.Invoke(listViewElement, index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var elementValue = _listView.itemsSource[index];
|
||||||
|
string elementName = GetElementName(index);
|
||||||
|
Type elementType = GetElementType();
|
||||||
|
if (elementType == typeof(string))
|
||||||
|
{
|
||||||
|
TextField textField = listViewElement as TextField;
|
||||||
|
textField.userData = index;
|
||||||
|
textField.label = elementName;
|
||||||
|
textField.SetValueWithoutNotify(elementValue as string);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(int))
|
||||||
|
{
|
||||||
|
IntegerField intField = listViewElement as IntegerField;
|
||||||
|
intField.userData = index;
|
||||||
|
intField.label = elementName;
|
||||||
|
intField.SetValueWithoutNotify((int)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(long))
|
||||||
|
{
|
||||||
|
LongField longField = listViewElement as LongField;
|
||||||
|
longField.userData = index;
|
||||||
|
longField.label = elementName;
|
||||||
|
longField.SetValueWithoutNotify((long)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(float))
|
||||||
|
{
|
||||||
|
FloatField floatField = listViewElement as FloatField;
|
||||||
|
floatField.userData = index;
|
||||||
|
floatField.label = elementName;
|
||||||
|
floatField.SetValueWithoutNotify((float)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(double))
|
||||||
|
{
|
||||||
|
DoubleField doubleField = listViewElement as DoubleField;
|
||||||
|
doubleField.userData = index;
|
||||||
|
doubleField.label = elementName;
|
||||||
|
doubleField.SetValueWithoutNotify((double)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(bool))
|
||||||
|
{
|
||||||
|
Toggle toggle = listViewElement as Toggle;
|
||||||
|
toggle.userData = index;
|
||||||
|
toggle.label = elementName;
|
||||||
|
toggle.SetValueWithoutNotify((bool)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Hash128))
|
||||||
|
{
|
||||||
|
Hash128Field hash128Field = listViewElement as Hash128Field;
|
||||||
|
hash128Field.userData = index;
|
||||||
|
hash128Field.label = elementName;
|
||||||
|
hash128Field.SetValueWithoutNotify((Hash128)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Vector2))
|
||||||
|
{
|
||||||
|
Vector2Field vector2Field = listViewElement as Vector2Field;
|
||||||
|
vector2Field.userData = index;
|
||||||
|
vector2Field.label = elementName;
|
||||||
|
vector2Field.SetValueWithoutNotify((Vector2)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Vector3))
|
||||||
|
{
|
||||||
|
Vector3Field vector3Field = listViewElement as Vector3Field;
|
||||||
|
vector3Field.userData = index;
|
||||||
|
vector3Field.label = elementName;
|
||||||
|
vector3Field.SetValueWithoutNotify((Vector3)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Vector4))
|
||||||
|
{
|
||||||
|
Vector4Field vector4Field = listViewElement as Vector4Field;
|
||||||
|
vector4Field.userData = index;
|
||||||
|
vector4Field.label = elementName;
|
||||||
|
vector4Field.SetValueWithoutNotify((Vector4)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Rect))
|
||||||
|
{
|
||||||
|
RectField rectField = listViewElement as RectField;
|
||||||
|
rectField.userData = index;
|
||||||
|
rectField.label = elementName;
|
||||||
|
rectField.SetValueWithoutNotify((Rect)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Bounds))
|
||||||
|
{
|
||||||
|
BoundsField boundsField = listViewElement as BoundsField;
|
||||||
|
boundsField.userData = index;
|
||||||
|
boundsField.label = elementName;
|
||||||
|
boundsField.SetValueWithoutNotify((Bounds)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Color))
|
||||||
|
{
|
||||||
|
ColorField colorField = listViewElement as ColorField;
|
||||||
|
colorField.userData = index;
|
||||||
|
colorField.label = elementName;
|
||||||
|
colorField.SetValueWithoutNotify((Color)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(Gradient))
|
||||||
|
{
|
||||||
|
GradientField gradientField = listViewElement as GradientField;
|
||||||
|
gradientField.userData = index;
|
||||||
|
gradientField.label = elementName;
|
||||||
|
gradientField.SetValueWithoutNotify((Gradient)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(AnimationCurve))
|
||||||
|
{
|
||||||
|
CurveField curveField = listViewElement as CurveField;
|
||||||
|
curveField.userData = index;
|
||||||
|
curveField.label = elementName;
|
||||||
|
curveField.SetValueWithoutNotify((AnimationCurve)elementValue);
|
||||||
|
}
|
||||||
|
else if (elementType == typeof(UnityEngine.Object))
|
||||||
|
{
|
||||||
|
ObjectField objectField = listViewElement as ObjectField;
|
||||||
|
objectField.userData = index;
|
||||||
|
objectField.label = elementName;
|
||||||
|
objectField.SetValueWithoutNotify(elementValue as UnityEngine.Object);
|
||||||
|
}
|
||||||
|
else if (elementType.IsEnum)
|
||||||
|
{
|
||||||
|
EnumField enumField = listViewElement as EnumField;
|
||||||
|
enumField.userData = index;
|
||||||
|
enumField.label = elementName;
|
||||||
|
enumField.Init((Enum)elementValue);
|
||||||
|
enumField.SetValueWithoutNotify((Enum)elementValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Type GetElementType()
|
||||||
|
{
|
||||||
|
Type elementType = _listView.itemsSource.GetType().GetGenericArguments()[0];
|
||||||
|
return elementType;
|
||||||
|
}
|
||||||
|
private object GetElementDefaultValue()
|
||||||
|
{
|
||||||
|
Type type = GetElementType();
|
||||||
|
if (type.IsValueType)
|
||||||
|
{
|
||||||
|
return Activator.CreateInstance(type);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private string GetElementName(int index)
|
||||||
|
{
|
||||||
|
return $"Element {index}";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshRemoveButton()
|
||||||
|
{
|
||||||
|
if (_listView.itemsSource == null)
|
||||||
|
{
|
||||||
|
_removeButton.SetEnabled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意:数据列表移除元素的时候有可能会越界!
|
||||||
|
if (_listView.selectedIndex >= _listView.itemsSource.Count)
|
||||||
|
_listView.ClearSelection();
|
||||||
|
|
||||||
|
if (_listView.selectedIndex >= 0)
|
||||||
|
_removeButton.SetEnabled(true);
|
||||||
|
else
|
||||||
|
_removeButton.SetEnabled(false);
|
||||||
|
}
|
||||||
|
private void RefreshFoldoutName()
|
||||||
|
{
|
||||||
|
if (_listView.itemsSource == null)
|
||||||
|
{
|
||||||
|
if (_foldout != null)
|
||||||
|
_foldout.text = _headerName;
|
||||||
|
if (_headerLabel != null)
|
||||||
|
_headerLabel.text = _headerName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_foldout != null)
|
||||||
|
_foldout.text = _headerName + $" ({_listView.itemsSource.Count}) ";
|
||||||
|
if (_headerLabel != null)
|
||||||
|
_headerLabel.text = _headerName + $" ({_listView.itemsSource.Count}) ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 111ec0d18888d7e4396b2192f7b4f347
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -9,15 +9,9 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
public class ResizeHandle : VisualElement
|
public class ResizeHandle : VisualElement
|
||||||
{
|
{
|
||||||
#if UNITY_6000_0_OR_NEWER
|
|
||||||
public new class UxmlFactory : UxmlElementAttribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
public new class UxmlFactory : UxmlFactory<ResizeHandle, UxmlTraits>
|
public new class UxmlFactory : UxmlFactory<ResizeHandle, UxmlTraits>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
private bool _isResizing = false;
|
private bool _isResizing = false;
|
||||||
private float _initialWidth;
|
private float _initialWidth;
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Sortable = false;
|
public bool Sortable = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 统计数量
|
||||||
|
/// </summary>
|
||||||
|
public bool Counter = false;
|
||||||
|
|
||||||
public ColumnStyle(Length width)
|
public ColumnStyle(Length width)
|
||||||
{
|
{
|
||||||
if (width.value > MaxValue)
|
if (width.value > MaxValue)
|
||||||
|
|||||||
@@ -15,15 +15,9 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class TableView : VisualElement
|
public class TableView : VisualElement
|
||||||
{
|
{
|
||||||
#if UNITY_6000_0_OR_NEWER
|
|
||||||
public new class UxmlFactory : UxmlElementAttribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
public new class UxmlFactory : UxmlFactory<TableView, UxmlTraits>
|
public new class UxmlFactory : UxmlFactory<TableView, UxmlTraits>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
private readonly Toolbar _toolbar;
|
private readonly Toolbar _toolbar;
|
||||||
private readonly ListView _listView;
|
private readonly ListView _listView;
|
||||||
@@ -95,7 +89,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// 定义标题栏
|
// 定义标题栏
|
||||||
_toolbar = new Toolbar();
|
_toolbar = new Toolbar();
|
||||||
|
|
||||||
// 定义列表视图
|
// 定义列表视图
|
||||||
_listView = new ListView();
|
_listView = new ListView();
|
||||||
_listView.style.flexShrink = 1f;
|
_listView.style.flexShrink = 1f;
|
||||||
@@ -197,6 +191,16 @@ namespace YooAsset.Editor
|
|||||||
_listView.ClearSelection();
|
_listView.ClearSelection();
|
||||||
_listView.itemsSource = itemsSource.ToList();
|
_listView.itemsSource = itemsSource.ToList();
|
||||||
_listView.Rebuild();
|
_listView.Rebuild();
|
||||||
|
|
||||||
|
// 动态设置元素数量
|
||||||
|
foreach (var column in _columns)
|
||||||
|
{
|
||||||
|
if (column.ColumnStyle.Counter)
|
||||||
|
{
|
||||||
|
var toobarButton = GetHeaderElement(column.ElementName) as ToolbarButton;
|
||||||
|
toobarButton.text = $"{column.HeaderTitle} ({itemsSource.Count()})";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建默认的WebServer文件系统参数
|
/// 创建默认的WebServer文件系统参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="decryptionServices">加密文件解密服务类</param>
|
||||||
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
||||||
public static FileSystemParameters CreateDefaultWebServerFileSystemParameters(IWebDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
|
public static FileSystemParameters CreateDefaultWebServerFileSystemParameters(IWebDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
|
||||||
{
|
{
|
||||||
@@ -123,6 +124,7 @@ namespace YooAsset
|
|||||||
/// 创建默认的WebRemote文件系统参数
|
/// 创建默认的WebRemote文件系统参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="remoteServices">远端资源地址查询服务类</param>
|
/// <param name="remoteServices">远端资源地址查询服务类</param>
|
||||||
|
/// <param name="decryptionServices">加密文件解密服务类</param>
|
||||||
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
/// <param name="disableUnityWebCache">禁用Unity的网络缓存</param>
|
||||||
public static FileSystemParameters CreateDefaultWebRemoteFileSystemParameters(IRemoteServices remoteServices, IWebDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
|
public static FileSystemParameters CreateDefaultWebRemoteFileSystemParameters(IRemoteServices remoteServices, IWebDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ namespace YooAsset
|
|||||||
private static Stopwatch _watch;
|
private static Stopwatch _watch;
|
||||||
private static long _frameTime;
|
private static long _frameTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 快速启动模式
|
||||||
|
/// </summary>
|
||||||
|
public static bool QuickStartMode = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异步操作的最小时间片段
|
/// 异步操作的最小时间片段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -136,6 +141,11 @@ namespace YooAsset
|
|||||||
_newList.Add(operation);
|
_newList.Add(operation);
|
||||||
operation.SetPackageName(packageName);
|
operation.SetPackageName(packageName);
|
||||||
operation.SetStart();
|
operation.SetStart();
|
||||||
|
|
||||||
|
if (QuickStartMode)
|
||||||
|
{
|
||||||
|
operation.InternalOnUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,23 @@ namespace YooAsset
|
|||||||
if (IsDone == false)
|
if (IsDone == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return RefCount <= 0;
|
if (RefCount > 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#region YOOASSET_LEGACY_DEPENDENCY
|
||||||
|
// 检查引用链上的资源包是否已经全部销毁
|
||||||
|
// 注意:互相引用的资源包无法卸载!
|
||||||
|
if (LoadBundleInfo.Bundle.ReferenceBundleIDs.Length > 0)
|
||||||
|
{
|
||||||
|
foreach (var bundleID in LoadBundleInfo.Bundle.ReferenceBundleIDs)
|
||||||
|
{
|
||||||
|
if (_resourceManager.CheckBundleDestroyed(bundleID) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -298,6 +298,14 @@ namespace YooAsset
|
|||||||
ProviderDic.Remove(provider.ProviderGUID);
|
ProviderDic.Remove(provider.ProviderGUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
internal bool CheckBundleDestroyed(int bundleID)
|
||||||
|
{
|
||||||
|
string bundleName = _bundleQuery.GetMainBundleName(bundleID);
|
||||||
|
var bundleFileLoader = TryGetBundleFileLoader(bundleName);
|
||||||
|
if (bundleFileLoader == null)
|
||||||
|
return true;
|
||||||
|
return bundleFileLoader.IsDestroyed;
|
||||||
|
}
|
||||||
internal bool HasAnyLoader()
|
internal bool HasAnyLoader()
|
||||||
{
|
{
|
||||||
return LoaderDic.Count > 0;
|
return LoaderDic.Count > 0;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
internal enum EBuildBundleType
|
public enum EBuildBundleType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 未知类型
|
/// 未知类型
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
BundleInfo[] GetDependBundleInfos(AssetInfo assetPath);
|
BundleInfo[] GetDependBundleInfos(AssetInfo assetPath);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取主资源包名称
|
||||||
|
/// </summary>
|
||||||
|
string GetMainBundleName(int bundleID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取主资源包名称
|
/// 获取主资源包名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace YooAsset
|
|||||||
buffer.WriteUTF8(manifest.FileVersion);
|
buffer.WriteUTF8(manifest.FileVersion);
|
||||||
|
|
||||||
// 写入文件头信息
|
// 写入文件头信息
|
||||||
|
buffer.WriteBool(manifest.LegacyDependency);
|
||||||
buffer.WriteBool(manifest.EnableAddressable);
|
buffer.WriteBool(manifest.EnableAddressable);
|
||||||
buffer.WriteBool(manifest.LocationToLower);
|
buffer.WriteBool(manifest.LocationToLower);
|
||||||
buffer.WriteBool(manifest.IncludeAssetGUID);
|
buffer.WriteBool(manifest.IncludeAssetGUID);
|
||||||
@@ -55,6 +56,7 @@ namespace YooAsset
|
|||||||
buffer.WriteUTF8(packageAsset.AssetGUID);
|
buffer.WriteUTF8(packageAsset.AssetGUID);
|
||||||
buffer.WriteUTF8Array(packageAsset.AssetTags);
|
buffer.WriteUTF8Array(packageAsset.AssetTags);
|
||||||
buffer.WriteInt32(packageAsset.BundleID);
|
buffer.WriteInt32(packageAsset.BundleID);
|
||||||
|
buffer.WriteInt32Array(packageAsset.DependBundleIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写入资源包列表
|
// 写入资源包列表
|
||||||
@@ -70,6 +72,7 @@ namespace YooAsset
|
|||||||
buffer.WriteBool(packageBundle.Encrypted);
|
buffer.WriteBool(packageBundle.Encrypted);
|
||||||
buffer.WriteUTF8Array(packageBundle.Tags);
|
buffer.WriteUTF8Array(packageBundle.Tags);
|
||||||
buffer.WriteInt32Array(packageBundle.DependIDs);
|
buffer.WriteInt32Array(packageBundle.DependIDs);
|
||||||
|
buffer.WriteInt32Array(packageBundle.ReferenceBundleIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写入文件流
|
// 写入文件流
|
||||||
@@ -108,6 +111,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
// 读取文件头信息
|
// 读取文件头信息
|
||||||
manifest.FileVersion = fileVersion;
|
manifest.FileVersion = fileVersion;
|
||||||
|
manifest.LegacyDependency = buffer.ReadBool();
|
||||||
manifest.EnableAddressable = buffer.ReadBool();
|
manifest.EnableAddressable = buffer.ReadBool();
|
||||||
manifest.LocationToLower = buffer.ReadBool();
|
manifest.LocationToLower = buffer.ReadBool();
|
||||||
manifest.IncludeAssetGUID = buffer.ReadBool();
|
manifest.IncludeAssetGUID = buffer.ReadBool();
|
||||||
@@ -133,6 +137,7 @@ namespace YooAsset
|
|||||||
packageAsset.AssetGUID = buffer.ReadUTF8();
|
packageAsset.AssetGUID = buffer.ReadUTF8();
|
||||||
packageAsset.AssetTags = buffer.ReadUTF8Array();
|
packageAsset.AssetTags = buffer.ReadUTF8Array();
|
||||||
packageAsset.BundleID = buffer.ReadInt32();
|
packageAsset.BundleID = buffer.ReadInt32();
|
||||||
|
packageAsset.DependBundleIDs = buffer.ReadInt32Array();
|
||||||
FillAssetCollection(manifest, packageAsset);
|
FillAssetCollection(manifest, packageAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,6 +155,7 @@ namespace YooAsset
|
|||||||
packageBundle.Encrypted = buffer.ReadBool();
|
packageBundle.Encrypted = buffer.ReadBool();
|
||||||
packageBundle.Tags = buffer.ReadUTF8Array();
|
packageBundle.Tags = buffer.ReadUTF8Array();
|
||||||
packageBundle.DependIDs = buffer.ReadInt32Array();
|
packageBundle.DependIDs = buffer.ReadInt32Array();
|
||||||
|
packageBundle.ReferenceBundleIDs = buffer.ReadInt32Array();
|
||||||
FillBundleCollection(manifest, packageBundle);
|
FillBundleCollection(manifest, packageBundle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ namespace YooAsset
|
|||||||
// 读取文件头信息
|
// 读取文件头信息
|
||||||
Manifest = new PackageManifest();
|
Manifest = new PackageManifest();
|
||||||
Manifest.FileVersion = fileVersion;
|
Manifest.FileVersion = fileVersion;
|
||||||
|
Manifest.LegacyDependency = _buffer.ReadBool();
|
||||||
Manifest.EnableAddressable = _buffer.ReadBool();
|
Manifest.EnableAddressable = _buffer.ReadBool();
|
||||||
Manifest.LocationToLower = _buffer.ReadBool();
|
Manifest.LocationToLower = _buffer.ReadBool();
|
||||||
Manifest.IncludeAssetGUID = _buffer.ReadBool();
|
Manifest.IncludeAssetGUID = _buffer.ReadBool();
|
||||||
@@ -112,6 +113,7 @@ namespace YooAsset
|
|||||||
packageAsset.AssetGUID = _buffer.ReadUTF8();
|
packageAsset.AssetGUID = _buffer.ReadUTF8();
|
||||||
packageAsset.AssetTags = _buffer.ReadUTF8Array();
|
packageAsset.AssetTags = _buffer.ReadUTF8Array();
|
||||||
packageAsset.BundleID = _buffer.ReadInt32();
|
packageAsset.BundleID = _buffer.ReadInt32();
|
||||||
|
packageAsset.DependBundleIDs = _buffer.ReadInt32Array();
|
||||||
ManifestTools.FillAssetCollection(Manifest, packageAsset);
|
ManifestTools.FillAssetCollection(Manifest, packageAsset);
|
||||||
|
|
||||||
_packageAssetCount--;
|
_packageAssetCount--;
|
||||||
@@ -146,6 +148,7 @@ namespace YooAsset
|
|||||||
packageBundle.Encrypted = _buffer.ReadBool();
|
packageBundle.Encrypted = _buffer.ReadBool();
|
||||||
packageBundle.Tags = _buffer.ReadUTF8Array();
|
packageBundle.Tags = _buffer.ReadUTF8Array();
|
||||||
packageBundle.DependIDs = _buffer.ReadInt32Array();
|
packageBundle.DependIDs = _buffer.ReadInt32Array();
|
||||||
|
packageBundle.ReferenceBundleIDs = _buffer.ReadInt32Array();
|
||||||
ManifestTools.FillBundleCollection(Manifest, packageBundle);
|
ManifestTools.FillBundleCollection(Manifest, packageBundle);
|
||||||
|
|
||||||
_packageBundleCount--;
|
_packageBundleCount--;
|
||||||
|
|||||||
@@ -31,11 +31,18 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int BundleID;
|
public int BundleID;
|
||||||
|
|
||||||
|
#region YOOASSET_LEGACY_DEPENDENCY
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所属资源包名称(仅编辑器有效)
|
/// 依赖的资源包列表
|
||||||
|
/// </summary>
|
||||||
|
public int[] DependBundleIDs;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 临时数据对象(仅编辑器有效)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
public string BundleNameInEditor;
|
public object TempDataInEditor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否包含Tag
|
/// 是否包含Tag
|
||||||
|
|||||||
@@ -47,6 +47,14 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int[] DependIDs;
|
public int[] DependIDs;
|
||||||
|
|
||||||
|
#region YOOASSET_LEGACY_DEPENDENCY
|
||||||
|
/// <summary>
|
||||||
|
/// 引用该资源包的资源包列表
|
||||||
|
/// 说明:谁引用了该资源包
|
||||||
|
/// </summary>
|
||||||
|
public int[] ReferenceBundleIDs;
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源包GUID
|
/// 资源包GUID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -101,6 +109,12 @@ namespace YooAsset
|
|||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
public readonly List<PackageAsset> IncludeMainAssets = new List<PackageAsset>(10);
|
public readonly List<PackageAsset> IncludeMainAssets = new List<PackageAsset>(10);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 临时数据对象(仅编辑器有效)
|
||||||
|
/// </summary>
|
||||||
|
[NonSerialized]
|
||||||
|
public object TempDataInEditor;
|
||||||
|
|
||||||
|
|
||||||
public PackageBundle()
|
public PackageBundle()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string FileVersion;
|
public string FileVersion;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 怀旧版依赖模式
|
||||||
|
/// </summary>
|
||||||
|
public bool LegacyDependency;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启用可寻址资源定位
|
/// 启用可寻址资源定位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -155,16 +160,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (AssetDic.TryGetValue(assetPath, out PackageAsset packageAsset))
|
if (AssetDic.TryGetValue(assetPath, out PackageAsset packageAsset))
|
||||||
{
|
{
|
||||||
int bundleID = packageAsset.BundleID;
|
return GetMainPackageBundle(packageAsset.BundleID);
|
||||||
if (bundleID >= 0 && bundleID < BundleList.Count)
|
|
||||||
{
|
|
||||||
var packageBundle = BundleList[bundleID];
|
|
||||||
return packageBundle;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception($"Invalid bundle id : {bundleID} Asset path : {assetPath}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -172,27 +168,58 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取主资源包
|
||||||
|
/// 注意:传入的资源包ID一定合法有效!
|
||||||
|
/// </summary>
|
||||||
|
public PackageBundle GetMainPackageBundle(int bundleID)
|
||||||
|
{
|
||||||
|
if (bundleID >= 0 && bundleID < BundleList.Count)
|
||||||
|
{
|
||||||
|
var packageBundle = BundleList[bundleID];
|
||||||
|
return packageBundle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"Invalid bundle id : {bundleID}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源依赖列表
|
/// 获取资源依赖列表
|
||||||
/// 注意:传入的资源路径一定合法有效!
|
/// 注意:传入的资源路径一定合法有效!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PackageBundle[] GetAllDependencies(string assetPath)
|
public PackageBundle[] GetAllDependencies(string assetPath)
|
||||||
{
|
{
|
||||||
var packageBundle = GetMainPackageBundle(assetPath);
|
// YOOASSET_LEGACY_DEPENDENCY
|
||||||
List<PackageBundle> result = new List<PackageBundle>(packageBundle.DependIDs.Length);
|
if (LegacyDependency)
|
||||||
foreach (var dependID in packageBundle.DependIDs)
|
|
||||||
{
|
{
|
||||||
if (dependID >= 0 && dependID < BundleList.Count)
|
if (TryGetPackageAsset(assetPath, out PackageAsset packageAsset))
|
||||||
{
|
{
|
||||||
var dependBundle = BundleList[dependID];
|
List<PackageBundle> result = new List<PackageBundle>(packageAsset.DependBundleIDs.Length);
|
||||||
result.Add(dependBundle);
|
foreach (var dependID in packageAsset.DependBundleIDs)
|
||||||
|
{
|
||||||
|
var dependBundle = GetMainPackageBundle(dependID);
|
||||||
|
result.Add(dependBundle);
|
||||||
|
}
|
||||||
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception($"Invalid bundle id : {dependID} Asset path : {assetPath}");
|
throw new Exception("Should never get here !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result.ToArray();
|
else
|
||||||
|
{
|
||||||
|
var packageBundle = GetMainPackageBundle(assetPath);
|
||||||
|
List<PackageBundle> result = new List<PackageBundle>(packageBundle.DependIDs.Length);
|
||||||
|
foreach (var dependID in packageBundle.DependIDs)
|
||||||
|
{
|
||||||
|
var dependBundle = GetMainPackageBundle(dependID);
|
||||||
|
result.Add(dependBundle);
|
||||||
|
}
|
||||||
|
return result.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||||
|
{
|
||||||
|
// 注意:如果清单里未找到资源包会抛出异常!
|
||||||
|
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||||
|
return packageBundle.BundleName;
|
||||||
|
}
|
||||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||||
{
|
{
|
||||||
if (assetInfo.IsInvalid)
|
if (assetInfo.IsInvalid)
|
||||||
|
|||||||
@@ -144,6 +144,12 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||||
|
{
|
||||||
|
// 注意:如果清单里未找到资源包会抛出异常!
|
||||||
|
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||||
|
return packageBundle.BundleName;
|
||||||
|
}
|
||||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||||
{
|
{
|
||||||
if (assetInfo.IsInvalid)
|
if (assetInfo.IsInvalid)
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||||
|
{
|
||||||
|
// 注意:如果清单里未找到资源包会抛出异常!
|
||||||
|
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||||
|
return packageBundle.BundleName;
|
||||||
|
}
|
||||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||||
{
|
{
|
||||||
if (assetInfo.IsInvalid)
|
if (assetInfo.IsInvalid)
|
||||||
|
|||||||
@@ -163,6 +163,12 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
string IBundleQuery.GetMainBundleName(int bundleID)
|
||||||
|
{
|
||||||
|
// 注意:如果清单里未找到资源包会抛出异常!
|
||||||
|
var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
|
||||||
|
return packageBundle.BundleName;
|
||||||
|
}
|
||||||
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
string IBundleQuery.GetMainBundleName(AssetInfo assetInfo)
|
||||||
{
|
{
|
||||||
if (assetInfo.IsInvalid)
|
if (assetInfo.IsInvalid)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清单文件格式版本
|
/// 清单文件格式版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ManifestFileVersion = "2.2.5";
|
public const string ManifestFileVersion = "2.3.0";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -222,6 +222,15 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
OperationSystem.MaxTimeSlice = milliseconds;
|
OperationSystem.MaxTimeSlice = milliseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置异步系统参数,快速启动模式的开关
|
||||||
|
/// 注意:该模式默认开启
|
||||||
|
/// </summary>
|
||||||
|
public static void SetOperationSystemQuickStartMode(bool state)
|
||||||
|
{
|
||||||
|
OperationSystem.QuickStartMode = state;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 调试信息
|
#region 调试信息
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 879f2b393f883554899ab3345f0dc998
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
#if UNITY_WEBGL && DOUYINMINIGAME
|
||||||
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using TTSDK;
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
internal class TTAssetBundleResult : BundleResult
|
||||||
|
{
|
||||||
|
private readonly IFileSystem _fileSystem;
|
||||||
|
private readonly PackageBundle _packageBundle;
|
||||||
|
private readonly AssetBundle _assetBundle;
|
||||||
|
|
||||||
|
public TTAssetBundleResult(IFileSystem fileSystem, PackageBundle packageBundle, AssetBundle assetBundle)
|
||||||
|
{
|
||||||
|
_fileSystem = fileSystem;
|
||||||
|
_packageBundle = packageBundle;
|
||||||
|
_assetBundle = assetBundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UnloadBundleFile()
|
||||||
|
{
|
||||||
|
if (_assetBundle != null)
|
||||||
|
{
|
||||||
|
_assetBundle.TTUnload(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override string GetBundleFilePath()
|
||||||
|
{
|
||||||
|
return _fileSystem.GetBundleFilePath(_packageBundle);
|
||||||
|
}
|
||||||
|
public override byte[] ReadBundleFileData()
|
||||||
|
{
|
||||||
|
return _fileSystem.ReadBundleFileData(_packageBundle);
|
||||||
|
}
|
||||||
|
public override string ReadBundleFileText()
|
||||||
|
{
|
||||||
|
return _fileSystem.ReadBundleFileText(_packageBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
|
||||||
|
{
|
||||||
|
var operation = new AssetBundleLoadAssetOperation(_packageBundle, _assetBundle, assetInfo);
|
||||||
|
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
|
||||||
|
{
|
||||||
|
var operation = new AssetBundleLoadAllAssetsOperation(_packageBundle, _assetBundle, assetInfo);
|
||||||
|
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
|
||||||
|
{
|
||||||
|
var operation = new AssetBundleLoadSubAssetsOperation(_packageBundle, _assetBundle, assetInfo);
|
||||||
|
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
|
||||||
|
{
|
||||||
|
var operation = new AssetBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad);
|
||||||
|
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 80ce0631d38cf74458c902fb325afb81
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -69,7 +69,7 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Result = new AssetBundleResult(_fileSystem, _bundle, assetBundle, null);
|
Result = new TTAssetBundleResult(_fileSystem, _bundle, assetBundle);
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System;
|
|||||||
|
|
||||||
public static class TiktokFileSystemCreater
|
public static class TiktokFileSystemCreater
|
||||||
{
|
{
|
||||||
public static FileSystemParameters CreateByteGameFileSystemParameters(string packageRoot, IRemoteServices remoteServices)
|
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices)
|
||||||
{
|
{
|
||||||
string fileSystemClass = $"{nameof(TiktokFileSystem)},YooAsset.RuntimeExtension";
|
string fileSystemClass = $"{nameof(TiktokFileSystem)},YooAsset.RuntimeExtension";
|
||||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
||||||
@@ -16,7 +16,7 @@ public static class TiktokFileSystemCreater
|
|||||||
return fileSystemParams;
|
return fileSystemParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileSystemParameters CreateByteGameFileSystemParameters(string packageRoot, IRemoteServices remoteServices, IWebDecryptionServices decryptionServices)
|
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices, IWebDecryptionServices decryptionServices)
|
||||||
{
|
{
|
||||||
string fileSystemClass = $"{nameof(TiktokFileSystem)},YooAsset.RuntimeExtension";
|
string fileSystemClass = $"{nameof(TiktokFileSystem)},YooAsset.RuntimeExtension";
|
||||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
||||||
@@ -268,19 +268,6 @@ internal class TiktokFileSystem : IFileSystem
|
|||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载加密资源文件
|
|
||||||
/// </summary>
|
|
||||||
public AssetBundle LoadEncryptedAssetBundle(PackageBundle bundle, byte[] fileData)
|
|
||||||
{
|
|
||||||
WebDecryptFileInfo fileInfo = new WebDecryptFileInfo();
|
|
||||||
fileInfo.BundleName = bundle.BundleName;
|
|
||||||
fileInfo.FileLoadCRC = bundle.UnityCRC;
|
|
||||||
fileInfo.FileData = fileData;
|
|
||||||
var decryptResult = DecryptionServices.LoadAssetBundle(fileInfo);
|
|
||||||
return decryptResult.Result;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -67,7 +67,7 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Result = new AssetBundleResult(_fileSystem, _bundle, assetBundle, null);
|
Result = new WXAssetBundleResult(_fileSystem, _bundle, assetBundle);
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ using WeChatWASM;
|
|||||||
|
|
||||||
public static class WechatFileSystemCreater
|
public static class WechatFileSystemCreater
|
||||||
{
|
{
|
||||||
public static FileSystemParameters CreateWechatFileSystemParameters(string packageRoot, IRemoteServices remoteServices)
|
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices)
|
||||||
{
|
{
|
||||||
string fileSystemClass = $"{nameof(WechatFileSystem)},YooAsset.RuntimeExtension";
|
string fileSystemClass = $"{nameof(WechatFileSystem)},YooAsset.RuntimeExtension";
|
||||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
||||||
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
|
||||||
return fileSystemParams;
|
return fileSystemParams;
|
||||||
}
|
}
|
||||||
public static FileSystemParameters CreateWechatFileSystemParameters(string packageRoot, IRemoteServices remoteServices, IWebDecryptionServices decryptionServices)
|
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices, IWebDecryptionServices decryptionServices)
|
||||||
{
|
{
|
||||||
string fileSystemClass = $"{nameof(WechatFileSystem)},YooAsset.RuntimeExtension";
|
string fileSystemClass = $"{nameof(WechatFileSystem)},YooAsset.RuntimeExtension";
|
||||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
|
||||||
@@ -286,19 +286,6 @@ internal class WechatFileSystem : IFileSystem
|
|||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载加密资源文件
|
|
||||||
/// </summary>
|
|
||||||
public AssetBundle LoadEncryptedAssetBundle(PackageBundle bundle, byte[] fileData)
|
|
||||||
{
|
|
||||||
WebDecryptFileInfo fileInfo = new WebDecryptFileInfo();
|
|
||||||
fileInfo.BundleName = bundle.BundleName;
|
|
||||||
fileInfo.FileLoadCRC = bundle.UnityCRC;
|
|
||||||
fileInfo.FileData = fileData;
|
|
||||||
var decryptResult = DecryptionServices.LoadAssetBundle(fileInfo);
|
|
||||||
return decryptResult.Result;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -21,6 +21,12 @@ public class TextureSchema : ScannerSchema
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int MaxHeight = 1024;
|
public int MaxHeight = 1024;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试列表
|
||||||
|
/// </summary>
|
||||||
|
public List<string> TestStringValues = new List<string>();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取用户指南信息
|
/// 获取用户指南信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -177,6 +183,14 @@ public class TextureSchema : ScannerSchema
|
|||||||
});
|
});
|
||||||
container.Add(maxHeightField);
|
container.Add(maxHeightField);
|
||||||
|
|
||||||
|
// 创建测试列表
|
||||||
|
#if UNITY_2021_3_OR_NEWER
|
||||||
|
ReorderableListView reorderableListView = new ReorderableListView();
|
||||||
|
reorderableListView.SourceData = TestStringValues;
|
||||||
|
reorderableListView.HeaderName = "测试列表";
|
||||||
|
container.Add(reorderableListView);
|
||||||
|
#endif
|
||||||
|
|
||||||
SchemaInspector inspector = new SchemaInspector(container);
|
SchemaInspector inspector = new SchemaInspector(container);
|
||||||
return inspector;
|
return inspector;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ internal class FsmInitializePackage : IStateNode
|
|||||||
string fallbackHostServer = GetHostServerURL();
|
string fallbackHostServer = GetHostServerURL();
|
||||||
string packageRoot = $"{WeChatWASM.WX.env.USER_DATA_PATH}/__GAME_FILE_CACHE"; //注意:如果有子目录,请修改此处!
|
string packageRoot = $"{WeChatWASM.WX.env.USER_DATA_PATH}/__GAME_FILE_CACHE"; //注意:如果有子目录,请修改此处!
|
||||||
IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
|
IRemoteServices remoteServices = new RemoteServices(defaultHostServer, fallbackHostServer);
|
||||||
createParameters.WebServerFileSystemParameters = WechatFileSystemCreater.CreateWechatFileSystemParameters(packageRoot, remoteServices);
|
createParameters.WebServerFileSystemParameters = WechatFileSystemCreater.CreateFileSystemParameters(packageRoot, remoteServices);
|
||||||
#else
|
#else
|
||||||
createParameters.WebServerFileSystemParameters = FileSystemParameters.CreateDefaultWebServerFileSystemParameters(new WebDecryption());
|
createParameters.WebServerFileSystemParameters = FileSystemParameters.CreateDefaultWebServerFileSystemParameters(new WebDecryption());
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ MonoBehaviour:
|
|||||||
Groups:
|
Groups:
|
||||||
- GroupName: battle
|
- GroupName: battle
|
||||||
GroupDesc: "\u6218\u6597"
|
GroupDesc: "\u6218\u6597"
|
||||||
AssetTags:
|
AssetTags: battle
|
||||||
ActiveRuleName: EnableGroup
|
ActiveRuleName: EnableGroup
|
||||||
Collectors:
|
Collectors:
|
||||||
- CollectPath: Assets/Samples/Space Shooter/GameRes/Effect
|
- CollectPath: Assets/Samples/Space Shooter/GameRes/Effect
|
||||||
@@ -92,7 +92,7 @@ MonoBehaviour:
|
|||||||
UserData:
|
UserData:
|
||||||
- GroupName: scene
|
- GroupName: scene
|
||||||
GroupDesc: "\u573A\u666F"
|
GroupDesc: "\u573A\u666F"
|
||||||
AssetTags:
|
AssetTags: scene
|
||||||
ActiveRuleName: EnableGroup
|
ActiveRuleName: EnableGroup
|
||||||
Collectors:
|
Collectors:
|
||||||
- CollectPath: Assets/Samples/Space Shooter/GameRes/Scene
|
- CollectPath: Assets/Samples/Space Shooter/GameRes/Scene
|
||||||
@@ -113,7 +113,7 @@ MonoBehaviour:
|
|||||||
UserData:
|
UserData:
|
||||||
- GroupName: ugui
|
- GroupName: ugui
|
||||||
GroupDesc: "\u9762\u677F"
|
GroupDesc: "\u9762\u677F"
|
||||||
AssetTags:
|
AssetTags: ui
|
||||||
ActiveRuleName: EnableGroup
|
ActiveRuleName: EnableGroup
|
||||||
Collectors:
|
Collectors:
|
||||||
- CollectPath: Assets/Samples/Space Shooter/GameRes/UIPanel
|
- CollectPath: Assets/Samples/Space Shooter/GameRes/UIPanel
|
||||||
|
|||||||
@@ -14,3 +14,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
MaxWidth: 1024
|
MaxWidth: 1024
|
||||||
MaxHeight: 1024
|
MaxHeight: 1024
|
||||||
|
TestStringValues:
|
||||||
|
- test1
|
||||||
|
- test2
|
||||||
|
- test3
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.tuyoogame.yooasset",
|
"name": "com.tuyoogame.yooasset",
|
||||||
"displayName": "YooAsset",
|
"displayName": "YooAsset",
|
||||||
"version": "2.2.12",
|
"version": "2.3.0-preview",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"description": "unity3d resources management system.",
|
"description": "unity3d resources management system.",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
Reference in New Issue
Block a user