예제 #1
0
        /// <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();
        }
        public static void GenerateDataTables(List <GameFramework.DataTableTools.DataTableGenerateWindow.DataTableName> dataTableNames)
        {
            foreach (var dataTable in dataTableNames)
            {
                if (!dataTable.IsOn)
                {
                    continue;
                }

                DataTableProcessor dataTableProcessor = DataTableGenerator.CreateDataTableProcessor(dataTable.Name);
                if (!DataTableGenerator.CheckRawData(dataTableProcessor, dataTable.Name))
                {
                    Debug.LogError(Utility.Text.Format("Check raw data failure. DataTableName='{0}'", dataTable.Name));
                    break;
                }

                DataTableGenerator.GenerateDataFile(dataTableProcessor, dataTable.Name);
                DataTableGenerator.GenerateCodeFile(dataTableProcessor, dataTable.Name);
            }

            AssetDatabase.Refresh();
        }