ToggleShowBtnTip.cs 950 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using XRTool.UI;
  6. using UnityEngine.UI;
  7. using XRTool.Util;
  8. public class ToggleShowBtnTip : UnitySingleton<ToggleShowBtnTip>, IPointerEnterHandler, IPointerExitHandler
  9. {
  10. public GameObject BtnTip;
  11. public Text BtnTiptext;
  12. public ToggleButton toggleButton;
  13. public void OnPointerEnter(PointerEventData eventData)
  14. {
  15. if (BtnTip && toggleButton && BtnTiptext != null)
  16. {
  17. BtnTip.gameObject.SetActive(true);
  18. if (!toggleButton.isOn)
  19. {
  20. BtnTiptext.text = "缩放";
  21. }
  22. else
  23. {
  24. BtnTiptext.text = "拉伸";
  25. }
  26. }
  27. }
  28. public void OnPointerExit(PointerEventData eventData)
  29. {
  30. if (BtnTip && toggleButton)
  31. {
  32. BtnTip.gameObject.SetActive(false);
  33. }
  34. }
  35. }