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().position = Input.mousePosition; Level27.Level27Quesition.Instance.isDarg = true; //Level27.Level27Quesition.Instance.PassCheck(this.gameObject); } public void OnPointerDown(PointerEventData eventData) { resetPos = this.transform.GetComponent().position; Debug.Log("点击"); } public void OnPointerUp(PointerEventData eventData) { Level27.Level27Quesition.Instance.PassCheck(this); Level27.Level27Quesition.Instance.isDarg = false; this.transform.GetComponent().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() { } } }