5.2 [url=]Supported Events[/url]
Eventsystem支持大量的事件,并且他们可以进一步定制在用户自定义的用户编写的 InputModules中。
支持的StandaloneInputModule和 TouchInputModule的事件提供的接口和所实现的接口可以在 MonoBehaviour中实现。如果你有有效的 EventSystem配置的事件会在正确的时间被调用。
•IPointerEnterHandler - OnPointerEnter -Called when a pointer enters the object
•IPointerExitHandler - OnPointerExit - Calledwhen a pointer exits the object
•IPointerDownHandler - OnPointerDown - Calledwhen a pointer is pressed on the object
•IPointerUpHandler - OnPointerUp - Calledwhen a pointer is released (called on the original the pressed object)
•IPointerClickHandler - OnPointerClick -Called when a pointer is pressed and released on the same object
•IBeginDragHandler - OnBeginDrag - Called onthe drag object when dragging is about to begin
•IDragHandler - OnDrag - Called on the dragobject when a drag is happening
•IEndDragHandler - OnEndDrag - Called on thedrag object when a drag finishes
•IDropHandler - OnDrop - Called on the objectwhere a drag finishes
•IScrollHandler - OnScroll - Called when amouse wheel scrolls
•IUpdateSelectedHandler - OnUpdateSelected -Called on the selected object each tick
•ISelectHandler - OnSelect - Called when theobject becomes the selected object
•IDeselectHandler - OnDeselect - Called onthe selected object becomes deselected
•IMoveHandler - OnMove - Called when a moveevent occurs (left, right, up, down, ect)
•ISubmitHandler - OnSubmit - Called when thesubmit button is pressed
•ICancelHandler - OnCancel - Called when thecancel button is pressed
•IPointerEnterHandler-OnPointerEnter-当pointer指针进入该对象时调用
•IPointerExitHandler-OnPointerExit- pointer指针退出该对象时调用
•IPointerDownHandler-OnPointerDown-当指针在对象上按下时调用
•IPointerUpHandler-OnPointerUp-pointer指针被释放(原状态为被按下)时调用
•IPointerClickHandler-OnPointerClick-pointer指针在同一对象上按下并释放时调用(单击)
•IBeginDragHandler-OnBeginDrag-拖动对象在拖动开始时调用
•IDragHandler-OnDrag-拖动对象,当拖动正在发生进行时调用
•IEndDragHandler-OnEndDrag-拖动对象拖动完成时调用
•IDropHandler-OnDrop-对该对象拖动完成时调用
•IScrollHandler-OnScroll-当鼠标滚轮滚动时调用
•IUpdateSelectedHandler-OnUpdateSelected-在选定的对象上eachtick中调用
•ISelectHandler-OnSelect-当对象成为所选的对象时调用
•IDeselectHandler-OnDeselect-在被选定的对象成为取消被选择时调用
•IMoveHandler-OnMove-移动事件发生时调用(左、右、上、 下等)
•ISubmitHandler-OnSubmit-当按下提交按钮时调用
•ICancelHandler-OnCancel-当按下取消按钮时调用
5.3 Raycasters
EventSystem需要一种方法用于检测当前的输入的事件需要发送到什么上,而这由 Raycasters提供的。Raycasters搜索scene返回给定的屏幕的位置上‘most valid’(最有效的)的对象。有几种类型的 Raycasters被提供:
•GraphicRaycaster - Used for UI elements,lives on a Canvas and searches within the canvas
•hysics2DRaycaster - Used for 2D physicselements
•hysicsRaycaster - Used for 3D physics elements
•GraphicRaycaster-用于 UI 元素,在画布上,画布内搜索
•hysics2DRaycaster-用于为 2D 物理元素
•hysicsRaycaster-用于为三维物理元素
当一个场景中存在并且启用了Raycaster时,它将被用于EventSystem随时查询InputModule是谁发出的。
|