namespace UnityEngine.EventSystems { /// /// Base class that all EventSystem events inherit from. /// public interface IEventSystemHandler { } /// /// Interface to implement if you wish to receive OnPointerMove callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IPointerMoveHandler : IEventSystemHandler { /// /// Use this callback to detect pointer move events /// void OnPointerMove(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnPointerEnter callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IPointerEnterHandler : IEventSystemHandler { /// /// Use this callback to detect pointer enter events /// void OnPointerEnter(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnPointerExit callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IPointerExitHandler : IEventSystemHandler { /// /// Use this callback to detect pointer exit events /// void OnPointerExit(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnPointerDown callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IPointerDownHandler : IEventSystemHandler { /// /// Use this callback to detect pointer down events. /// void OnPointerDown(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnPointerUp callbacks. /// Note: In order to receive OnPointerUp callbacks, you must also implement the EventSystems.IPointerDownHandler|IPointerDownHandler interface /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IPointerUpHandler : IEventSystemHandler { /// /// Use this callback to detect pointer up events. /// void OnPointerUp(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnPointerClick callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// /// /// Use the IPointerClickHandler Interface to handle click input using OnPointerClick callbacks. Ensure an Event System exists in the Scene to allow click detection. For click detection on non-UI GameObjects, ensure a EventSystems.PhysicsRaycaster is attached to the Camera. /// /// /// /// /// /// public interface IPointerClickHandler : IEventSystemHandler { /// /// Use this callback to detect clicks. /// void OnPointerClick(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnBeginDrag callbacks. /// Note: You need to implement IDragHandler in addition to IBeginDragHandler. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IBeginDragHandler : IEventSystemHandler { /// /// Called by a BaseInputModule before a drag is started. /// void OnBeginDrag(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnInitializePotentialDrag callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IInitializePotentialDragHandler : IEventSystemHandler { /// /// Called by a BaseInputModule when a drag has been found but before it is valid to begin the drag. /// void OnInitializePotentialDrag(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnDrag callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// /// /// /// (gameObject); /// if (canvas == null) /// return; /// /// // We have clicked something that can be dragged. /// // What we want to do is create an icon for this. /// m_DraggingIcon = new GameObject("icon"); /// /// m_DraggingIcon.transform.SetParent(canvas.transform, false); /// m_DraggingIcon.transform.SetAsLastSibling(); /// /// var image = m_DraggingIcon.AddComponent(); /// /// image.sprite = GetComponent().sprite; /// image.SetNativeSize(); /// /// if (dragOnSurfaces) /// m_DraggingPlane = transform as RectTransform; /// else /// m_DraggingPlane = canvas.transform as RectTransform; /// /// SetDraggedPosition(eventData); /// } /// /// public void OnDrag(PointerEventData data) /// { /// if (m_DraggingIcon != null) /// SetDraggedPosition(data); /// } /// /// private void SetDraggedPosition(PointerEventData data) /// { /// if (dragOnSurfaces && data.pointerEnter != null && data.pointerEnter.transform as RectTransform != null) /// m_DraggingPlane = data.pointerEnter.transform as RectTransform; /// /// var rt = m_DraggingIcon.GetComponent(); /// Vector3 globalMousePos; /// if (RectTransformUtility.ScreenPointToWorldPointInRectangle(m_DraggingPlane, data.position, data.pressEventCamera, out globalMousePos)) /// { /// rt.position = globalMousePos; /// rt.rotation = m_DraggingPlane.rotation; /// } /// } /// /// public void OnEndDrag(PointerEventData eventData) /// { /// if (m_DraggingIcon != null) /// Destroy(m_DraggingIcon); /// } /// /// static public T FindInParents(GameObject go) where T : Component /// { /// if (go == null) return null; /// var comp = go.GetComponent(); /// /// if (comp != null) /// return comp; /// /// Transform t = go.transform.parent; /// while (t != null && comp == null) /// { /// comp = t.gameObject.GetComponent(); /// t = t.parent; /// } /// return comp; /// } /// } /// ]]> /// /// public interface IDragHandler : IEventSystemHandler { /// /// When dragging is occurring this will be called every time the cursor is moved. /// void OnDrag(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnEndDrag callbacks. /// Note: You need to implement IDragHandler in addition to IEndDragHandler. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IEndDragHandler : IEventSystemHandler { /// /// Called by a BaseInputModule when a drag is ended. /// void OnEndDrag(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnDrop callbacks. /// /// /// /// /// /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IDropHandler : IEventSystemHandler { /// /// Called by a BaseInputModule on a target that can accept a drop. /// void OnDrop(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnScroll callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IScrollHandler : IEventSystemHandler { /// /// Use this callback to detect scroll events. /// void OnScroll(PointerEventData eventData); } /// /// Interface to implement if you wish to receive OnUpdateSelected callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IUpdateSelectedHandler : IEventSystemHandler { /// /// Called by the EventSystem when the object associated with this EventTrigger is updated. /// /// /// /// /// /// void OnUpdateSelected(BaseEventData eventData); } /// /// Interface to implement if you wish to receive OnSelect callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface ISelectHandler : IEventSystemHandler { void OnSelect(BaseEventData eventData); } /// /// Interface to implement if you wish to receive OnDeselect callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IDeselectHandler : IEventSystemHandler { /// /// Called by the EventSystem when a new object is being selected. /// void OnDeselect(BaseEventData eventData); } /// /// Interface to implement if you wish to receive OnMove callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface IMoveHandler : IEventSystemHandler { /// /// Called by a BaseInputModule when a move event occurs. /// void OnMove(AxisEventData eventData); } /// /// Interface to implement if you wish to receive OnSubmit callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface ISubmitHandler : IEventSystemHandler { void OnSubmit(BaseEventData eventData); } /// /// Interface to implement if you wish to receive OnCancel callbacks. /// /// /// Criteria for this event is implementation dependent. For example see StandAloneInputModule. /// public interface ICancelHandler : IEventSystemHandler { void OnCancel(BaseEventData eventData); } }