OutOfSafetyAreaUI.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class OutOfSafetyAreaUI : MonoBehaviour
  6. {
  7. public Button safetyAreaButton;
  8. public Button stationaryAreaButton;
  9. public Text outOfSafetyAreaTitleText;
  10. public Text outOfSafetyAreaDescribeText;
  11. public Text safetyPlayAreaBtnText;
  12. public Text stationaryAreaBtnText;
  13. // Start is called before the first frame update
  14. private void Start()
  15. {
  16. safetyAreaButton.onClick.AddListener(OnSafetyAreaButtonClick);
  17. stationaryAreaButton.onClick.AddListener(OnStationaryAreaButtonClick);
  18. }
  19. private void OnDestroy()
  20. {
  21. safetyAreaButton.onClick.RemoveListener(OnSafetyAreaButtonClick);
  22. stationaryAreaButton.onClick.RemoveListener(OnStationaryAreaButtonClick);
  23. }
  24. private void OnEnable()
  25. {
  26. SafetyAreaLanguageManager.Instance.onLanguageChange += ChangeLanguageText;
  27. ChangeLanguageText();
  28. }
  29. private void OnDisable()
  30. {
  31. SafetyAreaLanguageManager.Instance.onLanguageChange -= ChangeLanguageText;
  32. }
  33. private void OnSafetyAreaButtonClick()
  34. {
  35. SafetyAreaManager.Instance.StartSetSafetyArea();
  36. }
  37. private void OnStationaryAreaButtonClick()
  38. {
  39. SafetyAreaManager.Instance.StartSetSafetyArea(new object());
  40. SafetyAreaManager.Instance.ChangeStep(SafetyAreaStepEnum.StationaryArea);
  41. }
  42. public void ChangeLanguageText()
  43. {
  44. outOfSafetyAreaTitleText.text = SafetyAreaLanguageManager.Instance.GetWord(106029);
  45. outOfSafetyAreaDescribeText.text = SafetyAreaLanguageManager.Instance.GetWord(106030);
  46. safetyPlayAreaBtnText.text = SafetyAreaLanguageManager.Instance.GetWord(106028);
  47. stationaryAreaBtnText.text = SafetyAreaLanguageManager.Instance.GetWord(106022);
  48. }
  49. }