IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]unity3d随笔-1

    u010255642发表于 2017-03-20 12:24:42
    love 0
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class test : MonoBehaviour {
        public string username = "";
        public string password = "";
        public string ispass ="yes";
        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 == "myhaspl" && password == "good123")
                {
                    ispass = "yes";
                }
                else
                {
                    ispass = "no";
                }
            }
           if (ispass=="yes")
            { 
                GUI.Label(new Rect(120, 100, 50, 25), "正确");
            }
           else if (ispass == "no")
            {
                GUI.Label(new Rect(120, 100, 50, 25), "错误");
            }
        }
    	// Use this for initialization
    	void Start () {
    
    		
    	}
    	
    	// Update is called once per frame
    	void Update () {
    		
    	}
    }
    




沪ICP备19023445号-2号
友情链接