首页 > 其他 > 详细

游戏 gui button

时间:2014-02-04 03:03:50      阅读:280      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
using UnityEngine;
using System.Collections;

public class Gui : MonoBehaviour {


    public Texture2D buttonTexture;

    private string str;

    private int frameTime; 


    // Use this for initialization
    void Start () {
        str="请您点击按钮";
    }
    
    // Update is called once per frame
    void Update () {
    
    }

    void OnGUI()
    {
        GUI.Label (new Rect (10, 10, Screen.width, 30), str);

        if (GUI.Button (new Rect (10, 50, buttonTexture.width, buttonTexture.height), buttonTexture)) {
                
            str="您点击了图片按钮";
        }
        GUI.color = Color.green;
        GUI.backgroundColor = Color.red;
        if (GUI.Button (new Rect (10, 400, 70, 30), "文字按钮")) {
        
            str="您点击了文字按钮";
        }

        GUI.color = Color.yellow;
        GUI.backgroundColor = Color.black;

        if (GUI.RepeatButton (new Rect (10, 500, 100, 30), "按钮按下中")) {
                
            str=frameTime+"";
            frameTime++;
        }

    }
}
bubuko.com,布布扣

游戏 gui button

原文:http://www.cnblogs.com/yufenghou/p/3537635.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!