void ShowPath() { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); GUIStyle style = new GUIStyle("boldLabel"); EditorGUILayout.LabelField("Path".ToGUIContent(), style, GUILayout.Width(45)); Path = CustomEditorBase.FolderPathButton(Path, assetsPath); GUILayout.Space(5); EditorGUILayout.EndHorizontal(); Folder = EditorGUILayout.Toggle("Create Folder", Folder); string folderPath = string.Format("{0}{1}{2}", assetsPath, System.IO.Path.AltDirectorySeparatorChar, Path); if (!Directory.Exists(folderPath)) { EditorGUILayout.HelpBox("Selected directory does not exist.", MessageType.Warning); height += 44; } else if (!Folder && Directory.GetFiles(folderPath).Length > 0) { EditorGUILayout.HelpBox("Selected directory is not empty.", MessageType.Warning); height += 44; } CustomEditorBase.Separator(); }
void showMapFiles() { CustomEditorBase.Separator(); RickEditorGUI.Label("INPUT :", selectedPath); GUILayout.Space(4); if(selectAllToglle){ selectAllToglle = RickEditorGUI.Toggle("Select all",true); if(!selectAllToglle){ for (int i = 0; i < selectedFiles.Length; i++) { selectedFiles[i] = false; } } }else{ selectAllToglle = RickEditorGUI.Toggle("Select all",false); if(selectAllToglle){ for (int i = 0; i < selectedFiles.Length; i++) { selectedFiles[i] = true; } } } GUILayout.Space(8); int index = 0; foreach (FileInfo fileInfo in files) { if(fileInfo.Exists){ selectedFiles[index] = RickEditorGUI.Toggle(fileInfo.Name, selectedFiles[index]); } index++; } }
void ShowFilters() { EditorGUI.BeginChangeCheck(); CustomEditorBase.BeginBox(); GUILayout.Space(2); EditorGUILayout.BeginHorizontal(); float labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 42; pathFilter = CustomEditorBase.FolderPathButton(pathFilter, Application.dataPath.Substring(0, Application.dataPath.Length - "Assets".Length), "Filter".ToGUIContent(), GUILayout.MinWidth(200)); EditorGUIUtility.labelWidth = labelWidth; GUILayout.Space(32); searchFilter = EditorGUILayout.TextField(searchFilter, new GUIStyle("ToolbarSeachTextField")); if (GUILayout.Button("", new GUIStyle("ToolbarSeachCancelButton"))) { EditorGUIUtility.editingTextField = false; searchFilter = ""; } EditorGUILayout.EndHorizontal(); CustomEditorBase.EndBox(); if (EditorGUI.EndChangeCheck()) { SetOrdererMaterials(); Save(); } }
protected override void showGUI() { showAnalyseTilset(); if (linker.tilesets.Count > 0) { CustomEditorBase.Separator(); showTilesetSelector(); if (selectedTileset != null) { scroolPos = EditorGUILayout.BeginScrollView(scroolPos); showTileset(); EditorGUILayout.EndScrollView(); if (selectedTile != null) { CustomEditorBase.Separator(); showTile(); } } } else { RickEditorGUI.Label("", "No Tileset Loaded :("); } }
void ShowGeneratesButton() { if (CustomEditorBase.LargeButton("Generate".ToGUIContent())) { Generate(); } CustomEditorBase.Separator(); }
void showOptions() { loadToPrefab = RickEditorGUI.Toggle("Load As Prefab", loadToPrefab); if (loadToPrefab) { prefabFolder = RickEditorGUI.FolderPath("Asset Prefab Folder", prefabFolder, RickEditorGUI.assetFolder); } CustomEditorBase.Separator(); filePath = RickEditorGUI.FilePath("Map ", filePath, RickEditorGUI.rootFolder, "tmx"); }
void ShowMaterials() { GUI.Box(EditorGUI.IndentedRect(new Rect(currentPosition.x, currentPosition.y, currentPosition.width, (lineHeight + 2) * materialsProperty.arraySize)), ""); currentPosition.y += 2; for (int i = 0; i < materialsProperty.arraySize; i++) { currentMaterial = renderOptions.materials[i]; CustomEditorBase.Reorderable(materialsProperty, i, true, EditorGUI.IndentedRect(currentPosition), OnMaterialReorder); ShowMaterial(); } }
void ShowStates() { EditorGUILayout.LabelField("States", new GUIStyle("boldLabel"), GUILayout.Width(100)); EditorGUI.indentLevel += 1; for (int i = 0; i < states.Count; i++) { bool locked = lockedStates.Contains(states[i]); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(locked); states[i] = EditorGUILayout.TextField(states[i]); EditorGUI.EndDisabledGroup(); if (i == 0) { if (CustomEditorBase.SmallAddButton()) { AddState(""); } } else { EditorGUI.BeginDisabledGroup(locked); if (CustomEditorBase.DeleteButton()) { RemoveState(i); break; } EditorGUI.EndDisabledGroup(); } GUILayout.Space(6); EditorGUILayout.EndHorizontal(); } if (EditorGUIUtility.editingTextField && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Tab) { AddState(""); } EditorGUI.indentLevel -= 1; CustomEditorBase.Separator(); }
void ShowMaterials(string category, List <Material> materialGroup) { GUIStyle categoryStyle = new GUIStyle("boldLabel"); categoryStyle.fontSize = 16; EditorGUILayout.LabelField(category, categoryStyle, GUILayout.Height(24)); float labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 149; EditorGUI.indentLevel += 1; EditorGUILayout.LabelField(GUIContent.none, new GUIStyle("RL DragHandle"), GUILayout.Height(4)); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Group", new GUIStyle("boldLabel"), GUILayout.Width(100)); EditorGUILayout.LabelField(" ", new GUIStyle("boldLabel"), GUILayout.Width(24)); EditorGUILayout.LabelField("Name Queue", new GUIStyle("boldLabel")); EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField(GUIContent.none, new GUIStyle("RL DragHandle"), GUILayout.Height(4)); for (int i = 0; i < materialGroup.Count; i++) { Material material = materialGroup[i]; EditorGUILayout.BeginHorizontal(); GUIStyle style = new GUIStyle("label"); style.fontStyle = FontStyle.Italic; style.clipping = TextClipping.Overflow; EditorGUILayout.LabelField(materialGroups[material], style, GUILayout.Width(100)); EditorGUILayout.LabelField(":", new GUIStyle("boldLabel"), GUILayout.Width(24)); material.renderQueue = EditorGUILayout.IntField(material.name, material.renderQueue); EditorGUILayout.EndHorizontal(); CustomEditorBase.Reorderable(materialsProperty, materialIndices[material], false, OnMaterialReorder); } if (materialGroup.Count > 0) { EditorGUILayout.LabelField(GUIContent.none, new GUIStyle("RL DragHandle"), GUILayout.Height(4)); } EditorGUI.indentLevel -= 1; EditorGUIUtility.labelWidth = labelWidth; }
void showOutputPanel() { CustomEditorBase.Separator(); RickEditorGUI.Label("Output",""); GUILayout.Space(4); const string seprateTooltip = "Determine whether the Tiles are loaded in Parent GameObjects based on the Tile's Layer or all tiles are put in the same parent."; separatePrefabByTiledLayers = RickEditorGUI.Toggle("Use Layers", seprateTooltip, separatePrefabByTiledLayers); loadToPrefab = RickEditorGUI.Toggle("Load As Prefab", loadToPrefab); if (loadToPrefab) { prefabFolder = RickEditorGUI.FolderPath("Asset Prefab Folder", prefabFolder, RickEditorGUI.assetFolder); } showButton(); }
void OnGUI() { prefabFilePath = RickEditorGUI.FilePath("Prefab to rotate", prefabFilePath, RickEditorGUI.resourcesFolder, "prefab"); if (CustomEditorBase.Button(new GUIContent("Make rotated prefab"))) { string filePath = "Assets/Resources" + prefabFilePath; GameObject prefabToRotate = (GameObject)AssetDatabase.LoadAssetAtPath(filePath + ".prefab", typeof(GameObject)); int dotIndex = filePath.LastIndexOf('/'); string fileFolder = filePath.Substring(0, dotIndex); nameRotation(prefabToRotate, fileFolder, "90", new Vector3(0, 0, 90)); nameRotation(prefabToRotate, fileFolder, "180", new Vector3(0, 0, 180)); nameRotation(prefabToRotate, fileFolder, "-90", new Vector3(0, 0, -90)); } }
void showLinkerSelectionPanel() { GUILayout.BeginHorizontal(); if (GUILayout.Button("Create New Linker")) { createNewLinker(); } if (GUILayout.Button("Refresh Linker list")) { refreshLinkerList(); } GUILayout.EndHorizontal(); CustomEditorBase.Separator(); showLinkerList(); }
void ShowLayer() { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Layer", new GUIStyle("boldLabel"), GUILayout.Width(100)); Layer = EditorGUILayout.TextField(Layer); EditorGUILayout.EndHorizontal(); ShowMachine(); ShowInherit(); ShowSubLayer(); ShowCallbacks(); CustomEditorBase.Separator(); }
void showSelectOrCreateLinkerPanel() { GUI.changed = false; linkerPath = RickEditorGUI.FilePath("Load Linker", linkerPath, RickEditorGUI.assetFolder, "asset", true); if (GUI.changed) { loadNewLinker(); onLinkerLoaded(); } CustomEditorBase.Separator(); if (GUILayout.Button("CreateNewLinker")) { createNewLinker(); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { Begin(position, property, label); currentPosition.height = EditorGUI.GetPropertyHeight(property, label); currentPosition = EditorGUI.PrefixLabel(currentPosition, label); BeginIndent(0); EditorGUI.PropertyField(currentPosition, property, GUIContent.none); EndIndent(); currentPosition.x -= 21f; currentPosition.y -= 1f; CustomEditorBase.Errors(currentPosition, errors); End(); }
void showSelectionButtons() { GUILayout.BeginHorizontal(); string[] autoTileChoices = new string[linker.autotiles.Count]; for (int index = 0; index < linker.autotiles.Count; index++) { autoTileChoices[index] = linker.autotiles[index].name; if (String.IsNullOrEmpty(autoTileChoices[index])) { autoTileChoices[index] = "* NO NAME * (" + index + ")"; } } GUI.changed = false; selectedAutoTileIndex = RickEditorGUI.Popup("Editing Tileset", selectedAutoTileIndex, autoTileChoices); if (GUI.changed) { switchAutoTile(selectedAutoTileIndex); } if (CustomEditorBase.Button(new GUIContent("Delete"))) { linker.autotiles.Remove(currentAutotile); selectedAutoTileIndex = selectedAutoTileIndex - 1; if (selectedAutoTileIndex >= 0) { switchAutoTile(selectedAutoTileIndex); } else { currentAutotile = null; } } if (CustomEditorBase.Button(new GUIContent("New Autotile"))) { currentAutotile = new AutotileData(); linker.autotiles.Add(currentAutotile); selectedAutoTileIndex = linker.autotiles.Count - 1; switchAutoTile(selectedAutoTileIndex); } GUILayout.EndHorizontal(); }
void ShowSubLayer() { List <string> options = new List <string> { " " }; options.AddRange(StateMachineUtility.LayerFormattedTypeDict.Keys); EditorGUILayout.BeginHorizontal(); EditorGUI.indentLevel += 1; EditorGUILayout.LabelField("Sublayer Of", GUILayout.Width(100)); EditorGUI.indentLevel -= 1; SubLayer = CustomEditorBase.Popup(SubLayer, options.ToArray(), GUIContent.none, GUILayout.MinWidth(150)); EditorGUILayout.EndHorizontal(); }
void showOutputSection() { RickEditorGUI.Label("Output-Tiled AutoTiles", ""); currentAutotile.tilesFileName = EditorGUILayout.TextField("TilesetName.tmx", currentAutotile.tilesFileName); if (GUILayout.Button("Export")) { currentAutotile.autoTileFilePath = EditorUtility.SaveFilePanel("Autotile file", RickEditorGUI.rootFolder, "autotile", "tmx"); //currentAutotile.autoTileFilePath = "C:/Users/The User/Documents/Unity Games/jeux/ITT1_EndlessTowerClimber/autotile.tmx"; export(); } CustomEditorBase.Separator(); RickEditorGUI.Label("Output-Create Prefab", ""); currentAutotile.basePrefab = (GameObject)EditorGUILayout.ObjectField("Base prefab", currentAutotile.basePrefab, typeof(GameObject), false); currentAutotile.outputAssetFolder = RickEditorGUI.FolderPath("Destination folder", currentAutotile.outputAssetFolder, RickEditorGUI.assetFolder); if (GUILayout.Button("Make Copies")) { makeCopie(); } }
protected override void showGUI() { if (previewTextures == null) { loadTextures(); } showSelectionButtons(); if (currentAutotile != null) { CustomEditorBase.Separator(); scrollView = EditorGUILayout.BeginScrollView(scrollView); showDataSection(); CustomEditorBase.Separator(); showInputSection(); CustomEditorBase.Separator(); showPreviewSection(); CustomEditorBase.Separator(); showOutputSection(); EditorGUILayout.EndScrollView(); } }
void OnGUI() { serializedObject = new SerializedObject(this); materialsProperty = serializedObject.FindProperty("materials"); EditorGUILayout.Space(); ShowFilters(); EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); scrollView = EditorGUILayout.BeginScrollView(scrollView); ShowMaterials("Background", backgroundMaterials); EditorGUILayout.Space(); ShowMaterials("Geometry", geometryMaterials); EditorGUILayout.Space(); ShowMaterials("Transparent", transparentMaterials); EditorGUILayout.Space(); ShowMaterials("Overlay", overlayMaterials); CustomEditorBase.Separator(); EditorGUILayout.EndScrollView(); if (EditorGUI.EndChangeCheck()) { changed = true; } if (changed && Event.current.type == EventType.MouseMove && !EditorGUIUtility.editingTextField) { SetOrdererMaterials(); changed = false; Event.current.Use(); } serializedObject.ApplyModifiedProperties(); }
void ShowInherit() { List <string> options = new List <string> { "PStateLayer" }; options.AddRange(StateMachineUtility.LayerFormattedTypeDict.Keys); EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); EditorGUI.indentLevel += 1; EditorGUILayout.LabelField("Inherits From", GUILayout.Width(100)); EditorGUI.indentLevel -= 1; Inherit = CustomEditorBase.Popup(Inherit, options.ToArray(), GUIContent.none, GUILayout.MinWidth(150)); EditorGUILayout.EndHorizontal(); if (!initialized || EditorGUI.EndChangeCheck()) { lockedStates = new List <string>(); if (StateMachineUtility.LayerFormattedStateFormattedDict.ContainsKey(Inherit)) { lockedStates = StateMachineUtility.LayerFormattedStateFormattedDict[Inherit]; for (int i = lockedStates.Count - 1; i >= 0; i--) { if (!states.Contains(lockedStates[i])) { AddState(lockedStates[i]); } states.Move(states.IndexOf(lockedStates[i]), 0); } } } }
protected override void showGUI() { showAnalyseTilset(); if (linker.tilesets.Count > 0) { CustomEditorBase.Separator(); showTilesetSelector(); if (selectedTileset != null) { showTileset(); if (selectedTile != null) { CustomEditorBase.Separator(); showTile(); } } } else { RickEditorGUI.Label("", "No Tileset Loaded :("); } }
protected void makeSeparator() { CustomEditorBase.Separator(); }
void OnMaterialReorder(SerializedProperty arrayProperty, int sourceIndex, int targetIndex) { CustomEditorBase.ReorderArray(arrayProperty, sourceIndex, targetIndex); UpdateMaterialQueues(); }