(二十)unity4.6得知Ugui中国文献-------另外-InputModules



大家好。我是太阳广东。   转载请注明出处: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.



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


提交 /取消button发送提交和取消事件


仅同意最大每秒事件数之间。



该模块的流程例如以下所看到的:


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移动事件发送到选定的对象上


假设按下一个提交或取消button,发送一个提交或取消事件到所选对象上


处理鼠标输入



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进程滚动滚轮事件






版权声明:本文博主原创文章,博客,未经同意不得转载。

离 游戏开发实验室_孙广东

posted @ 2015-10-28 08:49  lcchuguo  阅读(198)  评论(0编辑  收藏  举报