var iFocus=0;
function OnGUI()
{
GUI.SetNextControlName("tFXXX");
GUI.TextField(Rect(10,10,100,20),"XXX");
GUI.SetNextControlName("tFYYY");
GUI.TextField(Rect(10,40,100,20),"YYY");
GUI.SetNextControlName("tFLogin");
GUI.Button(new Rect(120,10,50,20),"Login");
GUI.Window(1,Rect(180,0,150,150),popWin,"op1");
GUILayout.Window(2,Rect(360,0,150,150),popWin,"op2");
//——————————————
switch(iFocus)
{
case 1:GUI.FocusControl("tFXXX");break; //设置的焦点名称
case 2:GUI.FocusControl("tFYYY");break;
case 3:GUI.FocusControl("tFLogin");break;
case 3:GUI.FocusWindow(1);break; //窗口的焦点
case 4:GUI.FocusWindow(2);break;
case 5:GUI.UnfocusWindow();break; //失去焦点
default:print("Err");
}
}
function popWin(winID:int)
{
GUILayout.Label("lease Check Your Info:",GUILayout.Width(150));
GUILayout.Label("\nlogin\t\t:");
GUILayout.Label("login2\t:");
GUILayout.BeginHorizontal();
GUILayout.Button("Yes.",GUILayout.Height(40));
GUILayout.BeginVertical();
GUILayout.Button("No.");
GUILayout.Button("No.");
//~ GUILayout.VerticalScrollbar();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
function FixedUpdate()
{
iFocus=Mathf.Floor(Time.time)%6;
}