You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
using UnityEngine.EventSystems;
|
|
using UnityEngine;
|
|
|
|
namespace Level27
|
|
{
|
|
public class DragItemH : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler
|
|
{
|
|
|
|
private Vector2 resetPos;
|
|
public string ItemName = "";
|
|
|
|
public void OnDrag(PointerEventData eventData)
|
|
{
|
|
this.transform.GetComponent<RectTransform>().position = Input.mousePosition;
|
|
Level27.Level27Quesition.Instance.isDarg = true;
|
|
|
|
//Level27.Level27Quesition.Instance.PassCheck(this.gameObject);
|
|
|
|
}
|
|
|
|
public void OnPointerDown(PointerEventData eventData)
|
|
{
|
|
resetPos = this.transform.GetComponent<RectTransform>().position;
|
|
Debug.Log("点击");
|
|
}
|
|
|
|
public void OnPointerUp(PointerEventData eventData)
|
|
{
|
|
Level27.Level27Quesition.Instance.PassCheck(this);
|
|
Level27.Level27Quesition.Instance.isDarg = false;
|
|
this.transform.GetComponent<RectTransform>().position = new Vector3(resetPos.x, resetPos.y, 0);
|
|
resetPos = Vector2.zero;
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
|