Beispiel #1
0
        public void DoDefaultDraw(Rect rect, int index)
        {
            var property = List.serializedProperty.GetArrayElementAtIndex(index);

            switch (_itemDisplay)
            {
            case ListItemDisplayType.Normal:
            {
                EditorGUI.PropertyField(rect, property, GUIContent.none);
                break;
            }

            case ListItemDisplayType.Inline:
            {
                InlineDisplayDrawer.Draw(rect, property, null);
                break;
            }

            case ListItemDisplayType.Foldout:
            {
                var expanded    = IsExpanded(index);
                var labelRect   = expanded ? RectHelper.TakeLine(ref rect) : rect;
                var foldoutRect = RectHelper.TakeLeadingIcon(ref labelRect);

                using (ColorScope.Color(new Color(0.3f, 0.3f, 0.3f)))
                {
                    if (GUI.Button(foldoutRect, expanded ? _collapseButton.Content : _expandButton.Content, GUIStyle.none))
                    {
                        SetExpanded(index, !expanded);
                    }
                }

                EditorGUI.LabelField(labelRect, "Item " + index, EditorStyles.boldLabel);

                if (expanded)
                {
                    using (new EditorGUI.IndentLevelScope(1))
                        InlineDisplayDrawer.Draw(rect, property, null);
                }

                break;
            }

            case ListItemDisplayType.AssetPopup:
            {
                AssetPopupDrawer.Draw(rect, GUIContent.none, property, _assetPopupType, true, false, true);
                break;
            }
            }
        }
Beispiel #2
0
        public void DoDefaultDraw(Rect rect, string key, int index)
        {
            var labelRect = RectHelper.TakeWidth(ref rect, rect.width * 0.25f);
            var value     = _valuesProperty.GetArrayElementAtIndex(index);

            EditorGUI.LabelField(labelRect, key);

            if (_drawInline)
            {
                InlineDisplayDrawer.Draw(rect, value, null);
            }
            else
            {
                EditorGUI.PropertyField(rect, value, GUIContent.none);
            }
        }
Beispiel #3
0
        private void DrawItemInline(Rect position, SerializedProperty listProperty, int index)
        {
            var property = listProperty.GetArrayElementAtIndex(index);

            InlineDisplayDrawer.Draw(position, property, null);
        }