Compare commits

...

4 Commits

Author SHA1 Message Date
何冠峰 698cdcba61 update AssetArtScanner 2025-02-17 18:18:07 +08:00
何冠峰 1d6c9393d4 Update AssetBundleCollector
支持列表元素上下拖拽排序
2025-02-17 17:54:46 +08:00
何冠峰 b654ac156d update AssetArtScanner
支持列表元素上下拖拽排序
2025-02-17 17:54:34 +08:00
何冠峰 d133a9a692 update extension sample 2025-02-17 15:44:41 +08:00
5 changed files with 51 additions and 59 deletions

View File

@ -69,7 +69,6 @@ namespace YooAsset.Editor
_scannerListView = root.Q<ListView>("ScannerListView");
_scannerListView.makeItem = MakeScannerListViewItem;
_scannerListView.bindItem = BindScannerListViewItem;
#if UNITY_2022_3_OR_NEWER
_scannerListView.selectionChanged += ScannerListView_onSelectionChange;
#elif UNITY_2020_1_OR_NEWER
@ -277,12 +276,23 @@ namespace YooAsset.Editor
{
_scannerListView.Clear();
_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()
@ -344,31 +354,7 @@ namespace YooAsset.Editor
// 显示检视面板
var scanSchema = selectScanner.LoadSchema();
if (scanSchema != null)
{
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);
}
}
}
RefreshInspector(scanSchema);
// 设置Schema对象
if (scanSchema == null)
@ -521,6 +507,38 @@ namespace YooAsset.Editor
AssetArtScannerSettingData.RemoveCollector(selectSacnner, selectCollector);
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

View File

@ -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: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;" />
<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:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />

View File

@ -28,7 +28,7 @@
<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: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:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<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: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: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:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />

View File

@ -268,19 +268,6 @@ internal class TiktokFileSystem : IFileSystem
}
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
}
#endif

View File

@ -286,19 +286,6 @@ internal class WechatFileSystem : IFileSystem
}
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
}
#endif