From c1e345b85f2b77106584c57ea0bb7161b0f86a12 Mon Sep 17 00:00:00 2001 From: yuyu0127 Date: Sun, 17 Mar 2024 00:24:11 +0900 Subject: [PATCH] Add: Support list view label modification --- .../Alchemy/Editor/Elements/AlchemyPropertyField.cs | 4 ++++ .../Assets/Alchemy/Editor/Elements/PropertyListView.cs | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Alchemy/Assets/Alchemy/Editor/Elements/AlchemyPropertyField.cs b/Alchemy/Assets/Alchemy/Editor/Elements/AlchemyPropertyField.cs index e03bf84..6fd78ae 100644 --- a/Alchemy/Assets/Alchemy/Editor/Elements/AlchemyPropertyField.cs +++ b/Alchemy/Assets/Alchemy/Editor/Elements/AlchemyPropertyField.cs @@ -82,6 +82,7 @@ namespace Alchemy.Editor.Elements PropertyField propertyField => propertyField.label, SerializeReferenceField serializeReferenceField => serializeReferenceField.foldout.text, InlineEditorObjectField inlineEditorObjectField => inlineEditorObjectField.Label, + PropertyListView propertyListView => propertyListView.Label, _ => null, }; } @@ -101,6 +102,9 @@ namespace Alchemy.Editor.Elements case InlineEditorObjectField inlineEditorObjectField: inlineEditorObjectField.Label = value; break; + case PropertyListView propertyListView: + propertyListView.Label = value; + break; }; } } diff --git a/Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs b/Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs index b7298c8..2373478 100644 --- a/Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs +++ b/Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs @@ -19,7 +19,7 @@ namespace Alchemy.Editor.Elements var parentObj = property.GetDeclaredObject(); var events = property.GetAttribute(true); - var listView = GUIHelper.CreateListViewFromFieldInfo(parentObj, property.GetFieldInfo()); + listView = GUIHelper.CreateListViewFromFieldInfo(parentObj, property.GetFieldInfo()); listView.headerTitle = ObjectNames.NicifyVariableName(property.displayName); listView.bindItem = (element, index) => { @@ -48,5 +48,13 @@ namespace Alchemy.Editor.Elements listView.BindProperty(property); Add(listView); } + + readonly ListView listView; + + public string Label + { + get => listView.headerTitle; + set => listView.headerTitle = value; + } } } \ No newline at end of file