PlayAreaNotEnoughUI.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. public class PlayAreaNotEnoughUI : MonoBehaviour
  5. {
  6. public Action OnSwitchToStationaryAreaClick
  7. {
  8. get;
  9. set;
  10. }
  11. public Action OnRedrawAreaClick
  12. {
  13. get;
  14. set;
  15. }
  16. public Action OnBackClick
  17. {
  18. get;
  19. set;
  20. }
  21. public Button redrawButton;
  22. public Button switchToStationaryAreaButton;
  23. public Button backButton;
  24. public Text playAreaNotEnoughTitleText;
  25. public Text playAreaNotEnoughDescribeText;
  26. public Text redrawBtnText;
  27. public Text stationaryAreaBtnText;
  28. public void Init()
  29. {
  30. redrawButton.onClick.AddListener(()=>
  31. {
  32. OnRedrawAreaClick();
  33. });
  34. switchToStationaryAreaButton.onClick.AddListener(()=>
  35. {
  36. OnSwitchToStationaryAreaClick?.Invoke();
  37. });
  38. backButton.onClick.AddListener(()=>
  39. {
  40. OnBackClick?.Invoke();
  41. });
  42. SafetyAreaLanguageManager.Instance.onLanguageChange += ChangeLanguageText;
  43. ChangeLanguageText();
  44. }
  45. public void ChangeLanguageText()
  46. {
  47. playAreaNotEnoughTitleText.text = SafetyAreaLanguageManager.Instance.GetWord(106023);
  48. playAreaNotEnoughDescribeText.text = SafetyAreaLanguageManager.Instance.GetWord(106024);
  49. redrawBtnText.text = SafetyAreaLanguageManager.Instance.GetWord(106027);
  50. stationaryAreaBtnText.text = SafetyAreaLanguageManager.Instance.GetWord(106022);
  51. }
  52. public void Release()
  53. {
  54. redrawButton.onClick.RemoveAllListeners();
  55. switchToStationaryAreaButton.onClick.RemoveAllListeners();
  56. backButton.onClick.RemoveAllListeners();
  57. SafetyAreaLanguageManager.Instance.onLanguageChange -= ChangeLanguageText;
  58. }
  59. }