From d3d2d765de1c7cd7d315bbbdc0b755a3048a2cfb Mon Sep 17 00:00:00 2001 From: ayuan9957 <107920784+ayuan9957@users.noreply.github.com> Date: Thu, 23 Jul 2026 10:59:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=B9=E7=AA=97=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E7=BF=BB=E8=AF=91=20-=20PromptWindowInitData?= =?UTF-8?q?=E6=96=B0=E5=A2=9Ekey+args=E6=9E=84=E9=80=A0=E5=87=BD=E6=95=B0,?= =?UTF-8?q?=20SetFormatted=E4=BF=9D=E7=95=99=E5=8E=9F=E5=A7=8Bkey=E4=BE=9B?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=88=87=E6=8D=A2=E6=97=B6=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIScripts/Teacher/Subject1EditorCtrl.cs | 2 +- .../UIScripts/Teacher/Subject2EditorCtrl.cs | 2 +- .../ThisProjectPublic/PromptWindows.cs | 20 ++++++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/UIScripts/Teacher/Subject1EditorCtrl.cs b/Assets/Scripts/UIScripts/Teacher/Subject1EditorCtrl.cs index 0bdfaf8..5bbfeeb 100644 --- a/Assets/Scripts/UIScripts/Teacher/Subject1EditorCtrl.cs +++ b/Assets/Scripts/UIScripts/Teacher/Subject1EditorCtrl.cs @@ -80,7 +80,7 @@ public class Subject1EditorCtrl : SubjectEditorBase if (result) { - Push(new PromptWindows()).Change(new PromptWindowInitData(LocalizationManager.Format("想定文件生成成功!文件路径为:{0}", path), null)); + Push(new PromptWindows()).Change(new PromptWindowInitData("想定文件生成成功!文件路径为:{0}", new object[] { path }, null)); } } diff --git a/Assets/Scripts/UIScripts/Teacher/Subject2EditorCtrl.cs b/Assets/Scripts/UIScripts/Teacher/Subject2EditorCtrl.cs index 0b1bcbd..35ac7f5 100644 --- a/Assets/Scripts/UIScripts/Teacher/Subject2EditorCtrl.cs +++ b/Assets/Scripts/UIScripts/Teacher/Subject2EditorCtrl.cs @@ -165,7 +165,7 @@ public class Subject2EditorCtrl : SubjectEditorBase bool result= XmlHelper.SerializeObjectXML(recordClass, typeof(Sub2RecordClass), path); if (result) { - Push(new PromptWindows()).Change(new PromptWindowInitData(LocalizationManager.Format("想定文件生成成功!文件路径为:{0}", path), null)); + Push(new PromptWindows()).Change(new PromptWindowInitData("想定文件生成成功!文件路径为:{0}", new object[] { path }, null)); } } diff --git a/Assets/Scripts/UIScripts/ThisProjectPublic/PromptWindows.cs b/Assets/Scripts/UIScripts/ThisProjectPublic/PromptWindows.cs index da7a6b8..a53ff0a 100644 --- a/Assets/Scripts/UIScripts/ThisProjectPublic/PromptWindows.cs +++ b/Assets/Scripts/UIScripts/ThisProjectPublic/PromptWindows.cs @@ -31,13 +31,22 @@ public class PromptWindows : BasePanel public override void Change(object newData) { PromptWindowInitData initData = (PromptWindowInitData)newData; - ShowPromptWindow(initData.showMsg); + if (!string.IsNullOrEmpty(initData.formatKey)) + { + LocalizationManager.SetFormatted(text_msg, initData.formatKey, initData.formatArgs); + } + else + { + ShowPromptWindow(initData.showMsg); + } buttonSure = initData.buttonSure;//注册确定事件 } void ShowPromptWindow(string value) { + // If the value is already localized (from Format/Get), set directly. + // RefreshAll will handle re-translation if the source key is found. text_msg.text = value; } @@ -65,10 +74,19 @@ public class PromptWindowInitData { public string showMsg; public UnityAction buttonSure;//确认操作按钮 + public string formatKey; // localization key for SetFormatted + public object[] formatArgs; // args for SetFormatted public PromptWindowInitData(string msg, UnityAction action) { showMsg = msg; buttonSure = action; } + + public PromptWindowInitData(string locKey, object[] args, UnityAction action) + { + formatKey = locKey; + formatArgs = args; + buttonSure = action; + } }