【本地化】语言工具调整
|
@ -922,22 +922,65 @@ namespace Assets.Scripts.Editor.LanguageTool
|
|||
// Selection.activeObject = go;
|
||||
//}
|
||||
|
||||
|
||||
[MenuItem("LanguageTool/artFont/整合中文资源")]
|
||||
private static void InteZhArtFont()
|
||||
private static string[] _ArtFontExt = new string[] { "_en", "_vi" };
|
||||
[MenuItem("LanguageTool/artFont/本地化资源名称检测")]
|
||||
private static void AllArtFontNameCheck()
|
||||
{
|
||||
GetAllArtFont("\\FontArt\\ArtFont_zh\\", "ArtFont");
|
||||
Debug.LogWarning("名称检测: _zh");
|
||||
CheckAllArtFont("_zh", "ArtFont");
|
||||
for(int i = 0; i < _ArtFontExt.Length; i++)
|
||||
{
|
||||
string ext = _ArtFontExt[i];
|
||||
Debug.LogWarning("名称检测: "+ ext);
|
||||
CheckAllArtFont(ext, "ArtFont"+ ext);
|
||||
}
|
||||
Debug.LogWarning("资源名称检测完成");
|
||||
}
|
||||
private static void CheckAllArtFont(string artTab, string directoryName)
|
||||
{
|
||||
string dirPath = Environment.CurrentDirectory + "\\Assets\\ManagedResources";
|
||||
Debug.Log(dirPath);
|
||||
|
||||
List<string> dirs = new List<string>(Directory.GetDirectories(dirPath, directoryName, SearchOption.AllDirectories));
|
||||
List<string> artFontDirs = new List<string>();
|
||||
for (int i = 0; i < dirs.Count; i++)
|
||||
{
|
||||
string[] files = Directory.GetFiles(dirs[i]);
|
||||
for (int j = 0; j < files.Length; j++)
|
||||
{
|
||||
string _ex = Path.GetExtension(files[j]);
|
||||
if (_ex.Contains(".meta")) continue;
|
||||
string fileName = Path.GetFileNameWithoutExtension(files[j]);
|
||||
if (fileName.EndsWith(artTab)) continue;
|
||||
if (fileName.EndsWith("_zh") || fileName.EndsWith("_en") || fileName.EndsWith("_vi"))
|
||||
{
|
||||
Debug.Log("文件路径" + files[j]);
|
||||
fileName = fileName.Substring(0, fileName.Length - 3);
|
||||
}
|
||||
fileName = Path.GetDirectoryName(files[j]) + "/" + fileName + artTab + _ex;
|
||||
Debug.Log("文件名:" + fileName);
|
||||
EditorUtility.DisplayProgressBar("遍历图片资源目录", string.Format("正在检索数据:{0}/{1}", i, dirs.Count), (float)i / dirs.Count);
|
||||
File.Move(files[j], fileName);
|
||||
}
|
||||
}
|
||||
EditorUtility.ClearProgressBar();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
[MenuItem("LanguageTool/artFont/整合英文资源")]
|
||||
private static void InteEnArtFont()
|
||||
{
|
||||
GetAllArtFont("\\FontArt\\ArtFont_en\\", "ArtFont_en");
|
||||
}
|
||||
|
||||
private static void GetAllArtFont(string _targetDir, string _artFontDir)
|
||||
[MenuItem("LanguageTool/artFont/本地化资源整合")]
|
||||
private static void ExportAllArtFont()
|
||||
{
|
||||
Debug.Log("开始整合文字资源图片");
|
||||
GetAllArtFont("\\FontArt\\ArtFont_zh\\", "ArtFont");
|
||||
for (int i = 0; i < _ArtFontExt.Length; i++)
|
||||
{
|
||||
string ext = _ArtFontExt[i];
|
||||
GetAllArtFont("\\FontArt\\ArtFont"+ ext + "\\", "ArtFont" + ext);
|
||||
}
|
||||
Debug.LogWarning("资源整合完成");
|
||||
}
|
||||
private static void GetAllArtFont(string _targetDir, string _artFontDir)
|
||||
{
|
||||
string dirPath = Environment.CurrentDirectory + "\\Assets\\ManagedResources";
|
||||
string copyPathDir = Environment.CurrentDirectory + _targetDir;
|
||||
if (!Directory.Exists(copyPathDir))
|
||||
|
@ -964,66 +1007,74 @@ namespace Assets.Scripts.Editor.LanguageTool
|
|||
Debug.Log("整合完成,路径是:" + copyPathDir);
|
||||
}
|
||||
|
||||
[MenuItem("LanguageTool/artFont/对比中英文资源")]
|
||||
|
||||
[MenuItem("LanguageTool/artFont/对比导出差异资源")]
|
||||
private static void CheckArtFont()
|
||||
{
|
||||
string artFontPath = Environment.CurrentDirectory + "\\FontArt\\中英文不一致资源\\";
|
||||
// 检测一遍文件名
|
||||
AllArtFontNameCheck();
|
||||
// 整合所有资源
|
||||
ExportAllArtFont();
|
||||
|
||||
// 开始导出差异资源
|
||||
string artFontPath = Environment.CurrentDirectory + "\\FontArt\\不一致资源\\";
|
||||
if (Directory.Exists(artFontPath))
|
||||
{
|
||||
Directory.Delete(artFontPath, true);
|
||||
}
|
||||
|
||||
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 zhFolder = artFontPath + "zh\\";
|
||||
Directory.CreateDirectory(zhFolder);
|
||||
for (int x = 0; x < _ArtFontExt.Length; x++)
|
||||
{
|
||||
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"))
|
||||
string ext = _ArtFontExt[x];
|
||||
string extDirPath = Environment.CurrentDirectory + "\\FontArt\\ArtFont" + ext + "\\";
|
||||
|
||||
// 导出未翻译的资源
|
||||
string extFolder = zhFolder + ext + "\\";
|
||||
Directory.CreateDirectory(extFolder);
|
||||
for (int i = 0; i < zhFiles.Length; i++)
|
||||
{
|
||||
Debug.Log(zhFiles[i]);
|
||||
string copyPath = artFontPath + "zh\\" + fileNameWithExt;
|
||||
File.Copy(zhFiles[i], copyPath);
|
||||
// 中文文件名
|
||||
string fileNameWithExt = Path.GetFileName(zhFiles[i]);
|
||||
// 翻译文件名
|
||||
string targetName = fileNameWithExt.Replace("_zh.", ext + ".");
|
||||
// 获取目标文件路径(不包含后缀),并判断是否存在
|
||||
string[] nameArr = targetName.Split('.');
|
||||
string targetPath = extDirPath + nameArr[0];
|
||||
if (!File.Exists(targetPath + ".png") && !File.Exists(targetPath + ".jpg"))
|
||||
{
|
||||
Debug.Log(zhFiles[i]);
|
||||
string copyPath = extFolder + fileNameWithExt;
|
||||
File.Copy(zhFiles[i], copyPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 导出冗余的翻译资源
|
||||
string extOutPath = artFontPath + ext + "\\";
|
||||
Directory.CreateDirectory(extOutPath);
|
||||
string[] extFiles = Directory.GetFiles(extDirPath);
|
||||
for (int i = 0; i < extFiles.Length; i++)
|
||||
{
|
||||
string fileNameWithExt = Path.GetFileName(extFiles[i]);
|
||||
string targetName = fileNameWithExt.Replace(ext + ".", "_zh.");
|
||||
string[] nameArr = targetName.Split('.');
|
||||
string targetPath = zhDirPath + nameArr[0];
|
||||
if (!File.Exists(targetPath + ".png") && !File.Exists(targetPath + ".jpg"))
|
||||
{
|
||||
Debug.Log(extFiles[i]);
|
||||
string copyPath = extOutPath + fileNameWithExt;
|
||||
File.Copy(extFiles[i], copyPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
Directory.CreateDirectory(artFontPath + "en\\");
|
||||
string[] enFiles = Directory.GetFiles(enDirPath);
|
||||
for (int i = 0; i < enFiles.Length; i++)
|
||||
{
|
||||
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(enFiles[i]);
|
||||
string copyPath = artFontPath + "en\\" + fileNameWithExt;
|
||||
File.Copy(enFiles[i], copyPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("LanguageTool/artFont/重命名中文资源")]
|
||||
private static void AllArtFontAdd_zh()
|
||||
{
|
||||
CheckAllArtFont("_zh", "ArtFont");
|
||||
}
|
||||
|
||||
[MenuItem("LanguageTool/artFont/重命名英文资源")]
|
||||
private static void AllArtFontAdd_en()
|
||||
{
|
||||
CheckAllArtFont("_en", "ArtFont_en");
|
||||
}
|
||||
|
||||
[MenuItem("LanguageTool/artFont/重命名越南语资源")]
|
||||
private static void AllArtFontAdd_vi()
|
||||
{
|
||||
CheckAllArtFont("_vi", "ArtFont_vi");
|
||||
}
|
||||
|
||||
|
||||
[MenuItem("LanguageTool/artFont/重命名图片")]
|
||||
private static void RenameFile()
|
||||
|
@ -1045,36 +1096,6 @@ namespace Assets.Scripts.Editor.LanguageTool
|
|||
Debug.Log("完成");
|
||||
}
|
||||
|
||||
private static void CheckAllArtFont(string artTab, string directoryName)
|
||||
{
|
||||
string dirPath = Environment.CurrentDirectory + "\\Assets\\ManagedResources";
|
||||
Debug.Log(dirPath);
|
||||
|
||||
List<string> dirs = new List<string>(Directory.GetDirectories(dirPath, directoryName, SearchOption.AllDirectories));
|
||||
List<string> artFontDirs = new List<string>();
|
||||
for (int i = 0; i < dirs.Count; i++)
|
||||
{
|
||||
string[] files = Directory.GetFiles(dirs[i]);
|
||||
for (int j = 0; j < files.Length; j++)
|
||||
{
|
||||
string _ex = Path.GetExtension(files[j]);
|
||||
if (_ex.Contains(".meta")) continue;
|
||||
string fileName = Path.GetFileNameWithoutExtension(files[j]);
|
||||
if (fileName.EndsWith(artTab)) continue;
|
||||
if (fileName.EndsWith("_zh") || fileName.EndsWith("_en") || fileName.EndsWith("_vi"))
|
||||
{
|
||||
Debug.Log("文件路径" + files[j]);
|
||||
fileName = fileName.Substring(0, fileName.Length - 3);
|
||||
}
|
||||
fileName = Path.GetDirectoryName(files[j]) + "/" + fileName + artTab + _ex;
|
||||
Debug.Log("文件名:" + fileName);
|
||||
EditorUtility.DisplayProgressBar("遍历图片资源目录", string.Format("正在检索数据:{0}/{1}", i, dirs.Count), (float)i / dirs.Count);
|
||||
File.Move(files[j], fileName);
|
||||
}
|
||||
}
|
||||
EditorUtility.ClearProgressBar();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 175 KiB |
After Width: | Height: | Size: 184 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 173 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 808 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 913 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 899 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 130 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 553 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 462 KiB |
After Width: | Height: | Size: 474 KiB |
After Width: | Height: | Size: 478 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 578 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 31 KiB |