private void DrawCondition(Rect rect, SerializedProperty element, GUIContent label, int index, bool selected, bool focused)
        {
            Condition condition   = null;
            string    description = string.Empty;

            if (element.objectReferenceValue != null)
            {
                condition   = element.GetAs <Condition>();
                description = condition.GetDescription();
            }

            rect.x     += 10;
            rect.width -= 10;
            var foldoutRect = rect;

            foldoutRect.height = GenericParamUtils.FieldHeight;

            var backgroundRect = rect;

            backgroundRect.x     -= 29;
            backgroundRect.y     -= 1;
            backgroundRect.width += 33;
            backgroundRect.height = 20;

            var oldColor = GUI.color;

            GUI.color = Color.Lerp(new Color(1, 1, 1, 0), Color.white, 0.75f);
            GUI.Box(backgroundRect, GUIContent.none, SpaceEditorStyles.LightBox);
            GUI.color = oldColor;

            element.isExpanded = EditorGUI.Foldout(foldoutRect, element.isExpanded, new GUIContent(description), true);
            if (element.isExpanded)
            {
                rect.y      += GenericParamUtils.FieldHeight + 4;
                rect.height -= GenericParamUtils.FieldHeight + 2;

                if (condition)
                {
                    if (InspectorUtils.DrawDefaultInspector(rect, new SerializedObject(condition)))
                    {
                        if (element.serializedObject != null &&
                            element.serializedObject.targetObject != null)
                        {
                            EditorUtility.SetDirty(element.serializedObject.targetObject);
                        }
                    }
                }

                {
                    /*GUILayout.BeginArea(rect);
                     *
                     * if (InspectorUtils.DrawDefaultInspectorWithoutScriptField(new SerializedObject(condition)))
                     * {
                     *  EditorUtility.SetDirty(CurrentProperty.serializedObject.targetObject);
                     * }
                     *
                     * GUILayout.EndArea();*/
                }
            }
        }
Exemple #2
0
        private void DrawCondition(Rect rect, SerializedProperty element, GUIContent label, int index, bool selected, bool focused)
        {
            Condition condition   = null;
            string    description = string.Empty;

            if (element.objectReferenceValue != null)
            {
                condition   = element.GetAs <Condition>();
                description = condition.GetDescription();
            }

            rect.x += 10;
            var foldoutRect = rect;

            foldoutRect.height = GenericParamUtils.FieldHeight;

            element.isExpanded = EditorGUI.Foldout(foldoutRect, element.isExpanded, new GUIContent(description), true);
            if (element.isExpanded)
            {
                rect.width  -= 10;
                rect.y      += GenericParamUtils.FieldHeight;
                rect.height -= GenericParamUtils.FieldHeight;

                if (condition)
                {
                    if (InspectorUtils.DrawDefaultInspector(rect, new SerializedObject(condition)))
                    {
                        if (element.serializedObject != null &&
                            element.serializedObject.targetObject != null)
                        {
                            EditorUtility.SetDirty(element.serializedObject.targetObject);
                        }
                    }
                }

                {
                    /*GUILayout.BeginArea(rect);
                     *
                     * if (InspectorUtils.DrawDefaultInspectorWithoutScriptField(new SerializedObject(condition)))
                     * {
                     *  EditorUtility.SetDirty(CurrentProperty.serializedObject.targetObject);
                     * }
                     *
                     * GUILayout.EndArea();*/
                }
            }
        }