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; + } }