mirror of https://github.com/tuyoogame/YooAsset
parent
d133a9a692
commit
b654ac156d
|
@ -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,19 @@ 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;
|
_scannerListView.reorderable = true;
|
||||||
|
_scannerListView.itemsSource = AssetArtScannerSettingData.Setting.Scanners;
|
||||||
|
_scannerListView.Rebuild();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_scannerListView.reorderable = false;
|
||||||
|
_scannerListView.itemsSource = filterItems;
|
||||||
|
_scannerListView.Rebuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private List<AssetArtScanner> FilterScanners()
|
private List<AssetArtScanner> FilterScanners()
|
||||||
|
@ -344,31 +350,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 +503,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" />
|
||||||
|
|
Loading…
Reference in New Issue