diff --git a/Assets/Scripts/Editor/GameEditor/FrameTool/ImportResWindow.cs b/Assets/Scripts/Editor/GameEditor/FrameTool/ImportResWindow.cs index a84cb8749b..513a96afe6 100644 --- a/Assets/Scripts/Editor/GameEditor/FrameTool/ImportResWindow.cs +++ b/Assets/Scripts/Editor/GameEditor/FrameTool/ImportResWindow.cs @@ -143,45 +143,49 @@ namespace GameEditor.Util string[] files = Directory.GetFiles(desPath); for (int i = 0; i < files.Length; i++) { + string sourceExt = Path.GetExtension(files[i]); + if (sourceExt == ".meta") + { + continue; + } string fileName = Path.GetFileName(files[i]); string sourceFileName = Path.GetFileNameWithoutExtension(files[i]); if (sourceFileName.EndsWith("_zh")) { sourceFileName = sourceFileName.Substring(0, sourceFileName.Length - 3); - } - string sourceExt = Path.GetExtension(files[i]); - + } string[] guids = AssetDatabase.FindAssets(sourceFileName + " t:Texture",new string[] { tag1 }); - if (guids == null || guids.Length < 1) - { - continue; - } + bool isReplace = false; - for (int j = 0; j < guids.Length; j++) + if (guids != null && guids.Length > 0) { - string desFilePath = AssetDatabase.GUIDToAssetPath(guids[j]); - string rootPath = Path.GetDirectoryName(desFilePath); - string desfileName = Path.GetFileName(desFilePath); - string desFileNameWithoutExt = Path.GetFileNameWithoutExtension(desFilePath); - if (desFileNameWithoutExt.EndsWith("_zh")) + for (int j = 0; j < guids.Length; j++) { - desFileNameWithoutExt = desFileNameWithoutExt.Substring(0, desFileNameWithoutExt.Length - 3); - } - string desExt = Path.GetExtension(desFilePath); - if (sourceFileName == desFileNameWithoutExt) - { - isReplace = true; - if (sourceExt == desExt) + string desFilePath = AssetDatabase.GUIDToAssetPath(guids[j]); + string rootPath = Path.GetDirectoryName(desFilePath); + string desfileName = Path.GetFileName(desFilePath); + string desFileNameWithoutExt = Path.GetFileNameWithoutExtension(desFilePath); + if (desFileNameWithoutExt.EndsWith("_zh")) { - AssetDatabase.CopyAsset("Assets/ImportFloder/" + fileName, desFilePath); + desFileNameWithoutExt = desFileNameWithoutExt.Substring(0, desFileNameWithoutExt.Length - 3); } - else + string desExt = Path.GetExtension(desFilePath); + if (sourceFileName == desFileNameWithoutExt) { - AssetDatabase.MoveAssetToTrash(desFilePath); - AssetDatabase.MoveAsset("Assets/ImportFloder/" + fileName, rootPath + "/" + fileName); + isReplace = true; + if (sourceExt == desExt) + { + AssetDatabase.CopyAsset("Assets/ImportFloder/" + fileName, desFilePath); + } + else + { + AssetDatabase.MoveAssetToTrash(desFilePath); + AssetDatabase.MoveAsset("Assets/ImportFloder/" + fileName, rootPath + "/" + fileName); + } } } } + if (!isReplace) { AssetDatabase.MoveAsset("Assets/ImportFloder/" + fileName, Path.Combine(tag1, path) + "/" + fileName);