private void _ProtoHandle() { LTEditorUtils.ShowLine("Proto Save Path", ref LTEditorData.instance.protoSavePath, "/_res/proto", true); LTEditorUtils.ShowLine("Proto Code Gen Path", ref LTEditorData.instance.protoGenPath, "/Scripts/Proto", true); LTEditorUtils.ShowLine("Proto Code Gen Path2", ref LTEditorData.instance.protoGenPath2, "/Scripts/Proto", true); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Gen code at save path")) { LTProtoGenHelper.HandleDir(Application.dataPath + LTEditorData.instance.protoSavePath); } if (GUILayout.Button("Gen code from select proto")) { var savePath = LTEditorData.instance.protoSavePath; if (savePath.StartsWith("/")) { savePath = Application.dataPath + savePath; } var choose = EditorUtility.OpenFilePanelWithFilters("Choose Proto", savePath, new string[] { "Proto文件", "proto", }); if (!string.IsNullOrEmpty(choose)) { LTProtoGenHelper.HandleProto(choose); } } if (GUILayout.Button("Copy to save path2")) { LTProtoGenHelper.CopySavePath1ToPath2(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField(""); }
private void _UIHandle() { LTEditorUtils.ShowLine("UI NameSpace", ref LTEditorData.instance.uiNameSpace, "MainGame", false); LTEditorUtils.ShowLine("UI Code Gen Path", ref LTEditorData.instance.uiCodeExportPath, "/Scripts/GenUI"); LTEditorUtils.ShowLine("UI Meditor Gen Path", ref LTEditorData.instance.uiMediaotExportPath, "/Scripts/UIMediator"); EditorGUILayout.LabelField(""); }
private void _ExcelHandle() { LTEditorUtils.ShowLine("Config NameSpace", ref LTEditorData.instance.excelNameSpace, "MainGame", false); LTEditorUtils.ShowLine("Excel Save Path", ref LTEditorData.instance.excelSavePath, ""); LTEditorUtils.ShowLine("Config Code Gen Path", ref LTEditorData.instance.configCodeSavePath, "/Scripts/GenConfig"); LTEditorUtils.ShowLine("Config Data Save Path", ref LTEditorData.instance.configDataSavePath, "/data/config"); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Progress Save Path")) { var savePath = LTEditorData.instance.excelSavePath; if (savePath.StartsWith("/")) { savePath = Application.dataPath + savePath; } if (string.IsNullOrEmpty(savePath)) { Debug.LogError("未配置生成路径"); } else { LTExcelHelper.GenCodeWithDir(savePath, false); } } if (GUILayout.Button("Progress Other Path")) { var savePath = LTEditorData.instance.excelSavePath; if (savePath.StartsWith("/")) { savePath = Application.dataPath + savePath; } var choosePath = EditorUtility.OpenFolderPanel("Choose Excel Path", savePath, ""); if (string.IsNullOrEmpty(choosePath)) { Debug.LogError("选择的路径为空"); } else { LTExcelHelper.GenCodeWithDir(choosePath, false); } } if (GUILayout.Button("Progress Single Excel")) { var savePath = LTEditorData.instance.excelSavePath; if (savePath.StartsWith("/")) { savePath = Application.dataPath + savePath; } var choose = EditorUtility.OpenFilePanelWithFilters("Choose Excel", savePath, new string[] { "Excel", "xls,xlsx", }); if (!string.IsNullOrEmpty(choose)) { LTExcelHelper.GenCodeWithFile(choose, false); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField(""); }
public static void HandleProto(string protoFile) { var p = new Process(); var startInfo = p.StartInfo; startInfo.FileName = Application.dataPath + "/Plugins/LTGame/Editor/Utils/ProtoGen/protoc.exe"; var savePath = LTEditorUtils.GetRealPath(LTEditorData.instance.protoGenPath); LTUtils.MakeDirExist(savePath); var protoDirPath = LTUtils.GetDirPath(protoFile); var arguments = string.Format(" --csharp_out={0} --proto_path {1} {2}", savePath, protoDirPath, protoFile); // arguments = arguments.ReplaceAll("/", "\\\\"); UnityEngine.Debug.LogFormat("arguments:{0}", arguments); startInfo.Arguments = arguments; startInfo.RedirectStandardError = true; startInfo.UseShellExecute = false; p.Start(); var errorStr = p.StandardError.ReadToEnd(); p.WaitForExit(); if (string.IsNullOrEmpty(errorStr)) { UnityEngine.Debug.LogFormat("生成{0}到{1}", protoFile, savePath); } else { UnityEngine.Debug.LogErrorFormat("errorOutput:{0}", errorStr); UnityEngine.Debug.LogErrorFormat("生成{0}到{1}失败", protoFile, savePath); } }
public static void CopySavePath1ToPath2() { var savePath = LTEditorUtils.GetRealPath(LTEditorData.instance.protoGenPath); if (!Directory.Exists(savePath)) { UnityEngine.Debug.LogErrorFormat("不存在原始路径:{0}", savePath); return; } var files = Directory.GetFileSystemEntries(savePath); if (string.IsNullOrEmpty(LTEditorData.instance.protoGenPath2)) { UnityEngine.Debug.LogError("目标路径不能为空"); return; } var savePath2 = LTEditorData.instance.protoGenPath2; var path = LTUtils.MakeDirExist(savePath2); foreach (var filePath in files) { if (filePath.EndsWith(".cs")) { var file = new FileInfo(filePath); var destPath = path + "/" + file.Name; File.Copy(filePath, destPath, true); UnityEngine.Debug.LogFormat("复制成功:{0}-->{1}", filePath, destPath); } } }
private void _AnimHandle() { LTEditorUtils.ShowLine("Anim Root Node", ref LTEditorData.instance.animRootNode, "Armature/body", false); LTEditorUtils.ShowLine("Anim Ignore Node", ref LTEditorData.instance.animIgnoreNode, "Armature", false); LTEditorUtils.ShowLine("Anim Save Path", ref LTEditorData.instance.animSavePath, "/_data/anim"); LTEditorUtils.ShowLine("AnimData SavePath", ref LTEditorData.instance.animDataSavePath, "/_data/animData"); EditorGUILayout.LabelField(""); }