Advertisement
tinchopunk

Untitled

Jun 13th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using AC;
  6.  
  7. public class LanguajeSelection : MonoBehaviour
  8. {
  9. public Font myNewFont;
  10. public Font oldFont;
  11.  
  12. private void OnEnable()
  13. {
  14. EventManager.OnChangeLanguage += OnChangeLanguage;
  15. }
  16.  
  17.  
  18. private void OnDisable()
  19. {
  20. EventManager.OnChangeLanguage -= OnChangeLanguage;
  21. }
  22.  
  23.  
  24. private void OnChangeLanguage(int languageIndex)
  25. {
  26. if (languageIndex == 2)
  27. {
  28.  
  29. Menu[] allMenus = PlayerMenus.GetMenus().ToArray();
  30. foreach (Menu menu in allMenus)
  31. {
  32. Text[] texts = menu.canvas.GetComponentInChildren<Text>();
  33. foreach (Text text in texts)
  34. {
  35. text.font = myNewFont;
  36. }
  37. }
  38.  
  39.  
  40. Debug.Log("Aca tiene que cambiar la fuente");
  41. }
  42. else
  43. {
  44. Menu[] allMenus = PlayerMenus.GetMenus().ToArray();
  45. foreach (Menu menu in allMenus)
  46. {
  47. Text[] texts = menu.canvas.GetComponentInChildren<Text>();
  48. foreach (Text text in texts)
  49. {
  50. text.font = oldFont;
  51. }
  52. }
  53.  
  54. Debug.Log("estamos parlando otra cosa así que no se necesita cambiar a la normal");
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement