void OnGUI() { if (!data) { data = Config.Load(); } data.showGroup = EditorGUILayout.BeginToggleGroup("配置", data.showGroup); EditorGUILayout.LabelField("插件路径", data.pluginPath); data.sourcePath = EditorGUILayout.TextField("csv资源存放路径", data.sourcePath); data.tableCSPath = EditorGUILayout.TextField("cs生成路径", data.tableCSPath); data.tableluaPath = EditorGUILayout.TextField("lua生成路径", data.tableluaPath); data.offset = EditorGUILayout.IntField("行偏移", data.offset); var input = EditorGUILayout.TextField("分隔符", data.SplitChar.ToString()); EditorGUILayout.EndToggleGroup(); if (!char.TryParse(input, out data.SplitChar)) { data.SplitChar = '\t'; } if (GUILayout.Button("Save")) { Config.Save(data); } if (GUILayout.Button("csv转c#")) { TableToolEditor.GlobalTable(); } if (GUILayout.Button("csv转lua")) { Csv2Lua.Run(data); } }
public static void AutoGenTableResAndScript() { TableToolEditor tool = new TableToolEditor(); string[] arrFileName = Directory.GetFiles(resPath); int fileCount = 0; foreach (string fileName in arrFileName) { EditorUtility.DisplayProgressBar("Table", fileName, (float)fileCount++ / (float)arrFileName.Length); tool.GenerateCSharpClass(fileName); tool.GenerateCSharpClass_Handle(fileName); } tool.GenerateTableLoad(arrFileName); }