// using UnityEngine; // using UnityEngine.EventSystems; // // namespace AlicizaX.UI.Extension // { // public class UI3DDisplayTouch : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IDragHandler // { // private GameObject m_dragObject; // private bool m_CanDrag = true; // private float m_DragSpeed = 20.0f; // private float m_DragRotation; // private Vector3 m_ShowRotation = Vector3.zero; // private Transform view; // // public void SetObject(GameObject obj) // { // m_dragObject = obj; // m_ShowRotation = obj.transform.eulerAngles; // view = obj.GetComponent(); // } // // public void Disopose() // { // m_dragObject = null; // view = null; // } // // //拖拽 // public void OnDrag(PointerEventData eventData) // { // if (!m_CanDrag) return; // if (!view) return; // if (!m_dragObject || !(m_DragSpeed > 0.0f)) return; // // var delta = eventData.delta.x; // var deltaRot = -m_DragSpeed * delta * Time.deltaTime; // // m_DragRotation += deltaRot; // var showRotation = Quaternion.Euler(m_ShowRotation); // var showUp = showRotation * Vector3.up; // showRotation *= Quaternion.AngleAxis(m_DragRotation, showUp); // view.rotation = showRotation; // } // // //按下 // public void OnPointerDown(PointerEventData eventData) // { // } // // //抬起 // public void OnPointerUp(PointerEventData eventData) // { // } // } // }