Add: Support list view label modification

This commit is contained in:
yuyu0127 2024-03-17 00:24:11 +09:00
parent bcaeef5ea9
commit c1e345b85f
2 changed files with 13 additions and 1 deletions

View File

@ -82,6 +82,7 @@ namespace Alchemy.Editor.Elements
PropertyField propertyField => propertyField.label, PropertyField propertyField => propertyField.label,
SerializeReferenceField serializeReferenceField => serializeReferenceField.foldout.text, SerializeReferenceField serializeReferenceField => serializeReferenceField.foldout.text,
InlineEditorObjectField inlineEditorObjectField => inlineEditorObjectField.Label, InlineEditorObjectField inlineEditorObjectField => inlineEditorObjectField.Label,
PropertyListView propertyListView => propertyListView.Label,
_ => null, _ => null,
}; };
} }
@ -101,6 +102,9 @@ namespace Alchemy.Editor.Elements
case InlineEditorObjectField inlineEditorObjectField: case InlineEditorObjectField inlineEditorObjectField:
inlineEditorObjectField.Label = value; inlineEditorObjectField.Label = value;
break; break;
case PropertyListView propertyListView:
propertyListView.Label = value;
break;
}; };
} }
} }

View File

@ -19,7 +19,7 @@ namespace Alchemy.Editor.Elements
var parentObj = property.GetDeclaredObject(); var parentObj = property.GetDeclaredObject();
var events = property.GetAttribute<OnListViewChangedAttribute>(true); var events = property.GetAttribute<OnListViewChangedAttribute>(true);
var listView = GUIHelper.CreateListViewFromFieldInfo(parentObj, property.GetFieldInfo()); listView = GUIHelper.CreateListViewFromFieldInfo(parentObj, property.GetFieldInfo());
listView.headerTitle = ObjectNames.NicifyVariableName(property.displayName); listView.headerTitle = ObjectNames.NicifyVariableName(property.displayName);
listView.bindItem = (element, index) => listView.bindItem = (element, index) =>
{ {
@ -48,5 +48,13 @@ namespace Alchemy.Editor.Elements
listView.BindProperty(property); listView.BindProperty(property);
Add(listView); Add(listView);
} }
readonly ListView listView;
public string Label
{
get => listView.headerTitle;
set => listView.headerTitle = value;
}
} }
} }