From 199ea5b84cfe132d78d59749bbd6d0660bae7edd Mon Sep 17 00:00:00 2001 From: vurtne14 Date: Wed, 26 Mar 2025 15:32:18 +0800 Subject: [PATCH] 1 --- Assets/ztest/Editor/MoveFile.cs | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/Assets/ztest/Editor/MoveFile.cs b/Assets/ztest/Editor/MoveFile.cs index 3a2394aac..e192b105c 100644 --- a/Assets/ztest/Editor/MoveFile.cs +++ b/Assets/ztest/Editor/MoveFile.cs @@ -42,12 +42,38 @@ public class MoveFile } AssetDatabase.Refresh(); // 刷新AssetDatabase以显示更改 } + [MenuItem("Tools/复制缺失图片到对应文件夹")] + static void CopySelectedAssets() + { + string[] selectedPaths_vn = AssetDatabase.FindAssets("t:Texture2D", new[] { "Assets/ManagedResources/ArtFont_vn" }); + foreach (string guid in selectedPaths_vn) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + if (path.EndsWith("_vn.png")) + { + string path_en = path.Replace("_vn.png", "_en.png"); + path_en = path_en.Replace("ArtFont_vn", "ArtFont_en"); + string results = AssetDatabase.AssetPathToGUID(path_en); + if (string.IsNullOrEmpty(results)) + { + string[] split = path.Split('/'); + string[] zhresults = AssetDatabase.FindAssets(split[split.Length-1].Replace("_vn.png", "_zh")); + if (zhresults.Length > 0) + { + string oldPath = AssetDatabase.GUIDToAssetPath(zhresults[0]); + string newPath = oldPath.Replace("ArtFont_zh", "ArtFont_temp"); + string forlder = newPath.Substring(0, newPath.LastIndexOf("/")); + Directory.CreateDirectory(forlder); + AssetDatabase.CopyAsset(oldPath, newPath); + } + } + } + } + } [MenuItem("Tools/比对韩语和英文差异")] static void CheckVnEn() { string[] selectedPaths_vn = AssetDatabase.FindAssets("t:Texture2D", new[] { "Assets/ManagedResources/ArtFont_vn" }); - //string targetFolderPath = "Assets/NewFolder"; // 目标文件夹路径 - //Directory.CreateDirectory(targetFolderPath); // 确保文件夹存在 StringBuilder sb = new StringBuilder(); foreach (string guid in selectedPaths_vn) { @@ -60,7 +86,7 @@ public class MoveFile if (string.IsNullOrEmpty(results)) { string[] split = path.Split('/'); - sb.Append(split[split.Length-1]+"\n"); + sb.Append(split[split.Length - 1] + "\n"); } } }