mirror of
https://github.com/AnnulusGames/Alchemy.git
synced 2025-01-22 00:08:53 -05:00
Merge pull request #68 from yuyu0127/support-list-view-label-modification
Add: Support list view label modification
This commit is contained in:
commit
3ca300ff34
@ -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,7 +102,10 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1085,6 +1085,12 @@ MonoBehaviour:
|
|||||||
foo: 0
|
foo: 0
|
||||||
bar: {x: 0, y: 0, z: 0}
|
bar: {x: 0, y: 0, z: 0}
|
||||||
baz: {fileID: 0}
|
baz: {fileID: 0}
|
||||||
|
fooList:
|
||||||
|
- 0
|
||||||
|
barList:
|
||||||
|
- {x: 0, y: 0, z: 0}
|
||||||
|
bazList:
|
||||||
|
- {fileID: 0}
|
||||||
--- !u!1 &801201066
|
--- !u!1 &801201066
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Alchemy.Inspector;
|
using Alchemy.Inspector;
|
||||||
|
|
||||||
@ -8,5 +9,9 @@ namespace Alchemy.Samples
|
|||||||
[LabelText("FOO!")] public float foo;
|
[LabelText("FOO!")] public float foo;
|
||||||
[LabelText("BAR!")] public Vector3 bar;
|
[LabelText("BAR!")] public Vector3 bar;
|
||||||
[LabelText("BAZ!")] public GameObject baz;
|
[LabelText("BAZ!")] public GameObject baz;
|
||||||
|
|
||||||
|
[LabelText("FOO LIST!")] public List<float> fooList;
|
||||||
|
[LabelText("BAR LIST!")] public List<Vector3> barList;
|
||||||
|
[LabelText("BAZ LIST!")] public List<GameObject> bazList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user