56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.EventSystems;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ťԤ<C5A5><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>UI<55>ᴩ<E1B4A9><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public class BtnPreHandler : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
|
|||
|
|
{
|
|||
|
|
Vector3 defaultScale;
|
|||
|
|
|
|||
|
|
GameObject enterObject;
|
|||
|
|
|
|||
|
|
float scaleSize = 1.1f;
|
|||
|
|
|
|||
|
|
//public void OnPointerEnter(PointerEventData eventData)
|
|||
|
|
//{
|
|||
|
|
// if (!H5Controller.IsMobileBroswer())
|
|||
|
|
// {
|
|||
|
|
// enterObject = eventData.pointerEnter;
|
|||
|
|
// defaultScale = enterObject.transform.localScale;
|
|||
|
|
// enterObject.transform.localScale *= scaleSize;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//public void OnPointerExit(PointerEventData eventData)
|
|||
|
|
//{
|
|||
|
|
// if (enterObject != null)
|
|||
|
|
// {
|
|||
|
|
// enterObject.transform.localScale = defaultScale;
|
|||
|
|
// enterObject = null;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
public void OnPointerDown(PointerEventData eventData)
|
|||
|
|
{
|
|||
|
|
BaseController.IsUIClicked = true;
|
|||
|
|
BaseController.CanControl = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void OnPointerUp(PointerEventData eventData)
|
|||
|
|
{
|
|||
|
|
BaseController.IsUIClicked = false;
|
|||
|
|
Invoke("EnableClick", 0.2f);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void EnableClick()
|
|||
|
|
{
|
|||
|
|
if (!BaseController.CanControl)
|
|||
|
|
{
|
|||
|
|
BaseController.CanControl = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|