예제 #1
0
        internal static SerializedObject GetSerializedSettings()
        {
            ACEditorPrefs settings = GetOrCreateSettings();

            if (settings != null)
            {
                return(new SerializedObject(settings));
            }
            return(null);
        }
예제 #2
0
        public static SettingsProvider CreateMyCustomSettingsProvider()
        {
            var provider = new SettingsProvider("Project/AdventureCreator", SettingsScope.Project)
            {
                label = "Adventure Creator",

                guiHandler = (searchContext) =>
                {
                    var settings = ACEditorPrefs.GetSerializedSettings();
                    if (settings != null)
                    {
                        EditorGUILayout.LabelField("Gizmo colours", EditorStyles.boldLabel);
                        EditorGUILayout.PropertyField(settings.FindProperty("hotspotGizmoColor"), new GUIContent("Hotspots", "The colour to tint Hotspot gizmos with"));
                        EditorGUILayout.PropertyField(settings.FindProperty("triggerGizmoColor"), new GUIContent("Triggers", "The colour to tint Trigger gizmos with"));
                        EditorGUILayout.PropertyField(settings.FindProperty("collisionGizmoColor"), new GUIContent("Collisions", "The colour to tint Collision gizmos with"));
                        EditorGUILayout.PropertyField(settings.FindProperty("pathGizmoColor"), new GUIContent("Paths", "The colour to draw Path gizmos with"));

                        EditorGUILayout.Space();
                        EditorGUILayout.LabelField("Hierarchy icons", EditorStyles.boldLabel);
                        EditorGUILayout.PropertyField(settings.FindProperty("showHierarchyIcons"), new GUIContent("Show icons?", "If True, save and node icons will appear in the Hierarchy window"));
                        if (settings.FindProperty("showHierarchyIcons") == null || settings.FindProperty("showHierarchyIcons").boolValue)
                        {
                            EditorGUILayout.PropertyField(settings.FindProperty("hierarchyIconOffset"), new GUIContent("Horizontal offset", "A horizontal offset to apply to AC icons in the Hierarchy"));
                        }

                        EditorGUILayout.Space();
                        EditorGUILayout.LabelField("Editor settings", EditorStyles.boldLabel);
                        EditorGUILayout.PropertyField(settings.FindProperty("editorLabelWidth"), new GUIContent("Label widths", "How wide to render labels in Managers and other editors"));
                        EditorGUILayout.PropertyField(settings.FindProperty("menuItemsBeforeScroll"), new GUIContent("Items before scrolling", "How many Menus, Inventory items, Variables etc can be listed in the AC Game Editor before scrolling becomes necessary"));

                        EditorGUILayout.Space();
                        EditorGUILayout.LabelField("Import / export", EditorStyles.boldLabel);
                        EditorGUILayout.PropertyField(settings.FindProperty("csvFormat"), new GUIContent("CSV format", "The formatting method to apply to CSV files"));

                        settings.ApplyModifiedProperties();
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("Cannot create AC editor prefs - does the folder '" + Resource.MainFolderPath + "/Editor' exist?", MessageType.Warning);
                    }
                },
            };

            return(provider);
        }