diff --git a/Assets/Scripts/Editor/LanguageTool/LanguageTool.cs b/Assets/Scripts/Editor/LanguageTool/LanguageTool.cs index e1db8f9591..f4b662b17b 100644 --- a/Assets/Scripts/Editor/LanguageTool/LanguageTool.cs +++ b/Assets/Scripts/Editor/LanguageTool/LanguageTool.cs @@ -637,6 +637,7 @@ namespace Assets.Scripts.Editor.LanguageTool { return; } + bool isReplace = false; string[] wlines = new string[lines.Length - 1]; string lastLine = ""; for (int lIndex = 0; lIndex < lines.Length; lIndex++) @@ -655,6 +656,7 @@ namespace Assets.Scripts.Editor.LanguageTool s = s.Replace("\\n", "\n"); int id = AddLData(s); lines[lIndex] = lines[lIndex].Replace(mc[mi].Value, "Language[" + id + "]"); + isReplace = true; } } } @@ -668,8 +670,11 @@ namespace Assets.Scripts.Editor.LanguageTool wlines[lIndex] = lines[lIndex]; } } - File.WriteAllLines(path, wlines, System.Text.Encoding.UTF8); - File.AppendAllText(path, lastLine, System.Text.Encoding.UTF8); + if (isReplace) + { + File.WriteAllLines(path, wlines, System.Text.Encoding.UTF8); + File.AppendAllText(path, lastLine, System.Text.Encoding.UTF8); + } } // 遍历lua文件的每一行找到 中文数据并替换 private static void RevertLuaPath(string path, Dictionary o)