示例#1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var locations = GetLocationNames();
            var index     = GetLocationIndex(property);

            label.tooltip = EditorHelper.GetTooltip(fieldInfo);
            position      = EditorGUI.PrefixLabel(position, label);

            var width     = position.width * 0.5f;
            var space     = 5.0f;
            var popupRect = new Rect(position.x, position.y, width, position.height);
            var textRect  = new Rect(popupRect.xMax + space, position.y, width - space, position.height);

            using (var changes = new EditorGUI.ChangeCheckScope())
            {
                index = EditorGUI.Popup(popupRect, index, locations);

                if (changes.changed)
                {
                    SetLocationIndex(property, index);
                }
            }

            DrawName(textRect, property);
        }
示例#2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var instruction = (property.serializedObject.targetObject as Instruction);

            label.tooltip = EditorHelper.GetTooltip(fieldInfo);
            property.objectReferenceValue = Draw(position, instruction != null ? instruction.Set : null, property.objectReferenceValue as Instruction, label);
        }
示例#3
0
        public override void Setup(SerializedProperty property, FieldInfo fieldInfo)
        {
            Schema = GetObject <VariableSchema>(property);
            Values = new EditableList <VariableValue>();

            var values = Values.Setup(Schema.Definitions, Schema.Name, EditorHelper.GetTooltip(fieldInfo), true, true, false, true, true, DrawValue, RemoveValue);

            values.onAddDropdownCallback += AddValueDropdown;
        }
示例#4
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            label.tooltip = EditorHelper.GetTooltip(fieldInfo);

            var nameRect = new Rect(position.x, position.y, position.width * 0.8f, EditorGUIUtility.singleLineHeight);
            var editRect = new Rect(nameRect.xMax + 5, position.y, position.width - nameRect.width - 5, EditorGUIUtility.singleLineHeight);

            var species = property.objectReferenceValue as Species;

            EditorGUI.LabelField(nameRect, label, new GUIContent(species.name, "The name of this species"));

            if (GUI.Button(editRect, EditorHelper.EditContent))
            {
                EditorHelper.Edit(species);
            }
        }
示例#5
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            label.tooltip = EditorHelper.GetTooltip(fieldInfo);

            var dropRect     = new Rect(position.x, position.y, position.width * 0.8f, EditorGUIUtility.singleLineHeight);
            var loadRect     = new Rect(dropRect.xMax + 5, position.y, position.width - dropRect.width - 5, dropRect.height);
            var pathProperty = property.FindPropertyRelative("Path");
            var paths        = AssetFinder.ListScenes().ToArray();
            var names        = paths.Select(path => path.Replace('/', ' ')).ToArray();
            var selected     = Array.IndexOf(paths, pathProperty.stringValue);

            selected = EditorGUI.Popup(dropRect, label.text, selected, names);

            pathProperty.stringValue = selected >= 0 && selected < paths.Length ? paths[selected] : "";

            if (GUI.Button(loadRect, EditorHelper.LoadContent))
            {
                EditorSceneManager.OpenScene(pathProperty.stringValue, OpenSceneMode.Additive);
            }
        }
示例#6
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            label.tooltip = EditorHelper.GetTooltip(fieldInfo);

            var popupRect = new Rect(position.x, position.y, position.width * 0.8f, EditorGUIUtility.singleLineHeight);
            var editRect  = new Rect(popupRect.xMax + 5, position.y, position.width - popupRect.width - 5, EditorGUIUtility.singleLineHeight);

            var index         = UiPreferences.Instance.ListenerCategories.IndexOf(property.stringValue);
            var selectedIndex = EditorGUI.Popup(popupRect, label.text, index, UiPreferences.Instance.ListenerCategories.ToArray());

            if (selectedIndex != index)
            {
                property.stringValue = UiPreferences.Instance.ListenerCategories[selectedIndex];
                property.serializedObject.ApplyModifiedProperties();
            }

            if (GUI.Button(editRect, EditorHelper.EditContent))
            {
                ListenerCategoryWindow.ShowWindow();
            }
        }