GroundHeightUI.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. public class GroundHeightUI : MonoBehaviour
  5. {
  6. public Action OnConfirmClick
  7. {
  8. get;
  9. set;
  10. }
  11. public Action OnCancelClick
  12. {
  13. get;
  14. set;
  15. }
  16. public Action OnResetClick
  17. {
  18. get;
  19. set;
  20. }
  21. public Button confirmButton;
  22. public Button cancelButton;
  23. public Button resetButton;
  24. public Text confirmGroundHeightTitleText;
  25. public Text confirmGroundHeightDescribeText;
  26. public Text resetBtnText;
  27. public Text confirmBtnText;
  28. public void Init()
  29. {
  30. confirmButton.onClick.AddListener(() =>
  31. {
  32. OnConfirmClick?.Invoke();
  33. });
  34. cancelButton.onClick.AddListener(() =>
  35. {
  36. OnCancelClick?.Invoke();
  37. });
  38. resetButton.onClick.AddListener(() =>
  39. {
  40. OnResetClick?.Invoke();
  41. });
  42. SafetyAreaLanguageManager.Instance.onLanguageChange += ChangeLanguageText;
  43. ChangeLanguageText();
  44. }
  45. public void ChangeLanguageText()
  46. {
  47. confirmGroundHeightTitleText.text = SafetyAreaLanguageManager.Instance.GetWord(106018);
  48. confirmGroundHeightDescribeText.text = SafetyAreaLanguageManager.Instance.GetWord(106020);
  49. resetBtnText.text = SafetyAreaLanguageManager.Instance.GetWord(10081);
  50. confirmBtnText.text = SafetyAreaLanguageManager.Instance.GetWord(106018);
  51. }
  52. public void Release()
  53. {
  54. confirmButton.onClick.RemoveAllListeners();
  55. cancelButton.onClick.RemoveAllListeners();
  56. resetButton.onClick.RemoveAllListeners();
  57. SafetyAreaLanguageManager.Instance.onLanguageChange -= ChangeLanguageText;
  58. }
  59. }