49 lines
1.0 KiB
C#
49 lines
1.0 KiB
C#
|
using UnityEngine;
|
|||
|
using System.Collections;
|
|||
|
using UnityEngine.EventSystems;
|
|||
|
using System;
|
|||
|
|
|||
|
public class UseItemBtn : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
|
|||
|
|
|||
|
public float pressTime = 0.0f;
|
|||
|
public bool isDown = false;
|
|||
|
|
|||
|
public float ClickTime = 0.0f;
|
|||
|
|
|||
|
public float lastTime = 1.0f;
|
|||
|
|
|||
|
public void OnPointerDown(PointerEventData eventData)
|
|||
|
{
|
|||
|
if (isDown == false)
|
|||
|
{
|
|||
|
isDown = true;
|
|||
|
ClickTime = Time.time;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnPointerUp(PointerEventData eventData)
|
|||
|
{
|
|||
|
if (isDown == true)
|
|||
|
{
|
|||
|
isDown = false;
|
|||
|
pressTime = 0.0f;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Update is called once per frame
|
|||
|
void Update()
|
|||
|
{
|
|||
|
if(isDown)
|
|||
|
{
|
|||
|
if(Time.time - ClickTime >= lastTime)
|
|||
|
{
|
|||
|
if(SkillBarLogic.Instance()!=null)
|
|||
|
SkillBarLogic.Instance().ShowItemList();
|
|||
|
isDown = false;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|