Пример #1
0
        internal override void DrawMember()
        {
            if (m_fieldType.IsDefined(CustomDrawerType, true))
            {
                if (m_classDrawer == null)
                {
                    m_classDrawer          = InspectorDrawer.Create(m_fieldInfo.GetValue(DeclaringObject), SerializedProperty.Copy(), false);
                    m_classDrawerAccordion = new SimpleAccordion(DisplayName, () =>
                    {
                        m_classDrawer.OnEnable();
                        m_classDrawer.OnInspectorGUI();
                    });
                    m_classDrawerAccordion.IsExpanded = SerializedProperty.isExpanded;
                    m_classDrawerAccordion.expandStateChangeCallback = acc => SerializedProperty.isExpanded = acc.IsExpanded;

                    m_classDrawerAccordion.drawHeaderCallback = () => SimpleAccordion.DrawDefaultAccordionHeader(m_classDrawerAccordion, FA.code, 14, 8);
                }

                DrawMember(m_classDrawerAccordion.OnGUI);
                return;
            }

            if (IsListOrArray(m_fieldType))
            {
                if (m_reordableAttribute != null)
                {
                    if (m_reorderableList == null)
                    {
                        m_reorderableList = CreateReordableList(SerializedProperty.serializedObject, SerializedProperty);
                    }
                    DrawMember(m_reorderableList.DoLayoutList);
                }
                else
                {
                    DrawMember(DrawCollection);
                }
            }
            else
            {
                DrawMember(DrawPropertyField);
            }
        }
        public virtual void OnEnable()
        {
            targetType = target.GetType();
            shouldOverrideInspector = targetType.IsDefined(typeof(OverrideInspectorAttribute), true);
            if (!shouldOverrideInspector)
            {
                return;
            }

            shouldBeDrawed = !DontDrawInspectorIfAttribute.TryFindInvalidAttribute(target, out dontDrawAttribute);
            if (!shouldBeDrawed)
            {
                return;
            }

            inspectorDrawer = InspectorDrawer.Create(target, serializedObject.GetIterator());
            inspectorDrawer.OnEnable();

            EditorApplication.update += Repaint;
        }