UGUI Tab键切换InputField
来源:互联网 发布:网站前台设计软件 编辑:程序博客网 时间:2024/06/05 10:37
需求
游戏登录界面输入框之间的跳转用tab去实现
代码
using UnityEngine; using System.Collections; using UnityEngine.EventSystems; using UnityEngine.UI; /// <summary> /// UGUI Tab键切换InputField /// </summary> public class InputNavigator : MonoBehaviour,ISelectHandler,IDeselectHandler { private EventSystem system; private bool isSelect = false; void Start () { system = EventSystem.current; } void Update () { if (Input.GetKeyDown(KeyCode.Tab) && isSelect) { Selectable next = null; var sec=system.currentSelectedGameObject.GetComponent<Selectable>(); if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { next = sec.FindSelectableOnUp(); if (next == null) next = sec; } else { next = sec.FindSelectableOnDown(); if (next == null) next = sec; } if (next != null) { var inputField = next.GetComponent<InputField>(); if (inputField == null) return; system.SetSelectedGameObject(next.gameObject,new BaseEventData(system)); } } } public void OnSelect(BaseEventData eventData) { isSelect = true; } public void OnDeselect(BaseEventData eventData) { isSelect = false; } }
阅读全文
0 0
- UGUI Tab键切换InputField
- UGUI 中Tab切换 InputField
- UGUI中按Tab切换InputField
- UGUI中按Tab切换InputField
- UGUI中按Tab切换InputField
- UGUI中按Tab切换InputField
- UGUI中按Tab切换InputField
- Unity3D 使用“Shift+Tab”和“Tab”键 上下切换 UGUI下 Dropdown和inputfield等控件的控制顺序
- Unity 5.4可用的UGUI中按Tab切换InputField脚本
- Tab键对InputField进行换行处理
- UGUI InputField获取输入焦点
- Unity UGUI基础之InputField
- UGUI InputField获取输入焦点
- UGUI 学习笔记10 InputField
- UGUI内核大探究(十六)InputField
- Unity ulua ugui 获取 InputField 框
- UGUI中的InputField下的placeholder的作用?
- 【UGUI】无限循环列表和InputField.onValueChanged 事件
- 翻译《有关编程、重构及其他的终极问题?》——25.不要再用this指针和nullptr比较了
- struts2面试题
- 八皇后
- xcode8.*安装插件教程,亲测
- Day 3 网络协议
- UGUI Tab键切换InputField
- zynq SGI-核间中断
- 九度1014:排名
- Android中如何实现双击退出APP
- GEC210 LED裸机开发 c语言实现 ADS方式
- AsyncTask源码几句话解释
- AS 中 Gradle 配置运行浅析
- MyBatis——批量插入
- Oracle12C--记录类型(三十一)