GroundHeightUI.cs 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 void Init()
  25. {
  26. confirmButton.onClick.AddListener(() =>
  27. {
  28. OnConfirmClick?.Invoke();
  29. });
  30. cancelButton.onClick.AddListener(() =>
  31. {
  32. OnCancelClick?.Invoke();
  33. });
  34. resetButton.onClick.AddListener(() =>
  35. {
  36. OnResetClick?.Invoke();
  37. });
  38. }
  39. public void Release()
  40. {
  41. confirmButton.onClick.RemoveAllListeners();
  42. cancelButton.onClick.RemoveAllListeners();
  43. resetButton.onClick.RemoveAllListeners();
  44. }
  45. }