void OnGUI()
{
//登陆框
GUI.Box(new Rect(10, 10, 200, 120), " 登陆框 ");
//用户名
GUI.Label(new Rect(20, 40, 50, 30), " 用户名 ");
userName = GUI.TextField(new Rect(70, 40, 120, 20), userName);
//密码
GUI.Label(new Rect(20, 70, 50, 30), " 密码 ");
password = GUI.PasswordField(new Rect(70, 70, 120, 20), password, '*');
//登陆按钮
if(GUI.Button(new Rect(70,100,50,25)," 登陆 "))
{
if (userName == "111" && password == "222")
Debug.Log(" 登陆成功 ");
else Debug.Log(" 登陆失败 ");
}
}
编写一个登陆框
最新推荐文章于 2022-08-07 15:19:38 发布