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