using JetBrains.Annotations; using UnityEngine; namespace TriInspector { public abstract class TriValueDrawer : TriCustomDrawer { } public abstract class TriValueDrawer : TriValueDrawer { public sealed override TriElement CreateElementInternal(TriProperty property, TriElement next) { return CreateElement(new TriValue(property), next); } [PublicAPI] public virtual TriElement CreateElement(TriValue propertyValue, TriElement next) { return new DefaultValueDrawerElement(this, propertyValue, next); } [PublicAPI] public virtual float GetHeight(float width, TriValue propertyValue, TriElement next) { return next.GetHeight(width); } [PublicAPI] public virtual void OnGUI(Rect position, TriValue propertyValue, TriElement next) { next.OnGUI(position); } internal class DefaultValueDrawerElement : TriElement { private readonly TriValueDrawer _drawer; private readonly TriElement _next; private readonly TriValue _propertyValue; public DefaultValueDrawerElement(TriValueDrawer drawer, TriValue propertyValue, TriElement next) { _drawer = drawer; _propertyValue = propertyValue; _next = next; AddChild(next); } public override float GetHeight(float width) { return _drawer.GetHeight(width, _propertyValue, _next); } public override void OnGUI(Rect position) { _drawer.OnGUI(position, _propertyValue, _next); } } } }