GUI基础知识

来源:互联网 发布:bim软件一套多少钱 编辑:程序博客网 时间:2024/06/06 13:56
欢迎来到U3D社区:

       只要应用了七个:
   
      Label      (绘制文本和图片)

      Box         (绘制一个图形框)

      Button     (绘制按钮,响应单击事件)

      RepeatButton(绘制一个处理持续按下事件的按钮)

      TextField (绘制一个单行文本输入框)

      PasswordField (绘制一个密码输入框)

      TextArea  (绘制一个多行文本输入框)

      Label (绘制文本  不可点击  不可删除)

     GUI.Label(new Rect(20,20,20,20),"Hello World");
    
     public  Texture2D img;
    
      GUI.Label(new Rect(20,20,img.width,img.heiget),img);

      Box  (文本边框  不可点击 不可删除)

       GUI.Box(new Rect(20,20,20,20),"Hello Word");
     
       public Texture2D img;
      
       GUI.Box(new Rect(20,20,img.width,img.heght),img);

       Buttom(按键)(单击)

       public texture2D img 

       GUI. Button(new Rect(20,20,100,20),"Hello Word");

       GUI.Button(new rect(20,20,img.width,img.height),img);

       GUI.Button(new Rect(20,80,150,20),new GUIContent("我有提示",“恭喜你中奖了”));
 
       GUI.label(new rect(20,20,100,20),GUI.tooltip);

       RepeatButton(双击)

       public texture2D img 

       GUI. RepeatButton(new Rect(20,20,100,20),"Hello Word");
 
       GUI.RepeatButton(new rect(20,20,img.width,img.height),img);

       GUI.RepeatButton(new Rect(20,80,150,20),new GUIContent("我有提示",“恭喜你中奖了”));
   
       GUI.label(new rect(20,20,100,20),GUI.tooltip);
     
      TextField(输入文档)
    
      string str="Hello  World";

      str=GUI.TextField(new rect(20,20,200,40),str,10);

       passwordField

       string str="请输入密码";
     
       str=GUI.passwordField(new rect(10,20,200,20),str,"*",10);

       TextArea  (大型文本)

       string str = "Hello Word";

      str=GUI.TextArea(new rect(20,20,200,100),str,100)

      Application.LoadLevel("Login");    //跳转到登陆页面

      Application.LoadLevel(Application.loadedLevelName);//重新跳转本页面

      Application.Quit();  //退出游戏

      GUI.skin.label.fontSize=50;//设置字体大小 

      GUI.color = Color.red;//设置字体颜色

     游戏暂停和开始

      游戏暂停

      Time.timeScale=0;

      游戏开始

      Time.timeScale=1;

更多精彩在http://unity.gopedu.com/forum.php

0 0
原创粉丝点击