Ejemplo n.º 1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var items      = property.FindPropertyRelative("features").FindPropertyRelative("features");
            var header     = property.FindPropertyRelative("folderCaption");
            var headerRect = position;

            headerRect.y     += 10f;
            headerRect.height = EditorUtilities.GetPropertyHeight(header, true, new GUIContent("Caption")) + 4f;

            position.y  = headerRect.y;
            position.y += 20f;
            EditorGUI.PropertyField(position, items, GUIContent.none, true);

            var captionRect = headerRect;

            captionRect.x     += 4f;
            captionRect.width -= 4f * 2f;
            var backStyle = new GUIStyle("RL Header");

            if (UnityEngine.Event.current.type == UnityEngine.EventType.Repaint)
            {
                backStyle.Draw(headerRect, false, false, false, false);
            }
            header.stringValue = EditorGUI.TextField(captionRect, string.Empty, header.stringValue, EditorStyles.boldLabel);
        }
Ejemplo n.º 2
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            var items = property.FindPropertyRelative("items");
            var h     = EditorUtilities.GetPropertyHeight(items, true, new GUIContent("Features"));

            return(h + 50f);
        }
Ejemplo n.º 3
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            //var enabled = property.FindPropertyRelative("enabled");
            var items         = property.FindPropertyRelative("feature");
            var innerFeatures = property.FindPropertyRelative("innerFeatures");
            var h             = EditorUtilities.GetPropertyHeight(items, true, GUIContent.none);

            if (items.objectReferenceValue is FeatureBase featureBase && featureBase.editorComment.Length > 0)
            {
                var width = this.GetWidth();
                var style = new GUIStyle(EditorStyles.miniLabel);
                style.wordWrap     = true;
                style.fixedWidth   = 0f;
                style.stretchWidth = false;
                h += style.CalcHeight(new GUIContent(featureBase.editorComment), width);
            }

            h += 4f * 2f;

            //h += EditorUtilities.GetPropertyHeight(innerFeatures, true, new GUIContent("Sub Features"));

            return(h);
        }
Ejemplo n.º 4
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            var items  = property.FindPropertyRelative("features").FindPropertyRelative("features");
            var header = property.FindPropertyRelative("folderCaption");
            var h      = 20f;//EditorUtilities.GetPropertyHeight(header, true, new GUIContent("Caption")) + 4f;

            if (items.arraySize == 0)
            {
                if (items.isExpanded == true)
                {
                    h += 80f + 20f;
                    return(h);
                }
                else
                {
                    h += 40f;
                    return(h);
                }
            }
            h += EditorUtilities.GetPropertyHeight(items, true, new GUIContent(header.stringValue));
            h += 20f;
            return(h);
        }