WXMC/.svn/pristine/82/82d0fcedc5ffdb0ab6f78c6bd25d0381cd1c3aea.svn-base

39 lines
856 B
Plaintext
Raw Permalink Normal View History

2024-12-04 16:18:46 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class WishGodUI : MonoBehaviour, IDragHandler, IBeginDragHandler
{
Vector3 worldPos;
Vector3 offset;
public void OnBeginDrag(PointerEventData eventData)
{
if (RectTransformUtility.ScreenPointToWorldPointInRectangle(transform.GetComponent<RectTransform>(), Input.mousePosition
, eventData.enterEventCamera, out worldPos))
{
offset = transform.position - worldPos;
}
}
public void OnDrag(PointerEventData eventData)
{
transform.position = offset + Input.mousePosition;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}