/// <summary> /// Displays a toggleable toolbar with icons from /// the file system /// </summary> public void Toolbar() { EditorGUILayout.Space(); //Set toolbar images if (_toolbarImages == null) { _toolbarImages = new Texture[] { (Texture)Resources.Load("terra_gui_wrench"), (Texture)Resources.Load("terra_gui_map"), (Texture)Resources.Load("terra_gui_biome"), (Texture)Resources.Load("terra_gui_detail") }; } _config.EditorState.ToolbarSelection = (ToolbarOptions)EditorGUIExtension.EnumToolbar(_config.EditorState.ToolbarSelection, _toolbarImages); }
/// <summary> /// Displays a toggleable toolbar with icons from /// the file system /// </summary> public void Toolbar() { EditorGUILayout.Space(); //Set toolbar images if (ToolbarImages == null) { ToolbarImages = new Texture[] { (Texture)Resources.Load("terra_gui_general"), (Texture)Resources.Load("terra_gui_noise"), (Texture)Resources.Load("terra_gui_material"), (Texture)Resources.Load("terra_gui_object") }; } Settings.ToolbarSelection = (TerraSettings.ToolbarOptions)EditorGUIExtension.EnumToolbar(Settings.ToolbarSelection, ToolbarImages); }
void OnGUI() { GUILayout.Space(10f); PackagePlatform.platformCurrent = (PackagePlatform.PlatformType)EditorGUIExtension.EnumToolbar(PackagePlatform.platformCurrent); OnOptionsView(); OnPathSettingView(); GUILayout.Space(20f); if (GUILayout.Button("Package", GUILayout.Width(370))) { EditorApplication.delayCall += Package; Close(); } GUILayout.Space(10f); }
public override void DrawItem(Rect position, int index) { bool isRepaint = Event.current.type == EventType.Repaint; if (isRepaint) { _positions[index] = position; } //Resize area to fit within list gui var areaPos = _positions.ContainsKey(index) ? _positions[index] : new Rect(); areaPos.x += 6; areaPos.y += 8; areaPos.width -= 6; //Cache biome instance var biome = this[index]; if (biome == null) { return; } //Init sublists for biome if they don't exist yet if (GetMaterialList(biome) == null) { _materialList.Add(new KeyValuePair <BiomeData, ReorderableMaterialList>(biome, new ReorderableMaterialList(_config, biome.Details))); } if (GetObjectList(biome) == null) { _objectList.Add(new KeyValuePair <BiomeData, ReorderableObjectList>(biome, new ReorderableObjectList(_config, biome.Details))); } GUILayout.BeginArea(areaPos); string name = string.IsNullOrEmpty(biome.Name) ? "Biome " + (index + 1) : biome.Name; biome.Name = EditorGUILayout.TextField("Name", name, GUILayout.ExpandWidth(true)); if (biome.Color == default(Color)) { biome.Color = Random.ColorHSV(); } biome.Color = EditorGUILayout.ColorField(new GUIContent("Preview Color"), biome.Color, false, false, false, new ColorPickerHDRConfig(0, 1, 0, 1)); //Constraints EditorGUILayout.Space(); EditorGUILayout.LabelField("Constraints", EditorGUIExtension.TerraStyle.TextBold); GUILayout.Space(-2); biome.MixMethod = (BiomeData.ConstraintMixMethod)EditorGUIExtension.EnumToolbar(biome.MixMethod); //height biome.IsHeightConstrained = EditorGUILayout.Toggle("Height", biome.IsHeightConstrained); if (biome.IsHeightConstrained) { EditorGUI.indentLevel++; biome.HeightConstraint = EditorGUIExtension.DrawConstraintRange("Min/Max", biome.HeightConstraint, 0f, 1f); EditorGUI.indentLevel--; } //temperature biome.IsTemperatureConstrained = EditorGUILayout.Toggle("Temperature", biome.IsTemperatureConstrained); if (biome.IsTemperatureConstrained) { EditorGUI.indentLevel++; biome.TemperatureConstraint = EditorGUIExtension.DrawConstraintRange("Min/Max", biome.TemperatureConstraint, 0f, 1f); EditorGUI.indentLevel--; } //moisture biome.IsMoistureConstrained = EditorGUILayout.Toggle("Moisture", biome.IsMoistureConstrained); if (biome.IsMoistureConstrained) { EditorGUI.indentLevel++; biome.MoistureConstraint = EditorGUIExtension.DrawConstraintRange("Min/Max", biome.MoistureConstraint, 0f, 1f); EditorGUI.indentLevel--; } GUILayout.EndArea(); }