34 lines
831 B
C#
34 lines
831 B
C#
using KitsuneCafe.System;
|
|
using UnityEditor;
|
|
using UnityEditor.UIElements;
|
|
using UnityEngine.UIElements;
|
|
|
|
[CustomPropertyDrawer(typeof(SerializableDuration))]
|
|
public class DurationPropertyDrawer : PropertyDrawer
|
|
{
|
|
public override VisualElement CreatePropertyGUI(SerializedProperty property)
|
|
{
|
|
var container = new VisualElement();
|
|
container.style.flexDirection = FlexDirection.Row;
|
|
|
|
var duration = new PropertyField(
|
|
property.FindPropertyRelative("duration"),
|
|
ObjectNames.NicifyVariableName(property.name)
|
|
);
|
|
|
|
duration.style.flexGrow = 1;
|
|
|
|
var unit = new EnumField
|
|
{
|
|
bindingPath = "unit"
|
|
};
|
|
|
|
unit.style.flexGrow = 0;
|
|
|
|
container.Add(duration);
|
|
container.Add(unit);
|
|
|
|
return container;
|
|
}
|
|
}
|
|
|