示例#1
0
            public static bool Execute(object container, InspectorVisitor <T> visitor, IProperty property, PropertyPath path,
                                       string propertyName, InspectorVisitLevel visitLevel)
            {
                var action = new GetCustomInspectorCallback(visitor, property, path, propertyName, visitLevel);

                PropertyBagResolver.Resolve(container.GetType()).Cast(ref action);
                return(action.Visited);
            }
示例#2
0
 private bool TryGetInspector <TValue>(
     ref TValue value,
     IProperty property,
     PropertyPath path,
     string name,
     InspectorVisitLevel visitLevel)
 => GetCustomInspectorCallback.Execute(value, this, property, path, name, visitLevel) ||
 TryGetInspector <TValue>(this, property, path, name, visitLevel);
示例#3
0
 bool TryGetDrawer <TValue>(
     ref TValue value,
     IProperty property,
     PropertyPath path,
     string name,
     InspectorVisitLevel visitLevel)
 => GetPropertyDrawerCallback.Execute(value, Visitor, property, path, name, visitLevel) ||
 TryGetDrawer <TValue>(Visitor, property, path, name, visitLevel);
示例#4
0
 GetCustomInspectorCallback(InspectorVisitor <T> visitor, IProperty property, PropertyPath propertyPath, string propertyName,
                            InspectorVisitLevel visitLevel)
 {
     m_Visitor      = visitor;
     Visited        = false;
     m_PropertyPath = propertyPath;
     m_PropertyName = propertyName;
     m_VisitLevel   = visitLevel;
     m_Property     = property;
 }
示例#5
0
        // TODO: Cache the result of ObjectNames.NicifyVariableName

        internal InspectorContext(PropertyElement propertyElement, IProperty property, PropertyPath propertyPath, string name, InspectorVisitLevel visitLevel)
        {
            m_PropertyElement = propertyElement;
            m_PropertyPath    = propertyPath;
            Name       = name;
            VisitLevel = visitLevel;
            m_Property = property;
            Attributes = m_Property.Attributes ?? Empty;
            Tooltip    = Attributes.GetAttribute <TooltipAttribute>()?.tooltip;
            PrettyName = Attributes.GetAttribute <InspectorNameAttribute>()?.displayName ??
                         (!string.IsNullOrEmpty(Name) ? ObjectNames.NicifyVariableName(Name) : Name);
            IsDelayed = Attributes.HasAttribute <DelayedAttribute>();
        }
示例#6
0
        private static bool TryGetInspector <TValue>(
            InspectorVisitor <T> visitor,
            IProperty property,
            PropertyPath propertyPath,
            string propertyName,
            InspectorVisitLevel visitLevel)
        {
            var inspector = CustomInspectorDatabase.GetInspector <TValue>(property);

            if (null == inspector)
            {
                return(false);
            }
            var proxy           = new InspectorContext <TValue>(visitor.VisitorContext.Binding, property, propertyPath, propertyName, visitLevel);
            var customInspector = new CustomInspectorElement <TValue>(inspector, proxy);

            visitor.VisitorContext.Parent.contentContainer.Add(customInspector);
            inspector.Update(proxy);
            return(true);
        }