您的位置:首页 > 移动开发 > Unity3D

(二十)unity4.6学习Ugui中文文档-------交互-InputModules

2014-10-01 12:20 281 查看
大家好,我是孙广东。 转载请注明出处:http://write.blog.csdn.net/postedit/38922399

更全的内容请看我的游戏蛮牛地址:http://www.unitymanual.com/forum.php?mod=guide&view=my

完整的教程下载地址:http://www.unitymanual.com/thread-26665-1-1.html

5.1 InputModules

输入的模块是在哪里配置和定制事件系统的主要逻辑。有两个InputModules被提供,一个设计为Standalone独立的和一个用于Touch触摸屏输入。每个模块接收和发送事件,正如你期望在给定的配置。

如果你想要自定义的事件处理在您的应用程序中,可以编写自定义 InputModules。

5.1.1 Touch Input Module

input module被设计为使用触摸的基础设备上。这可处理的输入并发送事件会在触摸设备上预期的那样。

该模块的流程如下所示:

♥For
each touch event关于每个触摸事件

♦If it is a new press如果它是新的按下

•Send PointerEnter event (sent to everyobject up the hierarchy that can handle it)

•Send PointerPress event

•Cache the drag handler (first element in the hierarchy that canhandle it)

•Send BeginDrag event to the drag handler

•Set the ‘Pressed’ object as Selected in the event system



发送 PointerEnter事件(发送到每个对象可以在hierarchy中处理)

发送 PointerPress事件

缓存的拖动处理程序(在hierarchy中,可以处理它的第一个元素)

BeginDrag事件发送到拖动处理程序

在event system中设置‘Pressed’ 对象为Selected



♦If this is a continuing press如果它是持续的按下

•Process
movment

•Send DragEvent to the cached drag handler

•Handle PointerEnter and PointerExit events if touch moves betweenobjects



处理移动

发送DragEvent到缓存的拖动处理程序

如果对象之间触摸移动,处理 PointerEnter和
PointerExit的事件



♦If this is a release如果它是释放按下

•Send PointerUp event to the object that received the PointerPress

•If the current hover object is the same as the PointerPress objectsend a PointerClick event

•Send a Drop event if there was a drag handler cached

•Send a EndDrag event to teh cached drag handler



发送PointerUp事件到接受PointerPress的对象

如果当前悬停对象是相同的 PointerPress对象发送一个
PointerClick事件

如果拖动处理程序被缓存,发送Drop事件

EndDrag事件发送到缓存的拖动处理程序



5.1.2 Standalone Input Module

input module用于鼠标、键盘和控制器。该模块被配置查看
InputManager,发送事件是基于输入Input manager管理器是何种状态。

本模块使用:

♥Vertical
/ Horizontal axis for keyboard and controller navigation

♥Submit
/ Cancel button for sending submit and cancel events

♥Has
a timeout between events to only allow a maximum number of events a second.



垂直 /水平轴,用于键盘和控制器的导航

提交 /取消按钮发送提交和取消事件

仅允许最大每秒事件数之间。



该模块的流程如下所示:

♥Send
a Move event to the selected object if a valid axis from the input manager is entered

♥Send
a submit or cancel event to the selected object if a submit or cancel button is pressed

♥Process
Mouse input



如果从input manager中输入了有效的轴,将发送Move移动事件发送到选定的对象上

如果按下一个提交或取消按钮,发送一个提交或取消事件到所选对象上

处理鼠标输入



♦If
it is a new press 如果它是新的按下

•Send PointerEnter event (sent to every object up the hierarchy that can handle it)

•Send PointerPress event

•Cache the drag handler (first element in the hierarchy that can handle it)

•Send BeginDrag event to the drag handler

•Set the ‘Pressed’ object as Selected in the event system



发送 PointerEnter事件(发送到每个对象可以在hierarchy中处理)

发送 PointerPress事件

缓存的拖动处理程序(在hierarchy中,可以处理它的第一个元素)

BeginDrag事件发送到拖动处理程序

在event system中设置‘Pressed’ 对象为Selected



♦If
this is a continuing press如果它是持续的按下

•Process movment

•Send DragEvent to the cached drag handler

•Handle PointerEnter and PointerExit events if touch moves between objects



处理移动

发送DragEvent到缓存的拖动处理程序

如果对象之间触摸移动,处理 PointerEnter和
PointerExit的事件



♦If
this is a release如果它是释放按下

•Send PointerUp event to the object that received the PointerPress

•If the current hover object is the same as the PointerPress object send a PointerClick event

•Send a Drop event if there was a drag handler cached

•Send a EndDrag event to teh cached drag handler



发送PointerUp事件到接受PointerPress的对象

如果当前悬停对象是相同的 PointerPress对象发送一个
PointerClick事件

如果拖动处理程序被缓存,发送Drop事件

EndDrag事件发送到缓存的拖动处理程序



♥Process
scroll wheel events进程滚动滚轮事件



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐