ScriptCore: Added LabelAttribute

This commit is contained in:
Simon Lübeß
2024-02-17 23:06:55 +01:00
parent 3c0302b06c
commit a07ea3276c
2 changed files with 38 additions and 1 deletions
+12 -1
View File
@@ -852,7 +852,18 @@ internal class EntityEditor
IEnumerable<Attribute> attributes = field.GetCustomAttributes();
string prettyName = field.Name.ToPrettyName();
LabelAttribute? label = GetAttribute<LabelAttribute>(attributes);
string prettyName;
if (label != null)
{
prettyName = label.Label ?? field.Name;
}
else
{
prettyName = field.Name.ToPrettyName();
}
object? newValue = ShowFieldEditor(value, value?.GetType() ?? field.FieldType, prettyName, attributes);