123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using UnityEngine;
- using UnityEngine.EventSystems;
- public class uGUIPanel : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IEventSystemHandler
- {
- private void OnHover(bool isOver)
- {
- GameMain.Instance.MainCamera.gameObject.SendMessage("OnHover", isOver, SendMessageOptions.DontRequireReceiver);
- }
- public void OnPointerEnter(PointerEventData eventData)
- {
- this.OnHover(false);
- this.isEnter = true;
- }
- public void OnPointerExit(PointerEventData eventData)
- {
- if (this.isEnter)
- {
- this.OnHover(true);
- this.isEnter = false;
- }
- }
- private void Update()
- {
- if (this.isEnter && GameMain.Instance.MainCamera.IsFallThrough)
- {
- this.OnHover(false);
- }
- }
- private bool isEnter;
- }
|