From 8941d8b497a1baf6ec8f16be786743393fba2af4 Mon Sep 17 00:00:00 2001 From: ayuan9957 <107920784+ayuan9957@users.noreply.github.com> Date: Thu, 16 Jul 2026 15:42:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=203D=E6=96=87=E5=AD=97(Text3DCtrl)?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=8C=96+=E8=BD=A6=E8=BE=86=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=8F=90=E7=A4=BA=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Text3DCtrl: SetName使用LocalizationManager.Get翻译,订阅LanguageChanged - StudentSub2EditorPanel: 未规划车辆提示中车辆名称用Get翻译+去除括号后缀 --- Assets/Scripts/GameObjectCtrl/Text3DCtrl.cs | 20 ++++++++++++++++++- .../Student/StudentSub2EditorPanel.cs | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/GameObjectCtrl/Text3DCtrl.cs b/Assets/Scripts/GameObjectCtrl/Text3DCtrl.cs index 658dfcd..9638fe7 100644 --- a/Assets/Scripts/GameObjectCtrl/Text3DCtrl.cs +++ b/Assets/Scripts/GameObjectCtrl/Text3DCtrl.cs @@ -8,6 +8,7 @@ public class Text3DCtrl : MonoBehaviour public LookAtState LookAtState = LookAtState.LookAt; Transform targetTrans; float angleX; + string sourceText; public void SetLayer(string LayerName) { @@ -46,7 +47,8 @@ public class Text3DCtrl : MonoBehaviour public void SetName(string text) { - textMesh.text = text; + sourceText = text; + textMesh.text = LocalizationManager.Get(text); } //选选取的时候 改变文字颜色 @@ -54,6 +56,22 @@ public class Text3DCtrl : MonoBehaviour { textMesh.color = newColor; } + + void Start() + { + LocalizationManager.LanguageChanged += OnLanguageChanged; + } + + private void OnLanguageChanged() + { + if (!string.IsNullOrEmpty(sourceText)) + textMesh.text = LocalizationManager.Get(sourceText); + } + + void OnDestroy() + { + LocalizationManager.LanguageChanged -= OnLanguageChanged; + } } public enum LookAtState diff --git a/Assets/Scripts/UIScripts/Student/StudentSub2EditorPanel.cs b/Assets/Scripts/UIScripts/Student/StudentSub2EditorPanel.cs index 05c5c06..d73a5a7 100644 --- a/Assets/Scripts/UIScripts/Student/StudentSub2EditorPanel.cs +++ b/Assets/Scripts/UIScripts/Student/StudentSub2EditorPanel.cs @@ -308,7 +308,7 @@ public class StudentSub2EditorPanel : BasePanel { if (carCtrls[i].CarState != CarState.opened) { - prompt_editorOverButton.SetPrompt(LocalizationManager.Format("存在未规划的车辆{0}!", carCtrls[i].gameObject.name), Color.red, 3); + prompt_editorOverButton.SetPrompt(LocalizationManager.Format("存在未规划的车辆{0}!", LocalizationManager.Get(carCtrls[i].gameObject.name.Split('(')[0])), Color.red, 3); return; } }