• unity传统GUI学习一.


    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class gui : MonoBehaviour {
    
        string editName;  
        string editPassword;  
        float toolBarValue0;  
        float toolBarValue1;  
        public Texture tex;  
        void Start()  
        {  
            editName = "请输入用户名";  
            editPassword = "请输入密码";  
            toolBarValue0 = 0;  
            toolBarValue1 = 0;  
        }  
    
    
        void OnGUI ()
        {  
            GUI.Label (new Rect (10, 10, 100, 30), "阿峰学习"); //将字符串显示在屏幕上  
    
            GUI.DrawTexture (new Rect (10, 50, 100, 80), tex);  //绘制贴图  
    
            //检测按钮  
            if (GUI.Button (new Rect (10, 200, 100, 30), "普通按钮")) {  
                Debug.Log ("按下了按钮。");  
            }  
            //检测连续按钮  
            if (GUI.RepeatButton (new Rect (10, 250, 100, 30), "连续按钮")) {  
                Debug.Log ("正在按按钮!");  
            }  
    
            //设置文本输入框  
            editName = GUI.TextField (new Rect (150, 40, 200, 30), editName, 15);  
            editPassword = GUI.PasswordField (new Rect (150, 80, 200, 30), editPassword, "*" [0], 15); 
    //垂直和水平滑动条 toolBarValue0 = GUI.VerticalSlider (new Rect (200, 200, 30, 100), toolBarValue0, 100, 0); toolBarValue1 = GUI.HorizontalSlider (new Rect (200, 180, 100, 30), toolBarValue1, 0, 100); } }
     
  • 相关阅读:
    Ubuntu下基于Virtualenv构建Python开发环境
    Linux查看用户登录信息-last
    SpringCloud实践引入注册中心+配置中心
    git仓库构建小记
    windows下使用hbase/opencv/ffmpeg小记
    Java执行jar总结
    命名空间
    phpstudy ——composer使用
    template-web.js
    redis
  • 原文地址:https://www.cnblogs.com/fengdaren/p/8681770.html
Copyright © 2020-2023  润新知