/// <summary> /// 用于刷新窗口 /// </summary> /// <param name="position">位置</param> public static void OpenWindow(Vector2 position) { Rect rect = new Rect(DataTableEditorLaunchWindow.WindowRect); rect.position = position; var window = DataTableEditorWindow.GetWindowWithRect <DataTableEditorWindow>(rect, true, DataTableEditorConfig.GetConfig().WindowTitle); window.position = rect; window.minSize = new Vector2(rows[0].RowData.Count * (TextFieldWidth + 4) + 5, rows.Count * (TextFieldHeight + 2) + 215); window.maxSize = new Vector2(rows[0].RowData.Count * (TextFieldWidth + 4) + 5, rows.Count * (TextFieldHeight + 2) + 215); window.ShowUtility(); }
/// <summary> /// 打开表格 /// </summary> private void OpenDataTable() { OSPlatformWindow.OpenFileName openFileName = new OSPlatformWindow.OpenFileName(); openFileName.structSize = Marshal.SizeOf(openFileName); openFileName.filter = DataTableEditorConfig.Filter; openFileName.file = new string(new char[256]); openFileName.maxFile = openFileName.file.Length; openFileName.fileTitle = new string(new char[64]); openFileName.maxFileTitle = openFileName.fileTitle.Length; openFileName.initialDir = Application.streamingAssetsPath.Replace('/', '\\');//默认路径 openFileName.title = "Load"; openFileName.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008; if (OSPlatformWindow.LocalDialog.GetSaveFileName(openFileName)) { this.Close(); DataTableEditorWindow.OpenWindow(openFileName.fileTitle.Replace(".txt", ""), this.position.position); } }
/// <summary> /// 打开编辑窗口 /// </summary> /// <param name="fileName">文件名</param> /// <param name="position">位置</param> public static void OpenWindow(string fileName, Vector2 position) { m_fileName = fileName; m_tableProcessor = DataTableGenerator.CreateDataTableProcessor(fileName); if (!DataTableGenerator.CheckRawData(m_tableProcessor, fileName)) { Debug.LogError(Utility.Text.Format("Check raw data failure. DataTableName='{0}'", fileName)); return; } LoadDataTable(); Rect rect = new Rect(DataTableEditorLaunchWindow.WindowRect); rect.position = position; var window = DataTableEditorWindow.GetWindowWithRect <DataTableEditorWindow>(rect, true, DataTableEditorConfig.GetConfig().WindowTitle); window.position = rect; window.minSize = new Vector2(m_tableProcessor.RawColumnCount * (TextFieldWidth + 4) + 5, m_tableProcessor.RawRowCount * (TextFieldHeight + 2) + 215); window.maxSize = new Vector2(m_tableProcessor.RawColumnCount * (TextFieldWidth + 4) + 5, m_tableProcessor.RawRowCount * (TextFieldHeight + 2) + 215); window.ShowUtility(); }