public static Foldout Foldout <TProperty, TContainer, TValue>(TProperty property, ref TContainer container, ref TValue value, InspectorContext context, string name = null) where TProperty : IProperty <TContainer, TValue> { var hasTooltip = property.Attributes?.HasAttribute <TooltipAttribute>() ?? false; var propertyName = property.GetName(); var foldout = new Foldout { name = propertyName, text = name ?? propertyName, bindingPath = propertyName, tooltip = hasTooltip ? property.Attributes.GetAttribute <TooltipAttribute>().Tooltip : string.Empty, }; GuiConstructFactory.SetTooltip(property, foldout); if (!context.GetParent(out var parent)) { return(foldout); } if (property.IsContainer) { parent.Add(foldout); context.PushParent(foldout); } return(foldout); }
public static TElement Construct <TProperty, TElement, TFieldType, TContainer, TValue>( TProperty property, ref TContainer container, ref TValue value, InspectorContext context ) where TProperty : IProperty <TContainer, TValue> where TElement : BaseField <TFieldType>, new() where TValue : struct { var element = ConstructBase <TProperty, TContainer, TElement, TFieldType, TValue>(property); if (TranslatorFactory <TValue> .TryGetUpdater(element, out var t)) { var offset = context.GetOffsetOfField(property.GetName()); var index = context.GetCurrentIndex(); var setter = context.DataProvider; t.SetUpdaters(element, setter, offset, index); } else { UnityEngine.Debug.Log($"No data translator registered between {typeof(TValue).Name} and {typeof(TFieldType).Name}"); } if (context.GetParent(out var parent)) { parent.contentContainer.Add(element); } if (property.IsContainer) { context.PushParent(element); } return(element); }
public static Label Label <TProperty, TContainer, TValue>(TProperty property, ref TContainer container, ref TValue value, InspectorContext context) where TProperty : IProperty <TContainer, TValue> { var name = property.GetName(); var label = new Label { text = name }; if (context.GetParent(out var parent)) { parent.Add(label); } if (property.IsContainer) { context.PushParent(label); } return(label); }