LoginLangController.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TMPro;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. /* 本段代码控制登录页面语言设置
  7. */
  8. public class LoginLangController : MonoBehaviour
  9. {
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. //login 场景canvas语言配置
  14. LoginCanvasLangSetting();
  15. }
  16. // Update is called once per frame
  17. //void Update()
  18. //{
  19. //}
  20. void LoginCanvasLangSetting()
  21. {
  22. //读取Login Canvas语言设定
  23. string textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "canvas", "login", "button", "login", EnviromentSetting.languageCode });
  24. GameObject.Find("Login Button").GetComponentInChildren<TextMeshProUGUI>().text = textValue;
  25. textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "canvas", "login", "button", "forget_password", EnviromentSetting.languageCode });
  26. GameObject.Find("Forget Password Button").GetComponentInChildren<TextMeshProUGUI>().text = textValue;
  27. textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "canvas", "login", "button", "quick_start", EnviromentSetting.languageCode });
  28. GameObject.Find("Quick Start Button").GetComponentInChildren<TextMeshProUGUI>().text = textValue;
  29. textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "canvas", "login", "label", "user_name", EnviromentSetting.languageCode });
  30. GameObject.Find("User Name").GetComponentInChildren<TextMeshProUGUI>().text = textValue;
  31. textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "canvas", "login", "label", "password", EnviromentSetting.languageCode });
  32. GameObject.Find("Password").GetComponentInChildren<TextMeshProUGUI>().text = textValue;
  33. textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "canvas", "login", "place_holder", "user_name", EnviromentSetting.languageCode });
  34. GameObject.Find("UserName Placeholder").GetComponentInChildren<TextMeshProUGUI>().text = textValue;
  35. textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "canvas", "login", "place_holder", "password", EnviromentSetting.languageCode });
  36. GameObject.Find("Password Placeholder").GetComponentInChildren<TextMeshProUGUI>().text = textValue;
  37. }
  38. }