示例#1
0
        private bool DrawSerializedProperty(SerializedProperty _property)
        {
            if (_property == null || !_property.hasVisibleChildren)
            {
                return(false);
            }

            bool _isSelected = UnityEditorUtility.DrawPropertyHeader(_property);

            if (_property.hasVisibleChildren && _property.isExpanded)
            {
                GUILayout.Space(-4f);
                GUILayout.BeginHorizontal("HelpBox");
                {
                    GUILayout.Space(8f);
                    GUILayout.BeginVertical();
                    {
                        UnityEditorUtility.ForEach(_property, (_childrenProperty) =>
                        {
                            if (_childrenProperty.hasChildren && _childrenProperty.propertyType != SerializedPropertyType.String)
                            {
                                EditorGUILayout.LabelField(_childrenProperty.displayName, EditorStyles.boldLabel);
                                UnityEditorUtility.ForEach(_childrenProperty, (_2ndLayerChildrenProperty) =>
                                {
                                    EditorGUI.indentLevel++;
                                    EditorGUILayout.PropertyField(_2ndLayerChildrenProperty, true);
                                    EditorGUI.indentLevel--;
                                }
                                                           );
                            }
                            else
                            {
                                EditorGUILayout.PropertyField(_childrenProperty);
                            }
                        }
                                                   );
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndHorizontal();
            }

            return(_isSelected);
        }
        private void DrawDetailedView()
        {
            SerializedProperty _settingsProperty = m_settingsCollection[m_activeType];

            // title section
            GUILayout.BeginHorizontal();
            GUILayout.Space(4f);
            if (GUILayout.Button("NP Settings", "GUIEditor.BreadcrumbLeft"))
            {
                m_activeType = eSettingsType.NONE;
            }
//			GUILayout.FlexibleSpace();
//			GUILayout.BeginVertical();
            GUILayout.Label(_settingsProperty.displayName, "GUIEditor.BreadcrumbMid");
//			GUILayout.EndVertical();
//			GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);

            // property detail screen
            _settingsProperty.isExpanded = true;
            UnityEditorUtility.ForEach(_settingsProperty, (_childProperty) =>
            {
                if (_childProperty.hasChildren && _childProperty.propertyType != SerializedPropertyType.String)
                {
                    GUILayout.Label(_childProperty.displayName, "OL Minus");
                    UnityEditorUtility.ForEach(_childProperty, (_innerChildProperty) =>
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(_innerChildProperty, true);
                        EditorGUI.indentLevel--;
                    });
                }
                else
                {
                    EditorGUILayout.PropertyField(_childProperty);
                }
            });
        }
        private void DrawDetailedView()
        {
            // title section
            GUILayout.BeginHorizontal();
            GUILayout.Space(4f);

            //			GUILayout.EndVertical();
            //			GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);


            SerializedProperty prop = serializedObject.GetIterator();

            if (prop.NextVisible(true))
            {
                do
                {
                    if (prop.hasChildren && prop.propertyType != SerializedPropertyType.String)
                    {
                        GUILayout.Label(prop.displayName, "OL Minus");
                        UnityEditorUtility.ForEach(prop, (_innerChildProperty) =>
                        {
                            EditorGUI.indentLevel++;
                            EditorGUILayout.PropertyField(_innerChildProperty, true);
                            EditorGUI.indentLevel--;
                        });
                    }
                    else
                    {
                        EditorGUILayout.PropertyField(prop);
                    }
                }while (prop.NextVisible(false));
            }

            serializedObject.ApplyModifiedProperties();
        }