// //-------------------------------------------------------- // // [Author]: 第二世界 // // [ Date ]: Sunday, September 10, 2017 // //-------------------------------------------------------- // using UnityEngine; // using System.Collections; // using UnityEngine.UI; // using UnityEngine.EventSystems; // using System; // namespace vnxbqy.UI // { // public class UI3DModelInteractProcessor : MonoBehaviour // { // public event Action clickEvent; // public event Action beginDragEvent; // public event Action endDragEvent; // public event Action dragingEvent; // RectTransform m_RectTransform; // public RectTransform rectTransform { // get { return m_RectTransform; } // set { // m_RectTransform = value; // } // } // bool isDown = false; // float downTime = 0f; // private void LateUpdate() // { // if (Input.GetMouseButtonDown(0)) // { // OnPointerDown(); // } // if (Input.GetMouseButton(0)) // { // OnPointerDrag(); // } // if (Input.GetMouseButtonUp(0)) // { // OnPointerUp(); // } // } // void OnPointerDown() // { // if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, CameraManager.uiCamera)) // { // isDown = true; // downTime = Time.time; // if (beginDragEvent != null) // { // beginDragEvent(Input.mousePosition); // } // } // } // void OnPointerDrag() // { // if (!isDown) // { // return; // } // if (dragingEvent != null) // { // dragingEvent(Input.mousePosition); // } // } // void OnPointerUp() // { // if (isDown) // { // if (Time.time - downTime < 0.3f) // { // if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, CameraManager.uiCamera)) // { // OnPointerClick(); // } // } // if (endDragEvent != null) // { // endDragEvent(Input.mousePosition); // } // } // isDown = false; // } // void OnPointerClick() // { // if (clickEvent != null) // { // clickEvent(); // } // } // } // }