1、
using HTC.UnityPlugin.Vive;
using UnityEngine;
using UnityEngine.EventSystems;
using System;
using System.Collections.Generic;
using System.Collections;
public class ShowShenFenInfo : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
private HashSet<PointerEventData> hovers = new HashSet<PointerEventData>();
public void OnPointerEnter(PointerEventData eventData)
{
if (hovers.Add(eventData) && hovers.Count ==1)
{
Debug.Log("jinru");
}
}
public void OnPointerExit(PointerEventData eventData)
{
if (hovers.Remove(eventData) && hovers.Count == 0)
{
Debug.Log("likai");
}
}
public void OnPointerClick(PointerEventData eventData) {
var viveEventData = eventData as VivePointerEventData;
if (viveEventData != null)
{
if (viveEventData.viveButton == ControllerButton.Pad)
{
Debug.Log("Pad");
}
}
else if (eventData != null)
{
if (eventData.button == PointerEventData.InputButton.Left)
{
Debug.Log("左键");
}
}
}
}
网友评论