From 646c6e89a51e17e1a953fb41b4137ac39405523a Mon Sep 17 00:00:00 2001 From: ayuan9957 <107920784+ayuan9957@users.noreply.github.com> Date: Mon, 20 Jul 2026 10:10:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AA=81=E5=8F=91=E6=83=85=E5=86=B5?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=AE=9E=E6=97=B6=E7=BF=BB=E8=AF=91=20-=20?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E9=80=89=E9=A1=B9/=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E8=AE=B0=E5=BD=95/=E6=AD=A3=E7=A1=AE=E7=AD=94=E6=A1=88?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=85=A8=E9=83=A8=E6=9C=AC=E5=9C=B0=E5=8C=96?= =?UTF-8?q?,=20=E7=AD=94=E9=A2=98=E5=90=8E=E5=8F=8D=E6=9F=A5=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E4=B8=AD=E6=96=87key=E4=BF=9D=E6=8C=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIScripts/Student/Mono/AnserWindowCtrl.cs | 2 +- .../UIScripts/Student/Sub1LearnPanel.cs | 30 +++++++++----- Assets/StreamingAssets/Localization.xml | 41 +++++++++++++++++++ 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/UIScripts/Student/Mono/AnserWindowCtrl.cs b/Assets/Scripts/UIScripts/Student/Mono/AnserWindowCtrl.cs index 1c181ab..256a08f 100644 --- a/Assets/Scripts/UIScripts/Student/Mono/AnserWindowCtrl.cs +++ b/Assets/Scripts/UIScripts/Student/Mono/AnserWindowCtrl.cs @@ -112,7 +112,7 @@ public class AnserWindowCtrl : MonoBehaviour //选择错误时 显示答题结果 public void ShowRightResult(string msg) { - promptText.SetPrompt(LocalizationManager.Format("选择错误,应{0}", msg), Color.red, 2.5f); + promptText.SetPrompt(LocalizationManager.Format("选择错误,应{0}", LocalizationManager.Get(msg)), Color.red, 2.5f); } diff --git a/Assets/Scripts/UIScripts/Student/Sub1LearnPanel.cs b/Assets/Scripts/UIScripts/Student/Sub1LearnPanel.cs index 45e6744..4b071fa 100644 --- a/Assets/Scripts/UIScripts/Student/Sub1LearnPanel.cs +++ b/Assets/Scripts/UIScripts/Student/Sub1LearnPanel.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; @@ -90,9 +90,9 @@ public class Sub1LearnPanel : BasePanel List options = new List(); foreach (var item in tufaMsg.options) { - options.Add(item.Key); + options.Add(LocalizationManager.Get(item.Key)); } - answerWindow.SetAskAndAnswer(tuFa.ToString(), options, AnswerEvent); + answerWindow.SetAskAndAnswer(LocalizationManager.Get(tuFa.ToString()), options, AnswerEvent); if (AdjustingManager.Instance.Adjusting)//导调状态下遇到突发事件发送消息到教员端 { @@ -107,28 +107,38 @@ public class Sub1LearnPanel : BasePanel // 完成答题时 检查选项是否最佳选项以及当前选项对应的罚时 并恢复车辆移动 导调模式下发送事件信息到教员端 void AnswerEvent(string selectOperations) { - bool isRightOption = selectOperations == tufaMsg.rightOption; - int takeTime = tufaMsg.options[selectOperations]; + // Find the original Chinese key from the displayed (localized) text + string selectedKey = selectOperations; + foreach (var item in tufaMsg.options) + { + if (LocalizationManager.Get(item.Key) == selectOperations) + { + selectedKey = item.Key; + break; + } + } + bool isRightOption = selectedKey == tufaMsg.rightOption; + int takeTime = tufaMsg.options[selectedKey]; time -= takeTime * 60;//takeTime为负数 if (isRightOption)//正确处理方式不记录罚时 { - StudentOperateRecorder.Instance.InjectOperateMsg($"行军过程中遇到{tuFa.ToString()},选择处理方式为{selectOperations}"); + StudentOperateRecorder.Instance.InjectOperateMsgLocalized("行军过程中遇到{0},选择处理方式为{1}", tuFa.ToString(), selectedKey); } else - StudentOperateRecorder.Instance.InjectOperateMsg($"行军过程中遇到{tuFa.ToString()},选择处理方式为{selectOperations},罚时{takeTime}分钟"); + StudentOperateRecorder.Instance.InjectOperateMsgLocalized("行军过程中遇到{0},选择处理方式为{1},罚时{2}分钟", tuFa.ToString(), selectedKey, Mathf.Abs(takeTime)); - if (AdjustingManager.Instance.Adjusting)//导调状态下遇到突发事件发送消息到教员端 + if (AdjustingManager.Instance.Adjusting)//导调状态下遇到突发事件发送事件信息到教员端 { NetTuFaHandleMsg msg = new NetTuFaHandleMsg(); if (isRightOption) { msg.msgType = TuFaMsgType.handleRight; - msg.msg = $"{ selectOperations}"; + msg.msg = $"{ selectedKey}"; } else { msg.msgType = TuFaMsgType.handleWrong; - msg.msg = $"{ selectOperations},罚时{takeTime}分钟"; + msg.msg = $"{ selectedKey},罚时{takeTime}分钟"; } TCPManager.Instance.SendNetMsg(msg, NetMsgName.TuFaEvent); } diff --git a/Assets/StreamingAssets/Localization.xml b/Assets/StreamingAssets/Localization.xml index 71cf2cf..8b87572 100644 --- a/Assets/StreamingAssets/Localization.xml +++ b/Assets/StreamingAssets/Localization.xml @@ -452,4 +452,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +