TextLanguageMono.cs 663 B

12345678910111213141516171819202122232425262728
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using Core.Language;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class TextLanguageMono : MonoBehaviour
  7. {
  8. public int id;
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12. Text text = gameObject.GetComponent<Text>();
  13. if (text != null)
  14. {
  15. text.text = LanguageManager.Instance.Text(id);
  16. }
  17. else
  18. {
  19. TextMesh textMesh = gameObject.GetComponent<TextMesh>();
  20. if (textMesh != null)
  21. {
  22. textMesh.text = LanguageManager.Instance.Text(id);
  23. }
  24. }
  25. }
  26. }