Beispiel #1
0
        private void DrawDetailArea()
        {
            EditorGUILayout.BeginVertical("Box");
            if (_entryList.index >= 0)
            {
                var element = _entryList.serializedProperty.GetArrayElementAtIndex(_entryList.index);

                var propType = element.FindPropertyRelative(PROP_TYPE);

                SPEditorGUILayout.PropertyField(propType);
                SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_NAME));
                SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_DESCRIPTIVENAME));

                switch ((InputSettings.InputType)propType.enumValueIndex)
                {
                case InputSettings.InputType.KeyOrMouseButton:
                {
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_DESCRIPTIVENAMENEGATIVE));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_NEGATIVEBUTTON));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_POSITIVEBUTTON));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_ALTNEGATIVEBUTTON));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_ALTPOSITIVEBUTTON));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_GRAVITY));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_DEAD));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_SENSITIVITY));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_SNAP));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_INVERT));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_JOYNUM));

                    element.FindPropertyRelative(PROP_AXIS).enumValueIndex = 0;
                }
                break;

                case InputSettings.InputType.MouseMovement:
                case InputSettings.InputType.JoystickAxis:
                {
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_AXIS));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_DEAD));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_SENSITIVITY));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_INVERT));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_JOYNUM));

                    element.FindPropertyRelative(PROP_DESCRIPTIVENAMENEGATIVE).stringValue = string.Empty;
                    element.FindPropertyRelative(PROP_NEGATIVEBUTTON).stringValue          = string.Empty;
                    element.FindPropertyRelative(PROP_POSITIVEBUTTON).stringValue          = string.Empty;
                    element.FindPropertyRelative(PROP_ALTNEGATIVEBUTTON).stringValue       = string.Empty;
                    element.FindPropertyRelative(PROP_ALTPOSITIVEBUTTON).stringValue       = string.Empty;
                    element.FindPropertyRelative(PROP_GRAVITY).floatValue = 0f;
                    element.FindPropertyRelative(PROP_SNAP).boolValue     = false;
                }
                break;
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Select a target to edit.", MessageType.Info);
            }
            EditorGUILayout.EndVertical();
        }
        public virtual void DrawBuildOptions()
        {
            //TODO - upgrade this to more specialized build options gui
            this.DrawPropertyField(PROP_BUILDTARGET);
            this.DrawPropertyField(PROP_BUILDOPTIONS);

            var propDefineSymbols = this.serializedObject.FindProperty(PROP_DEFINESYMBOLS);

            SPEditorGUILayout.PropertyField(propDefineSymbols);
            if (propDefineSymbols.boolValue)
            {
                this.DrawPropertyField(PROP_SYMBOLS);
            }
        }
        public static bool PropertyField(SerializedObject obj, string prop, GUIContent label, bool includeChildren)
        {
            if (obj == null)
            {
                throw new System.ArgumentNullException("obj");
            }

            var serial = obj.FindProperty(prop);

            if (serial != null)
            {
                EditorGUI.BeginChangeCheck();
                //EditorGUILayout.PropertyField(serial, label, includeChildren);
                SPEditorGUILayout.PropertyField(serial, label, includeChildren);
                return(EditorGUI.EndChangeCheck());
            }

            return(false);
        }
Beispiel #4
0
        public static bool DrawDefaultInspectorExcept(SerializedObject serializedObject, params string[] propsNotToDraw)
        {
            if (serializedObject == null)
            {
                throw new System.ArgumentNullException("serializedObject");
            }

            EditorGUI.BeginChangeCheck();
            var iterator = serializedObject.GetIterator();

            for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false)
            {
                if (propsNotToDraw == null || !propsNotToDraw.Contains(iterator.name))
                {
                    //EditorGUILayout.PropertyField(iterator, true);
                    SPEditorGUILayout.PropertyField(iterator, true);
                }
            }
            return(EditorGUI.EndChangeCheck());
        }
 public static bool PropertyField(SerializedObject obj, string prop, string label, bool includeChildren)
 {
     return(SPEditorGUILayout.PropertyField(obj, prop, EditorHelper.TempContent(label), includeChildren));
 }
 public static bool PropertyField(SerializedProperty property, bool includeChildren, params GUILayoutOption[] options)
 {
     return(SPEditorGUILayout.PropertyField(property, (GUIContent)null, includeChildren, options));
 }
 public static bool PropertyField(SerializedProperty property, GUIContent label, params GUILayoutOption[] options)
 {
     return(SPEditorGUILayout.PropertyField(property, label, false, options));
 }
Beispiel #8
0
 public bool DrawPropertyField(string prop, GUIContent label, bool includeChildren)
 {
     return(SPEditorGUILayout.PropertyField(this.serializedObject, prop, label, includeChildren));
 }
Beispiel #9
0
 public bool DrawPropertyField(string prop)
 {
     return(SPEditorGUILayout.PropertyField(this.serializedObject, prop));
 }