mirror of https://github.com/tuyoogame/YooAsset
update asset art scanner
parent
9bcfb04f91
commit
d5b8c90c94
|
@ -22,6 +22,7 @@ namespace YooAsset.Editor
|
|||
private ListView _scannerListView;
|
||||
private ToolbarSearchField _scannerSearchField;
|
||||
private VisualElement _scannerContentContainer;
|
||||
private VisualElement _inspectorContainer;
|
||||
private Label _schemaGuideTxt;
|
||||
private TextField _scannerNameTxt;
|
||||
private TextField _scannerDescTxt;
|
||||
|
@ -93,6 +94,9 @@ namespace YooAsset.Editor
|
|||
// 扫描器容器
|
||||
_scannerContentContainer = root.Q("ScannerContentContainer");
|
||||
|
||||
// 检视界面容器
|
||||
_inspectorContainer = root.Q("InspectorContainer");
|
||||
|
||||
// 扫描器指南
|
||||
_schemaGuideTxt = root.Q<Label>("SchemaUserGuide");
|
||||
|
||||
|
@ -331,19 +335,44 @@ namespace YooAsset.Editor
|
|||
_scannerNameTxt.SetValueWithoutNotify(selectScanner.ScannerName);
|
||||
_scannerDescTxt.SetValueWithoutNotify(selectScanner.ScannerDesc);
|
||||
|
||||
// 显示Schema对象
|
||||
// 显示检视面板
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置Schema对象
|
||||
if (scanSchema == null)
|
||||
{
|
||||
_scannerSchemaField.SetValueWithoutNotify(null);
|
||||
_schemaGuideTxt.text = string.Empty;
|
||||
Selection.activeObject = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_scannerSchemaField.SetValueWithoutNotify(scanSchema);
|
||||
_schemaGuideTxt.text = scanSchema.GetUserGuide();
|
||||
Selection.activeObject = scanSchema;
|
||||
}
|
||||
|
||||
// 显示存储目录
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ScannerContentContainer" style="flex-grow: 1; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
||||
<ui:VisualElement name="ScannerContentContainer" style="flex-grow: 1; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; min-width: 400px;">
|
||||
<ui:Label text="扫描器" display-tooltip-when-elided="true" name="ScannerContentTitle" style="-unity-text-align: upper-center; -unity-font-style: bold; font-size: 12px; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; background-color: rgb(89, 89, 89);" />
|
||||
<ui:Label display-tooltip-when-elided="true" name="SchemaUserGuide" style="-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; height: 40px;" />
|
||||
<ui:TextField picking-mode="Ignore" label="Scanner Name" name="ScannerName" />
|
||||
|
@ -30,5 +30,6 @@
|
|||
</ui:VisualElement>
|
||||
<ui:ScrollView name="CollectorScrollView" style="flex-grow: 1;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="InspectorContainer" style="flex-grow: 1; border-top-width: 5px; border-right-width: 5px; border-bottom-width: 5px; border-left-width: 5px; background-color: rgb(67, 67, 67);" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
|
|
@ -20,5 +20,13 @@ namespace YooAsset.Editor
|
|||
/// 修复扫描结果
|
||||
/// </summary>
|
||||
public abstract void FixResult(List<ReportElement> fixList);
|
||||
|
||||
/// <summary>
|
||||
/// 创建检视面板
|
||||
/// </summary>
|
||||
public virtual SchemaInspector CreateInspector()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public class SchemaInspector
|
||||
{
|
||||
/// <summary>
|
||||
/// 检视界面的UI元素容器(UIElements元素)
|
||||
/// </summary>
|
||||
public object Containner;
|
||||
|
||||
/// <summary>
|
||||
/// 检视界面宽度
|
||||
/// </summary>
|
||||
public int Width = 250;
|
||||
|
||||
/// <summary>
|
||||
/// 检视界面最小宽度
|
||||
/// </summary>
|
||||
public int MinWidth = 250;
|
||||
|
||||
/// <summary>
|
||||
/// 检视界面最大宽度
|
||||
/// </summary>
|
||||
public int MaxWidth = 250;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3440549fcb36bbf4c8c6da17fb858947
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue