public static string ExportUIText() { var filePath = FilePathConst.ProjectPath + "py_tools/lang/excel/ui_string.xlsx"; var checkPath = "Assets/Resources/"; //检测的路径 var allAssetPaths = AssetDatabase.GetAllAssetPaths(); var allStringList = new List <string>(); foreach (var path in allAssetPaths) { if (!path.StartsWith(checkPath)) { continue; } if (!path.EndsWith(".prefab")) { continue; } var obj = AssetDatabase.LoadAssetAtPath <GameObject>(path); var uiLangs = obj.GetComponentsInChildren <UILang>(true); foreach (var uiLang in uiLangs) { var langId = uiLang.langId; if (IsAllExcludeChars(langId)) { continue; } allStringList.Add(langId); } } allStringList.Unique(); //去重 StdioUtil.RemoveFiles(filePath); WriteToExcel(filePath, allStringList); LogCat.log("UI上的Text已经输出到", filePath); return(filePath); }
public static void RemoveFiles(this string self) { StdioUtil.RemoveFiles(self); }