From 6ab4f430f523d7a85589c7eef9523f6fa6c48aea Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期五, 11 十二月 2020 20:31:55 +0800 Subject: [PATCH] 0312 更新批量文字工具 --- Assets/Editor/Tool/ImportPrefabsWords.cs | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Assets/Editor/Tool/ImportPrefabsWords.cs b/Assets/Editor/Tool/ImportPrefabsWords.cs index fa3ea42..b0590b9 100644 --- a/Assets/Editor/Tool/ImportPrefabsWords.cs +++ b/Assets/Editor/Tool/ImportPrefabsWords.cs @@ -27,6 +27,7 @@ string[] lines = File.ReadAllLines(writePath, Encoding.UTF8); int startIndex = 0; + int changeCnt = 0; EditorApplication.update = delegate () { string[] info = lines[startIndex].Split('\t'); startIndex++; @@ -66,9 +67,16 @@ Text item = transArr[index]; if (item.name == name) { - item.text = content; - EditorUtility.SetDirty(_prefab); - }else + if (item.text != content) + { + item.text = content; + item.fontSize = item.fontSize - 2; + EditorUtility.SetDirty(_prefab); + changeCnt++; + //Debug.LogFormat("瀛椾綋鎵归噺鏂囦欢--{0} , {1}", file, index); + } + } + else { Debug.LogErrorFormat("绗瑊0}琛屾浛鎹㈠け璐1}锛寋2}", startIndex+1, file, name); } @@ -81,6 +89,7 @@ startIndex = 0; AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); + Debug.LogFormat("瀛椾綋鎵归噺淇敼鎴愬姛--{0}", changeCnt); } }; -- Gitblit v1.8.0