public static void OpenWindow() { WindowRect = new Rect((Screen.currentResolution.width / 2) - (windowSize.x / 2), (Screen.currentResolution.height / 2) - (windowSize.y / 2), windowSize.x, windowSize.y); var window = DataTableEditorLaunchWindow.GetWindowWithRect <DataTableEditorLaunchWindow>(WindowRect, true, DataTableEditorConfig.GetConfig().WindowTitle); window.minSize = windowSize; window.maxSize = windowSize; window.ShowUtility(); }
public static void OpenWindow(Vector2 position) { Rect rect = new Rect(WindowRect); rect.position = position; var window = DataTableEditorLaunchWindow.GetWindowWithRect <DataTableEditorLaunchWindow>(rect, true, DataTableEditorConfig.GetConfig().WindowTitle); window.minSize = windowSize; window.maxSize = windowSize; window.position = rect; window.ShowUtility(); }
private void OnGUI() { GUILayout.Space(10); CheckNull(); m_datatableNames.DoLayoutList(); GUILayout.Space(10); if (GUILayout.Button(DataTableEditorConfig.GetConfig().Generate, GUILayout.Height(50))) { DataTableGeneratorMenu.GenerateDataTables(DataTableEditorConfig.GetConfig().DataTableNamesList); } if (GUILayout.Button(DataTableEditorConfig.GetConfig().Back, GUILayout.Height(50))) { this.Close(); DataTableEditorLaunchWindow.OpenWindow(this.position.position); } }
private void OnGUI() { GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label(DataTableEditorConfig.GetConfig().IDNameRow, GUILayout.Width(120)); m_datatableIDNameRow = EditorGUILayout.IntField(m_datatableIDNameRow, GUILayout.Width(60)); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label(DataTableEditorConfig.GetConfig().IDTypeRow, GUILayout.Width(120)); m_datatableIDTypeRow = EditorGUILayout.IntField(m_datatableIDTypeRow, GUILayout.Width(60)); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label(DataTableEditorConfig.GetConfig().CommentRow, GUILayout.Width(120)); m_datatableCommentRow = EditorGUILayout.IntField(m_datatableCommentRow, GUILayout.Width(60)); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label(DataTableEditorConfig.GetConfig().ContentStartRow, GUILayout.Width(120)); m_datatableCommentStartRow = EditorGUILayout.IntField(m_datatableCommentStartRow, GUILayout.Width(60)); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label(DataTableEditorConfig.GetConfig().IDColumn, GUILayout.Width(120)); m_datatableIdColumn = EditorGUILayout.IntField(m_datatableIdColumn, GUILayout.Width(60)); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label(DataTableEditorConfig.GetConfig().Language, GUILayout.Width(120)); DataTableEditorConfig.DefaultLanguage = EditorGUILayout.Popup(DataTableEditorConfig.DefaultLanguage, DataTableEditorConfig.LanguageFlags); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); m_namespace = EditorGUILayout.TextField(DataTableEditorConfig.GetConfig().NameSpace, m_namespace); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); m_datatablePath = EditorGUILayout.TextField(DataTableEditorConfig.GetConfig().DataTablePath, m_datatablePath); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); m_CSharpCodePath = EditorGUILayout.TextField(DataTableEditorConfig.GetConfig().CSharpCodePath, m_CSharpCodePath); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); m_CSharpCodeTemplateFileName = EditorGUILayout.TextField(DataTableEditorConfig.GetConfig().CSharpCodeTemplateFileName, m_CSharpCodeTemplateFileName); GUILayout.EndHorizontal(); GUILayout.Space(10); if (GUILayout.Button(DataTableEditorConfig.GetConfig().Apply, GUILayout.Height(50))) { DataTableEditorLaunchWindow.OpenWindow(this.position.position); SetProcessorData(); this.Close(); } if (GUILayout.Button(DataTableEditorConfig.GetConfig().Back, GUILayout.Height(50))) { DataTableEditorLaunchWindow.OpenWindow(this.position.position); this.Close(); } }
private void OnGUI() { for (int i = 0; i < rows.Count; i++) { GUILayout.BeginHorizontal(); for (int j = 0; j < rows[i].RowData.Count; j++) { rows[i].RowData[j] = GUILayout.TextField(rows[i].RowData[j], GUILayout.Width(TextFieldWidth), GUILayout.Height(TextFieldHeight)); } GUILayout.EndHorizontal(); } //添加列按钮 GUILayout.BeginHorizontal(); if (GUILayout.Button(DataTableEditorConfig.GetConfig().AddColumn, GUILayout.Height(50))) { for (int i = 0; i < rows.Count; i++) { rows[i].RowData.Add(""); } ReOpenWindow(); } if (GUILayout.Button(DataTableEditorConfig.GetConfig().RemoveColumn, GUILayout.Height(50))) { for (int i = 0; i < rows.Count; i++) { rows[i].RowData.RemoveAt(rows[i].RowData.Count - 1); } ReOpenWindow(); } GUILayout.EndHorizontal(); //添加行按钮 GUILayout.BeginHorizontal(); if (GUILayout.Button(DataTableEditorConfig.GetConfig().AddRow, GUILayout.Height(50))) { Row row = new Row(); for (int i = 0; i < rows[0].RowData.Count; i++) { row.RowData.Add(""); } rows.Add(row); ReOpenWindow(); } if (GUILayout.Button(DataTableEditorConfig.GetConfig().RemoveRow, GUILayout.Height(50))) { rows.RemoveAt(rows.Count - 1); ReOpenWindow(); } GUILayout.EndHorizontal(); if (GUILayout.Button(DataTableEditorConfig.GetConfig().Apply, GUILayout.Height(50))) { this.Close(); DataTableEditorLaunchWindow.OpenWindow(this.position.position); SaveDataTable(); } if (GUILayout.Button(DataTableEditorConfig.GetConfig().Back, GUILayout.Height(50))) { this.Close(); DataTableEditorLaunchWindow.OpenWindow(this.position.position); } }