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); }
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 Rect CalculateMetaSliceRect(MetaSlice slice, Rect wholeRect, Rect[] rects, int currentRect) { var from = rects[currentRect - slice.Before]; var to = rects[currentRect + slice.After - 1]; var result = from.Union(to); if (slice.Expand && rects.Length == currentRect) { result.xMax = wholeRect.xMax; } return(result); }
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); }
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); }