Ejemplo n.º 1
0
 public override void AddSlices(SerializedProperty property, Slices slices)
 {
     if (NeedDrawButtons(property))
     {
         slices.Add(new Slice(0, 20, rect => DrawPlusButton(rect, property.Copy())));
         slices.Add(new Slice(0, 20, rect => DrawMinusButton(rect, property.Copy())));
     }
     else if (NeedDrawLabel(property))
     {
         slices.Add(new Slice(1, 0, rect => DrawLabel(rect, property.Copy())));
     }
 }
Ejemplo n.º 2
0
        public override void AddSlices(SerializedProperty property, Slices slices)
        {
            DrawHighlight(property, slices, 0, 1);
            var slice = new Slice(GetWeight(property), GetFixedWidth(property),
                                  rect => Draw(rect, property.Copy()));

            slices.Add(slice);
            DrawTooltip(property, slices, 1, 0);
        }
        protected override void DrawChild(SerializedProperty parent, SerializedProperty child, Slices slices)
        {
            var childSlices = new SlicesImpl();

            childSlices.AddBefore(new DrawableImpl(rect => DrawElementContextMenu(rect, parent, child)));
            base.DrawChild(parent, child, childSlices);

            slices.Add(childSlices);
        }
Ejemplo n.º 4
0
        public void AddSlices(int before, int after, SerializedProperty property, Slices slices, bool isLast)
        {
            bool expand = isLast &&
                          property.IsReallyArray() &&
                          property.GetCustomAttribute <ArrayLengthAttribute>() == null;

            var slice = new MetaSlice(before, after, null, rect => DrawHeader(rect, property.displayName), expand);

            slices.Add(slice);
        }
Ejemplo n.º 5
0
        protected override void DrawChild(SerializedProperty parent, SerializedProperty child, Slices slices)
        {
            var count       = slices.CountPayload;
            var contextMenu = new MetaSlice(0, 0, rect => DrawElementContextMenu(rect, parent, child));

            slices.Add(contextMenu);

            base.DrawChild(parent, child, slices);

            contextMenu.After = slices.CountPayload - count;
        }
        private void DrawChildWithDecorators(SerializedProperty parent, SerializedProperty child, Slices slices, bool isLast)
        {
            space.Draw(child, slices);

            var childSlices = new SlicesImpl();

            DrawChild(parent, child, childSlices);
            if (NeedDrawHeader(parent, child))
            {
                header.Draw(child, childSlices);
            }
            slices.Add(childSlices);
        }
Ejemplo n.º 7
0
        public override void AddSlices(SerializedProperty property, Slices slices)
        {
            Slice slice;

            if (property.IsArrayElement())
            {
                slice = new Slice(0, width, Draw);
            }
            else
            {
                slice = new Slice(0, width, Draw, Draw);
            }
            slices.Add(slice);
        }
Ejemplo n.º 8
0
        protected void DrawTooltip(SerializedProperty property, Slices slices, int before, int after)
        {
            var attribute = property.GetCustomAttribute <TooltipAttribute>();

            if (attribute == null)
            {
                return;
            }

            var slice = new MetaSlice(before, after,
                                      rect => EditorGUI.LabelField(rect, new GUIContent("", attribute.tooltip)));

            slices.Add(slice);
        }
Ejemplo n.º 9
0
        public void Draw(SerializedProperty property, Slices slices)
        {
#if !ONE_LINE_VERTICAL_SEPARATOR_DISABLE
            Slice slice;
            if (property.IsArrayElement())
            {
                slice = new SliceImpl(0, width, DrawInternal);
            }
            else
            {
                slice = new SliceImpl(0, width, DrawInternal, DrawInternal);
            }
            slices.Add(slice);
#endif
        }
Ejemplo n.º 10
0
        protected MetaSlice DrawHighlight(SerializedProperty property, Slices slices, int before, int after)
        {
            var attribute = property.GetCustomAttribute <HighlightAttribute>();

            if (attribute == null)
            {
                return(null);
            }

            var slice = new MetaSlice(before, after,
                                      rect => GuiUtil.DrawRect(rect.Extend(1), attribute.Color));

            slices.Add(slice);
            return(slice);
        }
        private void DrawChildren(SerializedProperty property, Slices slices)
        {
            var childSlices = new SlicesImpl();

            GetChildren(property)
            .ForEachExceptLast((child) => {
                DrawChildWithDecorators(property, child, childSlices, false);

                if (childSlices.CountPayload > 0 && NeedDrawSeparator(child))
                {
                    separator.Draw(child, childSlices);
                }
            },
                               child => DrawChildWithDecorators(property, child, childSlices, true)
                               );
            if (childSlices.CountPayload > 0)
            {
                slices.Add(childSlices);
            }
        }
Ejemplo n.º 12
0
 public override void AddSlices(SerializedProperty property, Slices slices)
 {
     highlight.Draw(property, slices);
     slices.Add(new SliceImpl(GetWeight(property), GetFixedWidth(property), rect => Draw(rect, property.Copy())));
     tooltip.Draw(property, slices);
 }
Ejemplo n.º 13
0
 public override void AddSlices(SerializedProperty property, Slices slices)
 {
     property.GetCustomAttribute <SpaceAttribute>()
     .IfPresent(x => slices.Add(new Slice(0, x.height, rect => {})));
 }
Ejemplo n.º 14
0
 public void Draw(SerializedProperty property, Slices slices)
 {
     property.GetCustomAttribute <SpaceAttribute>()
     .IfPresent(x => slices.Add(new SliceImpl(0, x.height, rect => {})));
 }