public override void BeginDrawHeader(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
 {
     if (PositionByMember(mightyMember, attribute).Contains(DecoratorPosition.BeforeHeader))
     {
         DrawSpace();
     }
 }
Exemple #2
0
        public override void EndDraw(BaseMightyMember mightyMember, BaseElementDecoratorAttribute baseAttribute,
                                     Action <BaseMightyMember, SerializedProperty, BaseDrawerAttribute> propertyDrawCallback,
                                     BaseDrawerAttribute drawerAttribute = null)
        {
            var property = mightyMember.Property;

            if (!property.isArray)
            {
                EndDraw(mightyMember, baseAttribute);
                return;
            }

            if (!property.isExpanded)
            {
                return;
            }

            EditorDrawUtility.DrawArrayBody(property, index =>
            {
                BeginDrawElement(mightyMember, index, baseAttribute);
                propertyDrawCallback?.Invoke(mightyMember, property.GetArrayElementAtIndex(index), drawerAttribute);
                EndDrawElement(mightyMember, index, baseAttribute);
            });

            EditorGUI.indentLevel--;

            EndDrawArray(mightyMember, baseAttribute);
        }
Exemple #3
0
 public override void EndDrawHeader(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
 {
     if (PositionByMember(mightyMember, attribute).Contains(DecoratorPosition.AfterHeader))
     {
         DrawSpace(((LayoutSpaceAttribute)attribute).Size);
     }
 }
Exemple #4
0
 public override void BeginDrawArray(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
 {
     if (PositionByMember(mightyMember, attribute).Contains(DecoratorPosition.Before))
     {
         DrawSpace(((LayoutSpaceAttribute)attribute).Size);
     }
 }
 public override void EndDrawArray(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
 {
     if (PositionByMember(mightyMember, attribute).Contains(DecoratorPosition.After))
     {
         DrawSpace();
     }
 }
Exemple #6
0
        public override void BeginDraw(BaseMightyMember mightyMember, BaseElementDecoratorAttribute baseAttribute,
                                       Action <BaseMightyMember, SerializedProperty, BaseDrawerAttribute> propertyDrawCallback,
                                       BaseDrawerAttribute drawerAttribute = null)
        {
            var property = mightyMember.Property;

            if (!property.isArray)
            {
                BeginDraw(mightyMember, baseAttribute);

                propertyDrawCallback?.Invoke(mightyMember, property, drawerAttribute);
                return;
            }

            BeginDrawArray(mightyMember, baseAttribute);
            BeginDrawHeader(mightyMember, baseAttribute);

            if (!EditorDrawUtility.DrawFoldout(property))
            {
                EndDrawHeader(mightyMember, baseAttribute);
                EndDrawArray(mightyMember, baseAttribute);
                return;
            }

            EditorGUI.indentLevel++;
            EditorDrawUtility.DrawArraySizeField(property);

            EndDrawHeader(mightyMember, baseAttribute);
        }
Exemple #7
0
 public DecoratorPosition PositionByMember(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
 {
     if (!m_flexibleSpaceCache.Contains(mightyMember))
     {
         InitDrawer(mightyMember, attribute);
     }
     return(m_flexibleSpaceCache[mightyMember].Value);
 }
Exemple #8
0
 public override void EndDraw(BaseMightyMember mightyMember, BaseElementDecoratorAttribute baseAttribute,
                              Action <BaseMightyMember, SerializedProperty, BaseDrawerAttribute> propertyDrawCallback,
                              BaseDrawerAttribute drawerAttribute = null)
 {
     if (!mightyMember.Property.isArray && baseAttribute is EndHorizontalAttribute || baseAttribute is HorizontalAttribute)
     {
         GUILayout.EndHorizontal();
     }
 }
Exemple #9
0
        public override Rect EndDrawHeader(Rect rect, BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
        {
            if (PositionByMember(mightyMember, attribute).Contains(DecoratorPosition.AfterHeader))
            {
                rect = DrawSpace(rect, ((LayoutSpaceAttribute)attribute).Size);
            }

            return(rect);
        }
Exemple #10
0
        public override void BeginDraw(BaseMightyMember mightyMember, BaseElementDecoratorAttribute baseAttribute,
                                       Action <BaseMightyMember, SerializedProperty, BaseDrawerAttribute> propertyDrawCallback,
                                       BaseDrawerAttribute drawerAttribute = null)
        {
            var property = mightyMember.Property;

            if (!property.isArray || property.propertyType == SerializedPropertyType.String)
            {
                if (baseAttribute is BeginHorizontalAttribute || baseAttribute is HorizontalAttribute)
                {
                    GUILayout.BeginHorizontal();
                }

                propertyDrawCallback?.Invoke(mightyMember, property, drawerAttribute);
                return;
            }

            if (!EditorDrawUtility.DrawFoldout(property))
            {
                EndDrawHeader(mightyMember, baseAttribute);
                EndDrawArray(mightyMember, baseAttribute);
                return;
            }

            EditorGUI.indentLevel++;
            EditorDrawUtility.DrawArraySizeField(property);

            EditorDrawUtility.DrawArrayBody(property, index =>
            {
                BeginDrawElement(mightyMember, index, baseAttribute);
                propertyDrawCallback?.Invoke(mightyMember, property.GetArrayElementAtIndex(index), drawerAttribute);
                EndDrawElement(mightyMember, index, baseAttribute);
            });

            EditorGUI.indentLevel--;
        }
Exemple #11
0
 public abstract void BeginDrawArray(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute);
Exemple #12
0
        public override Rect BeginDrawHeader(Rect rect, BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
        {
            var position = PositionByMember(mightyMember, attribute);

            if (position.Contains(DecoratorPosition.BeforeHeader))
            {
                rect = DrawSpace(rect, ((LayoutSpaceAttribute)attribute).Size);
            }

            return(rect);
        }
Exemple #13
0
 public abstract void BeginDraw(BaseMightyMember mightyMember, BaseElementDecoratorAttribute baseAttribute,
                                Action <BaseMightyMember, SerializedProperty, BaseDrawerAttribute> propertyDrawCallback, BaseDrawerAttribute drawerAttribute = null);
Exemple #14
0
 public abstract float GetElementHeight(BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute);
Exemple #15
0
 public abstract Rect EndDrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute);
Exemple #16
0
 public abstract void EndDrawElement(BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute);
Exemple #17
0
 public override float GetElementHeight(BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute) => 0;
Exemple #18
0
        public override Rect BeginDrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute)
        {
            var position = PositionByMember(mightyMember, attribute);
            var size     = ((LayoutSpaceAttribute)attribute).Size;

            if (position.Contains(DecoratorPosition.BeforeElements))
            {
                rect = DrawSpace(rect, size);
            }

            if (index != 0 && position.Contains(DecoratorPosition.BetweenElements))
            {
                rect = DrawSpace(rect, size);
            }

            return(rect);
        }
Exemple #19
0
 public override void BeginDrawElement(BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute)
 {
     if (attribute is BeginHorizontalAttribute || attribute is HorizontalAttribute)
     {
         GUILayout.BeginHorizontal();
     }
 }
Exemple #20
0
 public override Rect EndDrawHeader(Rect rect, BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute) => rect;
Exemple #21
0
 public override void EndDrawHeader(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
 {
 }
Exemple #22
0
 public override void BeginDrawArray(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute)
 {
 }
Exemple #23
0
        public override void EndDrawElement(BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute)
        {
            var position = PositionByMember(mightyMember, attribute);

            if (position.Contains(DecoratorPosition.AfterElements))
            {
                DrawSpace(((LayoutSpaceAttribute)attribute).Size);
            }
        }
 public override Rect BeginDrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute)
 {
     if (attribute is BeginVerticalAttribute || attribute is VerticalAttribute)
     {
         GUILayout.BeginVertical();
     }
     return(rect);
 }
Exemple #25
0
 public override float GetElementHeight(BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute) =>
 ((LayoutSpaceAttribute)attribute).Size;
Exemple #26
0
 public override Rect EndDrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute)
 {
     if (attribute is EndHorizontalAttribute || attribute is HorizontalAttribute)
     {
         GUILayout.EndHorizontal();
     }
     return(rect);
 }
Exemple #27
0
 public abstract void EndDrawHeader(BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute);
 public override void EndDrawElement(BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute)
 {
     if (attribute is EndVerticalAttribute || attribute is VerticalAttribute)
     {
         GUILayout.EndVertical();
     }
 }
Exemple #29
0
 public abstract Rect EndDrawHeader(Rect rect, BaseMightyMember mightyMember, BaseElementDecoratorAttribute attribute);
 public override Rect EndDrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute)
 => rect;