39 lines
856 B
Plaintext
39 lines
856 B
Plaintext
|
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()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|