Example #1
0
        protected void DrawModuleEditor(string path, string label, ref bool toggled, ref Editor editor)
        {
            EditorHelpers.DrawLine();
            var module = serializedObject.FindProperty(path).objectReferenceValue;

            EditorHelpers.DrawFoldoutEditor(label, module, ref toggled, ref editor);
        }
        void DrawModuleEditor(string label, string moduleName, ref bool drawEditor, ref Editor editor)
        {
            string             configName = GetConfigName();
            SerializedProperty module     = serializedObject.FindProperty(configName).FindPropertyRelative(moduleName);

            UnityEngine.Object targetObject = module.objectReferenceValue;
            EditorHelpers.DrawFoldoutEditor(label, targetObject, ref drawEditor, ref editor);
        }
Example #3
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            MapGenModule mapGenerator = GetMapGenModule();

            if (mapGenerator != null)
            {
                EditorHelpers.DrawFoldoutEditor("Map Generator", mapGenerator, ref foldout, ref editor);
            }
        }
        protected override void DrawModuleEditors()
        {
            base.DrawModuleEditors();

            EditorHelpers.DrawLine();
            var floorHeightMap = serializedObject.FindProperty(FLOOR_HEIGHTMAP_PATH).objectReferenceValue;

            EditorHelpers.DrawFoldoutEditor(FLOOR_HEIGHTMAP_LABEL, floorHeightMap, ref drawFloorHeightMapEditor, ref floorHeightMapEditor);

            EditorHelpers.DrawLine();
            var ceilingModule = serializedObject.FindProperty(CEILING_HEIGHTMAP_PATH).objectReferenceValue;

            EditorHelpers.DrawFoldoutEditor(CEILING_HEIGHTMAP_LABEL, ceilingModule, ref drawCeilingHeightMapEditor, ref ceilingHeightMapEditor);

            EditorHelpers.DrawLine();
        }
        protected override void DrawModuleEditors()
        {
            base.DrawModuleEditors();

            EditorHelpers.DrawLine();
            var floorHeightMap = serializedObject.FindProperty(FLOOR_HEIGHTMAP_PATH).objectReferenceValue;

            EditorHelpers.DrawFoldoutEditor(FLOOR_HEIGHTMAP_LABEL, floorHeightMap, ref drawFloorHeightMapEditor, ref floorHeightMapEditor);

            EditorHelpers.DrawLine();
            var outlineModule = serializedObject.FindProperty(OUTLINE_MODULE_PATH).objectReferenceValue;

            EditorHelpers.DrawFoldoutEditor(OUTLINE_MODULE_LABEL, outlineModule, ref drawOutlineEditor, ref outlineEditor);

            EditorHelpers.DrawLine();
        }
Example #6
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();
            serializedObject.Update();
            UpdateModuleEditors();
            int currentEditor = -1;

            foreach (SerializedProperty property in EditorHelpers.GetProperties(serializedObject).Where(IsModule))
            {
                if (property.objectReferenceValue != serializedObject.targetObject)
                {
                    currentEditor++;
                    string             name = property.displayName;
                    UnityEngine.Object obj  = property.objectReferenceValue;
                    EditorHelpers.DrawFoldoutEditor(name, obj, ref foldouts[currentEditor], ref moduleEditors[currentEditor]);
                }
                else
                {
                    property.objectReferenceValue = null;
                    Debug.LogWarning("Action denied: Module inserted into itself.");
                }
            }
            serializedObject.ApplyModifiedProperties();
        }
 protected virtual void DrawModuleEditors()
 {
     EditorHelpers.DrawLine();
     EditorHelpers.DrawFoldoutEditor(MAP_GEN_MODULE_LABEL, GetMapGenModule(), ref drawMapGenEditor, ref mapGenEditor);
 }