zoukankan      html  css  js  c++  java
  • 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); } }
     
  • 相关阅读:
    Linux学习
    官网地址
    Unsupported major.minor version 51.0
    获取select的option值
    网页中JS函数自动执行常用三种方法
    Python活力练习Day3
    时间复杂度的简单理解版本,非专业~~
    Python活力练习Day2
    Python活力练习Day1
    状压DP之LGTB 与序列
  • 原文地址:https://www.cnblogs.com/fengdaren/p/8681770.html
Copyright © 2011-2022 走看看