28 lines
641 B
C#
28 lines
641 B
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.EventSystems;
|
||
|
||
/// <summary>
|
||
/// 按钮预处理,解决在手机浏览器中点击UI会穿透的问题
|
||
/// </summary>
|
||
public class BtnPreHandler2 : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
|
||
{
|
||
public void OnPointerDown(PointerEventData eventData)
|
||
{
|
||
BaseController.CanControl = true;
|
||
}
|
||
|
||
public void OnPointerUp(PointerEventData eventData)
|
||
{
|
||
Invoke("EnableClick", 0.2f);
|
||
}
|
||
|
||
void EnableClick()
|
||
{
|
||
if (!BaseController.CanControl)
|
||
{
|
||
BaseController.CanControl = true;
|
||
}
|
||
}
|
||
} |