12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.EventSystems;
- using UnityEngine.UI;
- using XRTool.Util;
- public class BackChooseToggle : MonoBehaviour,IPointerEnterHandler, IPointerExitHandler
- {
- private Transform BtnTip;
- private void Awake()
- {
- GetComponent<Toggle>().onValueChanged.AddListener(OnValueChanged);
- BtnTip = UnityUtil.GetBreadthChild<Transform>(transform, "BtnTip");
- }
- private void Start()
- {
- OnValueChanged(GetComponent<Toggle>().isOn);
- }
- private void OnValueChanged(bool value)
- {
- transform.GetChild(0).gameObject.SetActive(value);
- }
- public void OnPointerEnter(PointerEventData eventData)
- {
- if (BtnTip)
- {
- BtnTip.gameObject.SetActive(true);
- }
- }
- public void OnPointerExit(PointerEventData eventData)
- {
- if (BtnTip)
- {
- BtnTip.gameObject.SetActive(false);
- }
- }
- }
|