【本地化】资源比较工具优化

dev_chengFeng
gaoxin 2021-01-27 15:10:50 +08:00
parent 7ea8f43432
commit 9d58abfe35
1 changed files with 17 additions and 15 deletions

View File

@ -972,34 +972,36 @@ namespace Assets.Scripts.Editor.LanguageTool
{
Directory.Delete(artFontPath, true);
}
Directory.CreateDirectory(artFontPath);
string zhDirPath = Environment.CurrentDirectory + "\\FontArt\\ArtFont_zh\\";
string enDirPath = Environment.CurrentDirectory + "\\FontArt\\ArtFont_en\\";
Directory.CreateDirectory(artFontPath + "zh\\");
string[] zhFiles = Directory.GetFiles(zhDirPath);
for (int i = 0; i < zhFiles.Length; i++)
{
string[] nameArr = zhFiles[i].Split('\\');
string artFontPaht = zhFiles[i].Replace("_zh.", "_en.");
string[] _arr = artFontPaht.Split('\\');
string targetPath = enDirPath + _arr[nameArr.Length - 1];
string copyPath = artFontPath + nameArr[nameArr.Length - 1];
if (!File.Exists(targetPath))
string fileNameWithExt = Path.GetFileName(zhFiles[i]);
string targetName = fileNameWithExt.Replace("_zh.", "_en.");
string[] nameArr = targetName.Split('.');
string targetPath = enDirPath + nameArr[0];
if (!File.Exists(targetPath + ".png") && !File.Exists(targetPath + ".jpg"))
{
Debug.Log(targetPath);
Debug.Log(zhFiles[i]);
string copyPath = artFontPath + "zh\\" + fileNameWithExt;
File.Copy(zhFiles[i], copyPath);
}
}
Directory.CreateDirectory(artFontPath + "en\\");
string[] enFiles = Directory.GetFiles(enDirPath);
for (int i = 0; i < enFiles.Length; i++)
{
string[] nameArr = enFiles[i].Split('\\');
string artFontPaht = enFiles[i].Replace("_en.", "_zh.");
string[] _arr = artFontPaht.Split('\\');
string targetPath = zhDirPath + _arr[nameArr.Length - 1];
string copyPath = artFontPath + nameArr[nameArr.Length - 1];
if (!File.Exists(targetPath))
string fileNameWithExt = Path.GetFileName(enFiles[i]);
string targetName = fileNameWithExt.Replace("_en.", "_zh.");
string[] nameArr = targetName.Split('.');
string targetPath = zhDirPath + nameArr[0];
if (!File.Exists(targetPath + ".png") && !File.Exists(targetPath + ".jpg"))
{
Debug.Log(targetPath);
Debug.Log(enFiles[i]);
string copyPath = artFontPath + "en\\" + fileNameWithExt;
File.Copy(enFiles[i], copyPath);
}
}