unity3d 焦点unity3d是什么语言意思

2015年8月 移动开发大版内专家分月排行榜第三2014年9月 移动开发大版内专家分月排行榜第三2014年7月 移动开发大版内专家分月排行榜第三
2015年8月 移动开发大版内专家分月排行榜第三2014年9月 移动开发大版内专家分月排行榜第三2014年7月 移动开发大版内专家分月排行榜第三
匿名用户不能发表回复!|
每天回帖即可获得10分可用分!小技巧:
你还可以输入10000个字符
(Ctrl+Enter)
请遵守CSDN,不得违反国家法律法规。
转载文章请注明出自“CSDN(www.csdn.net)”。如是商业用途请联系原作者。unity3D技术之gui.focuswindow 焦点窗口_中华文本库
第1页/共2页
static functionfocuswindow(windowid: int) : void
parameters参数【】
the identifier used when you created the window in the window call. 在窗口调用时创建窗口使用的标识符。
description描述
make a window become the active window.
使一个窗口成为活动窗口。
参考:gui.unfocuswindow
javascript
using system.
public class example :monobehaviour{
privaterectwindowrect = newrect(20, 20, 120, 50);
privaterectwindowrect2 = newrect(20, 80, 120, 50);
void ongui() {
windowrect =gui.window(0, windowrect, domyfirstwindow, "first");
windowrect2 =gui.window(1, windowrect2, domysecondwindow, "second"); }
void domyfirstwindow(int windowid) {
if (gui.button(newrect(10, 20, 100, 20), "focus other"))
gui.focuswindow(1);
void domysecondwindow(int windowid) {
if (gui.button(newrect(10, 20, 100, 20), "focus other"))
gui.focuswindow(0);
private var windowrect :rect=rect(20, 20, 120, 50);
private var windowrect2 :rect=rect(20, 80, 120, 50);
function ongui () {
//注册2个窗口
windowrect =gui.window(0, windowrect, domyfirstwindow, "first");
windowrect2 =gui.window(1, windowrect2, domysecondwindow, "second" ); }
function domyfirstwindow (windowid : int) {
if (gui.button(rect(10,20,100,20), "focus other"))
//使窗口2成为活动窗口
gui.focuswindow(1);
function domysecondwindow (windowid : int) {
if (gui.button(rect(10,20,100,20), "focus other"))
//使窗口1成为活动窗口
第1页/共2页
寻找更多 ""当前位置: >
GUI之获取控件的焦点
时间: 08:49 来源:互联网 作者:网络 浏览:
在这里直接为大家展示代码:using&UnityE
using&System.C
public&class&SetConFocus&:&MonoBehaviour&{
&&&&public&string&username&=&&username&;
&&&&public&string&pwd&=&&a&pwd&;
&&&&public&string&pwds&=&&a&pwds&;
&&&&int&count&=&1;
&&&&private&bool&isopen&=&
&&&&void&OnGUI()
&&&&{&&&&/***********设置下一个控件的名字****************/
&&&&&&&&GUI.SetNextControlName(&MyTextField&);
&&&&&&&&GUI.Button(new&Rect(10,&10,&100,&20),&username);
&&&&&&&&GUI.SetNextControlName(&TEXT2&);
&&&&&&&&&GUI.Button(new&Rect(10,&40,&100,&20),&pwd);
&&&&&&&&GUI.SetNextControlName(&TEXT3&);
&&&&&&&&&GUI.Button(new&Rect(10,&70,&100,&20),&pwds);
&&&&&&&&/*************按一下button的时候,名字为MyTextField的控件获得焦点*******************/
&&&&&&&&if&(GUI.Button(new&Rect(10,&100,&80,&20),&&Move&Focus&))
&&&&&&&&&&&&Debug.Log(count);
&&&&&&&&&&&&if&(count&%&3&==&0)
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&GUI.FocusControl(&MyTextField&);
&&&&&&&&&&&&&&&&isopen&=&
&&&&&&&&&&&&}
&&&&&&&&&&&&else&if&(count&%&3&==&1)
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&GUI.FocusControl(&TEXT2&);
&&&&&&&&&&&&}
&&&&&&&&&&&&else
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&GUI.FocusControl(&TEXT3&);
&&&&&&&&&&&&}
&&&&&&&&&&&&count++;
&&&&&&&&&&&&&&&&&&&&&&
&&&&void&Update(){
&&&&&&&&/*********焦点在上面的时候,就响应一些事件************/
&&&&&&&&if&(isopen)
&&&&&&&&{&
&&&&&&&&&&&&if&(Input.GetKeyDown(KeyCode.Return))
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&isopen&=&
&&&&&&&&&&&&Debug.Log(&the&t&button&is&pressed&);
&&&&&&&&&&&&Debug.Log(&the&MyTextField&&is&pressed&);
&&&&&&&&&&&}
(责任编辑:脚印)
免责声明:Unity之家部分内容来源于互联网,如有侵权,请联系我们,本站将立即进行处理。
猜你也喜欢看这些 ??????
其他类型的Unity编程 ??????

我要回帖

更多关于 unity3d是什么 的文章

 

随机推荐