public static void OnGUI() { EditorGUILayout.LabelField("Newly Created Segments", EditorStyles.boldLabel); newSegmentType = (LevelSegment.Type)EditorGUILayout.EnumPopup("Type", newSegmentType); EditorGUILayout.Space(); EditorGUILayout.LabelField("Extrusion Defaults", EditorStyles.boldLabel); #if UNITY_2017_4_OR_NEWER extrudeBoundsInclusion = (ExtrusionSettings.BoundsInclusion)EditorGUILayout.EnumFlagsField("Bounds Inclusion", extrudeBoundsInclusion); #else extrudeBoundsInclusion = (ExtrusionSettings.BoundsInclusion)EditorGUILayout.EnumMaskField("Bounds Inclusion", extrudeBoundsInclusion); #endif extrudeApplyRotation = EditorGUILayout.Toggle("Apply Rotation", extrudeApplyRotation); extrudeApplyScale = EditorGUILayout.Toggle("Apply Scale", extrudeApplyScale); extrudeBendSprite = EditorGUILayout.Toggle("Extrude Meshes", extrudeBendSprite); if (extrudeBendSprite) { extrudeApplyMeshColors = EditorGUILayout.Toggle("Apply Mesh Colors", extrudeApplyMeshColors); } extrudeMeshColliderHandle = (ExtrusionSettings.MeshColliderHandling)EditorGUILayout.EnumPopup("Mesh Collider Handling", extrudeMeshColliderHandle); #if DREAMTECK_SPLINES extrudeExtrudeSpline = EditorGUILayout.Toggle("Extrude Splines", extrudeExtrudeSpline); #endif EditorGUILayout.Space(); EditorGUILayout.LabelField("Editor Handles", EditorStyles.boldLabel); debugAlpha = EditorGUILayout.Slider("Alpha", debugAlpha, 0.1f, 1f); debugPointColor = EditorGUILayout.ColorField("Point Visualization Color", debugPointColor); debugEntranceColor = EditorGUILayout.ColorField("Entrance Visualization Color", debugEntranceColor); debugExitColor = EditorGUILayout.ColorField("Exit Visualization Color", debugExitColor); EditorGUILayout.LabelField("Editor GUI", EditorStyles.boldLabel); highlightColor = EditorGUILayout.ColorField("Highlight color", highlightColor); highlightContentColor = EditorGUILayout.ColorField("Highlight content color", highlightContentColor); if (GUILayout.Button("Use Defaults", GUILayout.Width(120))) { newSegmentType = LevelSegment.Type.Extruded; debugPointColor = Color.black; debugEntranceColor = new Color(0f, 0.887f, 0.106f, 1f); debugExitColor = new Color(0.887f, 0f, 0.25f, 1f); highlightColor = new Color(0.4117647f, 0.8705883f, 0.007843138f, 1f); highlightContentColor = new Color(1f, 1f, 1f, 0.95f); extrudeApplyScale = false; extrudeApplyRotation = true; extrudeBendSprite = false; extrudeApplyMeshColors = false; extrudeBoundsInclusion = (ExtrusionSettings.BoundsInclusion) ~0; extrudeMeshColliderHandle = ExtrusionSettings.MeshColliderHandling.Bypass; #if DREAMTECK_SPLINES extrudeExtrudeSpline = false; #endif SavePrefs(); } if (GUI.changed) { SavePrefs(); } }
public static void LoadPrefs() { newSegmentType = (LevelSegment.Type)EditorPrefs.GetInt("Dreamteck.Forever.newSegmentType", 0); debugEntranceColor = LoadColor("Dreamteck.Forever.debugEntranceColor", new Color(0f, 0.887f, 0.106f, 1f)); debugExitColor = LoadColor("Dreamteck.Forever.debugExitColor", new Color(0.887f, 0f, 0.25f, 1f)); debugPointColor = LoadColor("Dreamteck.Forever.debugPointColor", Color.black); highlightColor = LoadColor("Dreamteck.Forever.highlightColor", new Color(0.4117647f, 0.8705883f, 0.007843138f, 1f)); highlightContentColor = LoadColor("Dreamteck.Forever.highlightContentColor", new Color(1f, 1f, 1f, 0.95f)); extrudeMeshColliderHandle = (ExtrusionSettings.MeshColliderHandling)EditorPrefs.GetInt("Dreamteck.Forever.extrudeMeshColliderHandle", 0); extrudeBoundsInclusion = (ExtrusionSettings.BoundsInclusion)EditorPrefs.GetInt("Dreamteck.Forever.extrudeBoundsInclusion", ~0); extrudeApplyScale = EditorPrefs.GetBool("Dreamteck.Forever.extrudeApplyScale", false); extrudeApplyRotation = EditorPrefs.GetBool("Dreamteck.Forever.extrudeApplyRotation", true); extrudeBendSprite = EditorPrefs.GetBool("Dreamteck.Forever.extrudeExtrudeMesh", false); extrudeApplyMeshColors = EditorPrefs.GetBool("Dreamteck.Forever.extrudeApplyMeshColors", false); #if DREAMTECK_SPLINES extrudeExtrudeSpline = EditorPrefs.GetBool("Dreamteck.Forever.extrudeExtrudeSpline", false); #endif }