using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class DTKR_Down : UIBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
{
public bool isPointerDown = false;
public bool longPressTriggered = false;
public float timePressStarted;
private void Update()
{
if (isPointerDown && !longPressTriggered)
{
Debug.Log("按下了");
DTKR_DTKZ.Instance.Point_Down();//传递 一直按下的值
}
}
public void OnPointerDown(PointerEventData eventData)
{
timePressStarted = Time.time;
isPointerDown = true;
longPressTriggered = false;
}
public void OnPointerUp(PointerEventData eventData)
{
longPressTriggered = true;
isPointerDown = false;
}
public void OnPointerExit(PointerEventData eventData)
{
isPointerDown = false;
}
}
unity Unity UI按钮 长按 简单实现
猜你喜欢
转载自blog.csdn.net/qq_37524903/article/details/128422902
今日推荐
周排行