//////////////////////////////////////////////////////////////////////// #region Mouse Position Information private void DrawMousePositionUI(Vector3 _mousePosition) { float _y = _RectInterfaceControlSize + rectMouseBoxOffset.y; rectMouseBox.Set(rectMouseBoxOffset.x, _y, rectMouseBoxSize.x, rectMouseBoxSize.y); GUILayout.BeginArea(rectMouseBox, "MOUSE POSITION", GUI.skin.GetStyle("Window")); if (PerspectiveType == PerspectiveType.Top_XZ) { string _text = string.Format( "X: ({0}) Z: ({1})", _mousePosition.x, _mousePosition.z ); EditorStatics.CreateLabelField(_text, EditorStatics.Width_350); } else { string _text = string.Format( "Z: ({0}) Y: ({1})", _mousePosition.z, _mousePosition.y ); EditorStatics.CreateLabelField(_text, EditorStatics.Width_350); } GUILayout.EndArea(); }
private void DrawTableStructureCreateField() { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Create", EditorStatics.Width_100)) { if (tableSO.Table.CreateColumn(newColumnName)) { newColumnName = string.Empty; GUI.FocusControl(null); } } // Spacing EditorStatics.CreateLabelField("", EditorStatics.Width_10); newColumnName = EditorStatics.CreateTextField( "Column Name", "", newColumnName, EditorStatics.Width_300 ); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); }
protected override void OnDrawAfterInterfaceMoveLine() { base.OnDrawAfterInterfaceMoveLine(); EditorGUILayout.BeginHorizontal(); EditorStatics.CreateLabelField("Display", string.Empty, EditorStatics.Width_70); viewType = (ViewType)EditorGUILayout.EnumPopup( string.Empty, viewType, EditorStatics.Width_90 ); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorStatics.CreateLabelField("Perspective", string.Empty, EditorStatics.Width_70); perspectiveType = (PerspectiveType)EditorGUILayout.EnumPopup( string.Empty, perspectiveType, EditorStatics.Width_90 ); EditorGUILayout.EndHorizontal(); }
//////////////////////////////////////////////////////////////////////// #region Path /// <summary> /// Create interface for PathPoints /// </summary> /// <param name="_spawnPointIndex">Current SpawnPoint index</param> private void PathInterface(SpawnPoint _point) { GUIStyle _style = EditorStatics.GetBoxStyle(0, 0, 5, 0, 15, 15, 15, 15, 455); EditorGUILayout.BeginVertical(_style); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Paths", pointStyle, GUILayout.Width(35)); // Push to the right GUILayout.FlexibleSpace(); if (GUILayout.Button(EditorStatics.StringAddSign, EditorStatics.Width_30)) { // Add a path with a starting position same as the spawnpoint current position _point.Add(_point.Position); } int _count = _point.Paths.Count; // Remove a path if (GUILayout.Button(EditorStatics.StringRemoveSign, EditorStatics.Width_30)) { if (_count > 0) { _point.Paths.RemoveAt(_count - 1); _count--; } } EditorGUILayout.EndHorizontal(); // Dont show toggle if no paths added if (_count > 0) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); _point.FoldoutPaths = EditorGUILayout.Foldout( _point.FoldoutPaths, "Toggle" ); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } // Create a foldout for the paths if (_point.FoldoutPaths) { EditorGUILayout.Space(); PathsDraw(_point); } EditorGUILayout.EndVertical(); }
private void DrawTableStructureColumns() { int _columnCount = tableSO.Table.ColumnCount; for (int _i = 0; _i < _columnCount; _i++) { if (_i != 0) { EditorGUILayout.Space(); } EditorGUILayout.BeginHorizontal(); // Display row index EditorStatics.CreateLabelField(_i.ToString(), EditorStatics.Width_50); ITableColumn _column = tableSO.Table.GetColumnByIndex(_i); EditorStatics.CreateLabelField( _column.ColumnName, EditorStatics.Width_210 ); _column.ColumnNameEditor = EditorStatics.CreateTextField( "", "", _column.ColumnNameEditor, EditorStatics.Width_300 ); ///Calls update method which will invoke OnRowUpdated event if (GUILayout.Button("Update", EditorStatics.Width_80)) { if (!string.IsNullOrEmpty(_column.ColumnNameEditor)) { if (tableSO.Table.UpdateColumnName(_column.ColumnNameEditor, _column)) { _column.ColumnNameEditor = string.Empty; } GUI.FocusControl(null); } } if (GUILayout.Button("Delete", EditorStatics.Width_80)) { tableSO.Table.RemoveColumn(_column); EditorGUILayout.EndHorizontal(); return; } EditorGUILayout.EndHorizontal(); } }
//////////////////////////////////////////////////////////////////////// #region Bar & Layout private void CreateTableNavigationBar() { // Contains navigation buttons and log EditorGUILayout.BeginHorizontal(); GUIStyle _style = EditorStatics.GetBoxStyle(10, 0, 10, 10, 15, 15, 15, 15); EditorGUILayout.BeginVertical(_style); // Contains navigation buttons EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Convert", EditorStatics.Width_100)) { LoadConvertInterface(); } if (GUILayout.Button("Browse", EditorStatics.Width_100)) { LoadTableBrowse(); } if (GUILayout.Button("Structure", EditorStatics.Width_100)) { LoadTableStructure(); } // Contains navigation buttons EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); DisplayLog(); // Contains navigation buttons and log EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (tableSO != null && tableSO && tableSO.Table != null) { if (currentView == CurrentView.TableBrowse) { //DrawTableBrowseCreateRowField(); } if (currentView == CurrentView.TableStructure) { //DrawTableStructureCreateField(); } } }
//////////////////////////////////////////////////////////////////////// #region Select SO /// <summary> /// Create a field for selecting a SpawnPointCollectionSO asset /// </summary> private void SelectSO() { GUIStyle _style = EditorStatics.GetBoxStyle(20, 0, 20, 10, 15, 15, 15, 15, 485); EditorGUILayout.BeginVertical(_style); so = (SpawnPointCollectionSO)EditorGUILayout.ObjectField( "Collection", so, typeof(SpawnPointCollectionSO), true ); EditorGUILayout.EndVertical(); }
private void EditTableInfo() { if (tableSO != null) { if (tableSO.Table != null) { tableSO.Table.Name = EditorStatics.CreateTextField( "Name", "", tableSO.Table.Name, EditorStatics.Width_210 ); } } }
/// <summary> /// Edits the path header. /// </summary> /// <returns>True if path was removed from the list</returns> private bool EditPathHeader(SpawnPoint _point, Path _path, int _pathIndex) { EditorStatics.CreateLabelField("", EditorStatics.Width_27); // Remove spawn point if (GUILayout.Button(EditorStatics.StringRemoveSign, EditorStatics.Width_30)) { _point.RemoveWithID(_path.ID); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); return(true); } EditDisplay(ContentHandles, ref _path.IsDisplayingHandles); EditDisplay(ContentGizmos, ref _path.IsDisplayingGizmo); EditDisplay(ContentLabels, ref _path.IsDisplayingLabel); // Keyboard enable/disable if (currentPathKeyboard == _pathIndex) { // Enable adding pathpoints to this path with keyboard EditorStatics.GUIPreColor = GUI.backgroundColor; GUI.backgroundColor = Color.green; if (GUILayout.Button(contentKeyboard, EditorStatics.Width_30)) { currentPathKeyboard = -1; } GUI.backgroundColor = EditorStatics.GUIPreColor; } else { // Enable adding pathpoints to this path with keyboard EditorStatics.GUIPreColor = GUI.backgroundColor; GUI.backgroundColor = Color.red; if (GUILayout.Button(contentKeyboard, EditorStatics.Width_30)) { currentPathKeyboard = _pathIndex; } GUI.backgroundColor = EditorStatics.GUIPreColor; } return(false); }
private void DrawTableRow() { if (currentRowIndex < 0) { return; } TableRow _currentRow = tableSO.Table.GetRowByIndex(currentRowIndex); int _columnCount = tableSO.Table.ColumnCount; for (int _i = 0; _i < _columnCount; _i++) { if (_i != 0) { EditorGUILayout.Space(); } EditorGUILayout.BeginHorizontal(); // Display row index EditorStatics.CreateLabelField(_i.ToString(), EditorStatics.Width_50); ITableRowValue _column = _currentRow.RowColumns[_i]; EditorStatics.CreateLabelField( _column.ColumnName, EditorStatics.Width_210 ); _column.Value = EditorGUILayout.TextArea( _column.Value, GUILayout.MinHeight(100), GUILayout.MaxWidth(460) ); ///Calls update method which will invoke OnRowUpdated event if (GUILayout.Button("Update", EditorStatics.Width_80)) { _column.Update(_column.Value); } EditorGUILayout.EndHorizontal(); } }
/// <summary> /// Draw all Paths in the list to the inspector interface /// </summary> /// <param name="_spawnPointIndex">The index.</param> private void PathsDraw(SpawnPoint _point) { GUIStyle _style = EditorStatics.GetBoxStyle(0, 0, 5, 0, 15, 15, 15, 15, 425); int _pathCount = _point.Paths.Count; for (int _i = 0; _i < _pathCount; _i++) { Path _path = _point.Paths[_i]; EditorGUILayout.BeginVertical(_style); if (pointStyle == null) { pointStyle = new GUIStyle(EditorStyles.foldout); } EditorGUILayout.BeginHorizontal(); // Create a foldout for the path _so.Collection.Points _path.Foldout = EditorGUILayout.Foldout(_path.Foldout, _path.Name + " ID:" + _path.ID); if (EditPathHeader(_point, _path, _i)) { EditorGUILayout.EndVertical(); return; } EditorGUILayout.EndHorizontal(); EditPathInfo(_path); if (!_path.Foldout) { EditorGUILayout.EndVertical(); continue; } EditorGUILayout.Space(); /// DRAWN INSPECTOR INTERFACE PATH POINTS PathPointsList(_path); EditorGUILayout.EndVertical(); } }
/// <summary> /// Field for changing path points name /// </summary> /// <param name="_point"></param> private void DrawPathPointName(PathPoint _point) { EditorGUILayout.BeginHorizontal(); // Spacing EditorGUILayout.LabelField(string.Empty, EditorStatics.Width_30); EditorGUILayout.LabelField("Name", EditorStatics.Width_50); _point.Name = EditorStatics.CreateTextField( "", "Point name - appears in header", ref _point.Name, EditorStatics.Width_210 ); EditorGUILayout.EndHorizontal(); }
private void EditPathInfo(Path _path) { if (!_path.Foldout) { return; } EditorGUILayout.Space(); _path.Name = EditorStatics.CreateTextField( "Name", "Path name - appears in header", ref _path.Name, EditorStatics.Width_300 ); _path.PathColor = EditorGUILayout.ColorField("Color", _path.PathColor, EditorStatics.Width_300); }
//////////////////////////////////////////////////////////////////////// #region Select SO private void SelectTableSO() { if (currentView == CurrentView.Convert) { return; } EditorGUILayout.Space(); GUIStyle _style = EditorStatics.GetBoxStyle(10, 10, 0, 10, 15, 15, 15, 15, 390); EditorGUILayout.BeginVertical(_style); labelDistance = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 80; loadTableSO = (TableSO)EditorGUILayout.ObjectField( "Table SO", loadTableSO, typeof(TableSO), true, EditorStatics.Width_210 ); EditTableInfo(); EditorGUIUtility.labelWidth = labelDistance; EditorGUILayout.Space(); // Buttons EditorGUILayout.BeginHorizontal(); EditTableLoad(); InterfaceSave(); // Buttons EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); }
/// <summary> /// Draw a texture which displays path _so.Collection.Points and their info /// </summary> private void DrawTextureInfo(int _pathIndex, int _pointIndex, Vector3 _position) { EditorStatics.CalculateFontSizes(_position); if (EditorStatics.GetDistance(_position) > 200) { return; } EditorStatics.SetGUIStyleTextureBackground(_position, 340, 220, 1000, 50); EditorStatics.TextureContent = new GUIContent( "<b><color=magenta><size=" + EditorStatics.FontSizeH0 + "> " + EditorStatics.StringPointMark + "Path Point: " + _pointIndex + "\r\n</size></color></b>" + "<color=white><size=" + EditorStatics.FontSizeH3 + "><b> " + EditorStatics.StringPointMark + "Path:</b> " + _pathIndex + "\r\n</size></color>" + "<color=white><size=" + EditorStatics.FontSizeH3 + "><b> " + EditorStatics.StringPointMark + "Position:</b> " + _position + "\r\n</size></color>" ); Handles.Label(_position + gizmoPathPointOffset, EditorStatics.TextureContent, EditorStatics.Style); }
private void DrawPaginationBar() { GUILayout.FlexibleSpace(); int _count = tableSO.Table.GetPageCount(currentPerPageValue); int _paginationStart = Mathf.Max(0, currentPage - pagination); int _paginationEnd = Mathf.Min(_count, currentPage + pagination); for (int i = _paginationStart; i < _paginationEnd; i++) { if (i != currentPage) { if (GUILayout.Button((i + 1).ToString(), EditorStatics.Width_27)) { currentPage = i; } } } EditorStatics.CreateLabelField(string.Empty, EditorStatics.Width_30); labelDistance = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 60; currentPerPageValue = EditorStatics.CreateIntPopup( "Per Page", currentPerPageValue, optionsPerPageString, optionsPerPageInt, EditorStatics.Width_140 ); if (currentPerPageValuePrevious != currentPerPageValue) { currentPage = 0; currentPerPageValuePrevious = currentPerPageValue; } EditorGUIUtility.labelWidth = labelDistance; }
/// <summary> /// Draw a texture which displays _so.Collection.Points and its info /// </summary> private void DrawTextureInfo(int _index, Vector3 _position) { EditorStatics.CalculateFontSizes(_position); if (EditorStatics.GetDistance(_position) > 250) { return; } int _multiplier = 2; EditorStatics.SetGUIStyleTextureBackground(_position, 320, 140 * _multiplier, 1000, 5000); pointContentString = string.Format( "\n<b><color=white><size={0}> {1}Spawn Point: {2}\r\n</size></color></b><color=white><size={3}><b> position:</b> {4} \r\n\n</size></color>", EditorStatics.FontSizeH0, EditorStatics.StringPointMark, _index, EditorStatics.FontSizeH3, _position ); int _count = so.Collection.Points[_index].Paths.Count; for (int _i = 0; _i < _count; _i++) { string _extra = string.Format( "<color=grey><size={0}><b> {1}Path:</b> " + _i + " \n</size></color><color=white><size={2}><b>\t{1}Path Points:</b> {3} \n\n</size></color>", EditorStatics.FontSizeH1, EditorStatics.StringPointMark, EditorStatics.FontSizeH3, GetPathPointCount(_index, _i) ); pointContentString += _extra; } EditorStatics.TextureContent = new GUIContent(pointContentString); Handles.Label(_position + gizmoSpawnPointOffset, EditorStatics.TextureContent, EditorStatics.Style); }
/// <summary> /// Starts drawing the spawn point interface. /// </summary> private void InterfaceSpawnPoints() { EditorGUILayout.BeginVertical(styleInterface); useRaycastObjectPosition = EditorStatics.CreateBoolField( "Raycast Position", "If true, raycasting a point will create a new spawnpoint/path/pathpoint at the center of the object. Else, it'll create it at the exact ray hit location", ref useRaycastObjectPosition ); pathLineOffset = EditorStatics.CreateVector3AxisFields( "Gizmo Line ", pathLineOffset, EditorStatics.Width_300 ); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Spawn Points", EditorStatics.Width_150); if (GUILayout.Button(EditorStatics.StringAddSign, EditorStatics.Width_30)) { so.Collection.AddSpawnPoint(); } // Remove a spawn point if (GUILayout.Button(EditorStatics.StringRemoveSign, EditorStatics.Width_30)) { so.Collection.Remove(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); // Foldout toggle if (GetCount() > 0) { SpawnPointsDraw(); } }
/// <summary> /// Edit color, name, position of a spawn point /// </summary> private void EditSpawnPointInfo(SpawnPoint _point) { GUIStyle _style = EditorStatics.GetBoxStyle(0, 0, 5, 0, 15, 15, 15, 15, 455); GUILayout.BeginVertical(_style); _point.Name = EditorStatics.CreateTextField( "Name", "Spawn point name - appears in header", ref _point.Name, EditorStatics.Width_300 ); _point.ColorGizmo = EditorGUILayout.ColorField( "Color", _point.ColorGizmo, EditorStatics.Width_300 ); EditorGUILayout.Space(); // Draw position field on the next line EditorGUILayout.BeginHorizontal(); // Spacing EditorGUILayout.LabelField("Position", EditorStatics.Width_150); _point.Position = EditorGUILayout.Vector3Field(string.Empty, _point.Position, EditorStatics.Width_210); EditorGUILayout.EndHorizontal(); // Draw rotation field on the next line EditorGUILayout.BeginHorizontal(); // Spacing EditorGUILayout.LabelField("Rotation", EditorStatics.Width_150); _point.Rotation = EditorGUILayout.Vector3Field(string.Empty, _point.Rotation, EditorStatics.Width_210); EditorGUILayout.EndHorizontal(); GUILayout.EndVertical(); }
private void OnGUI() { SelectSO(); if (!so) { return; } Undo.RecordObject(so, "Undo Spawn Point"); EditorGUILayout.BeginHorizontal(); EditorStatics.CreateLabelField(string.Empty, EditorStatics.Width_10); if (GUILayout.Button("Graph", EditorStatics.Width_70)) { graph = new GraphSpawnPointEditorWindow(); graph.Enable(so); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false); InterfaceControls(); InterfacePreview(); InterfaceSpawnPoints(); EditorGUILayout.Space(); GUILayout.EndScrollView(); // If not called, changes to scriptable object are lost when Unity is restarted EditorUtility.SetDirty(so); }
private void DrawColumns() { GUIStyle _style = EditorStatics.GetBoxStyle(0, 0, 2, 2, 2, 2, 5, 5); EditorGUILayout.BeginVertical(_style); EditorGUILayout.BeginHorizontal(); // Edit row (Width_50), insert (Width_50), remove (Width_50) width in DrawRows() EditorStatics.CreateLabelField("", EditorStatics.Width_150); // Spacing fix EditorStatics.CreateLabelField("", EditorStatics.Width_5); // Shift row up and down (Width_20) width in DrawRows() EditorStatics.CreateLabelField("", EditorStatics.Width_20); EditorStatics.CreateLabelField("", EditorStatics.Width_20); EditorStatics.CreateLabelField("#", EditorStatics.Width_50); int _count = tableSO.Table.ColumnCount; for (int _i = 0; _i < _count; _i++) { EditorStatics.CreateLabelField( tableSO.Table.ColumnNames[_i].ShorterText(10, true), EditorStatics.Width_80, style ); // Push the next one EditorStatics.CreateLabelField("", EditorStatics.Width_5); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }
private void DrawTableLayout() { if (currentView == CurrentView.Convert) { DrawInterfaceConvert(); return; } if (tableSO == null || !tableSO || tableSO.Table == null) { return; } GUIStyle _style = EditorStatics.GetBoxStyle(10, 10, 0, 10, 15, 15, 15, 15); EditorGUILayout.BeginVertical(_style); if (currentView == CurrentView.TableBrowse) { DrawTableBrowseCreateRowField(); DrawColumns(); DrawRows(); } else if (currentView == CurrentView.TableStructure) { DrawTableStructure(); } else if (currentView == CurrentView.EditRow) { DrawTableRow(); } EditorGUILayout.EndVertical(); }
//////////////////////////////////////////////////////////////////////// #region Log private void DisplayLog() { GUILayout.FlexibleSpace(); GUIStyle _style = EditorStatics.GetBoxStyle(20, 10, 10, 10, 15, 15, 15, 15, 600, 100); EditorGUILayout.BeginVertical(_style); scrollPositionLog = GUILayout.BeginScrollView(scrollPositionLog, false, false); logCount = logs.Count; for (int _i = logCount - 1; _i >= 0; _i--) { EditorStatics.CreateLabelField( logs[_i].LogMessage, EditorStatics.Width_500, logs[_i].ActionStatus ? colorLogSuccess : colorLogFail ); } GUILayout.EndScrollView(); EditorGUILayout.EndVertical(); }
/// <summary> /// Create interface for a PathPoint which allows editing its position and rotation. /// You can also remove the point or focus scene camera on it. /// </summary> private void DrawPathPoints(Path _path) { EditorGUILayout.Space(); GUIStyle style = EditorStatics.GetBoxStyle(0, 0, 5, 0, 5, 5, 5, 5, 400); int _count = _path.Points.Count; for (int _i = 0; _i < _count; _i++) { PathPoint _point = _path.Points[_i]; EditorGUILayout.BeginVertical(style); DrawPathPointsTitle(_point, _i); DrawPathPointsPositionAndRemove(_point, _i, _path); DrawPathPointsRotationAndDisplay(_point); DrawPathPointName(_point); EditorGUILayout.EndVertical(); } }
private void Awake() { SceneView.onSceneGUIDelegate += OnSceneGUI; styleInterface = EditorStatics.GetBoxStyle(20, 0, 0, 10, 15, 15, 15, 15, 485); }
//////////////////////////////////////////////////////////////////////// #region Convert private void DrawInterfaceConvert() { GUIStyle _style = EditorStatics.GetBoxStyle(10, 00, 0, 10, 15, 15, 15, 15, 350); EditorGUILayout.BeginVertical(_style); textTable = (TextAsset)EditorGUILayout.ObjectField( "JSON Table", textTable, typeof(TextAsset), true, EditorStatics.Width_300 ); importTable = (TableSO)EditorGUILayout.ObjectField( "Import SO", importTable, typeof(TableSO), true, EditorStatics.Width_300 ); if (GUILayout.Button("Import", EditorStatics.Width_70)) { if (importTable == null || !importTable) { CreateLog("Import table reference not set!", false); return; } if (textTable != null && textTable) { if (!string.IsNullOrEmpty(textTable.text)) { try { Table table = JsonUtility.FromJson <Table>(textTable.text); if (table != null) { importTable.Table = table; EditorUtility.SetDirty(importTable); importTable = null; textTable = null; CreateLog("JSON successfully loaded into the export table SO!", true); } } catch (System.Exception _e) { CreateLog("Unable to parse JSON file as a Table!", false); } } else { CreateLog("JSON file contains no data!", false); } } else { CreateLog("JSON file reference not set!", false); } } EditorGUILayout.EndVertical(); }
/// <summary> /// Draws interface for every spawn point. /// </summary> private void SpawnPointsDraw() { int spawnPointCount = GetCount(); GUIStyle _style = EditorStatics.GetBoxStyle(20, 0, 0, 0, 15, 15, 15, 15, 485); for (int _i = 0; _i < spawnPointCount; _i++) { SpawnPoint _point = so.Collection.Points[_i]; GUILayout.BeginVertical(_style); if (pointStyle == null) { pointStyle = new GUIStyle(EditorStyles.boldLabel); } EditorGUILayout.BeginHorizontal(); EditorStatics.GUIPreColor = EditorStyles.label.normal.textColor; pointStyle.normal.textColor = Color.white; EditorGUILayout.LabelField(EditorStatics.StringMiddleMark, pointStyle, GUILayout.Width(20)); pointStyle.normal.textColor = EditorStatics.GUIPreColor; string _displayName = so.Collection.Points[_i].Name + " ID: " + _point.ID; _point.Foldout = EditorGUILayout.Foldout(_point.Foldout, _displayName); SpawnPointListOrder(GetCount(), _i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); // Remove, focus, gizmos, keyboard if (EditSpawnPointHeaderButtons(_point, _i)) { EditorGUILayout.EndHorizontal(); GUILayout.EndVertical(); return; } EditorGUILayout.EndHorizontal(); // Do not show the spawn point if (!_point.Foldout) { GUILayout.EndVertical(); continue; } EditorGUILayout.Space(); EditSpawnPointInfo(_point); PathInterface(_point); GUILayout.EndVertical(); } }
private void DrawRows() { int _startIndex = currentPage * currentPerPageValue; List <TableRow> _rows = tableSO.Table.GetRows(_startIndex, _startIndex + currentPerPageValue, true); if (_rows == null) { return; } int _count = _rows.Count; for (int _i = 0; _i < _count; _i++) { TableRow _row = _rows[_i]; int _rowIndex = _startIndex + _i; GUIStyle _style = EditorStatics.GetBoxStyle(0, 0, 0, 0, 2, 2, 2, 2, 0, 30); EditorGUILayout.BeginVertical(_style); EditorGUILayout.BeginHorizontal(); // Insert a row before this one if (GUILayout.Button(new GUIContent("Insert", "Insert a row before this one"), EditorStatics.Width_50)) { tableSO.Table.InsertRow(_rowIndex); EditorGUILayout.EndHorizontal(); return; } // Insert a row before this one if (GUILayout.Button("Delete", EditorStatics.Width_50)) { tableSO.Table.RemoveRow(_rowIndex); EditorGUILayout.EndHorizontal(); return; } if (GUILayout.Button("Edit", EditorStatics.Width_50)) { EditTableRow(_rowIndex); } // Shift row to previous index if (GUILayout.Button(EditorStatics.StringArrowUp, EditorStatics.Width_20)) { int _nextIndex = _rowIndex - 1; if (tableSO.Table.ShiftRow(_rowIndex, _nextIndex)) { Debug.Log(string.Format("Shifted row up. From Index: {0}, To Index: {1}", _rowIndex, _nextIndex)); } } // Shift row to next index if (GUILayout.Button(EditorStatics.StringArrowDown, EditorStatics.Width_20)) { int _nextIndex = _rowIndex + 1; if (tableSO.Table.ShiftRow(_rowIndex, _nextIndex)) { Debug.Log(string.Format("Shifted row down. From Index: {0}, To Index: {1}", _rowIndex, _nextIndex)); } } // Display row index EditorStatics.CreateLabelField(_rowIndex.ToString(), EditorStatics.Width_50); GUIStyle _styleC = EditorStatics.GetBoxStyle(0, 0, 0, 0, 0, 0, 2, 2, 0, 26); _styleC.alignment = TextAnchor.MiddleCenter; style.wordWrap = true; int _columnCount = tableSO.Table.ColumnCount; for (int _j = 0; _j < _columnCount; _j++) { ITableRowValue _column = _row.RowColumns[_j]; EditorStatics.CreateLabelField( _column.Value.ShorterText(10, true), EditorStatics.Width_80, _styleC ); // Push the next one EditorStatics.CreateLabelField("", EditorStatics.Width_5); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } }