首页 > 其他 > 详细

GUI 控件实例学习二(C#)

时间:2014-07-16 17:41:11      阅读:263      评论:0      收藏:0      [点我收藏+]
using UnityEngine;
using System.Collections;

public class GUITest : MonoBehaviour {

    public GUISkin myGUISking;
    private Rect windowRect;
    private Vector2 scrollPosition;
    string info="       测试测试测试测试测试测试测试测试测试测试 \n " +
        "测试测试测试测试测试测试测试测试\n测试测试测试测试测试测试\n测试测试测试测试测试测试测试测试\n测试测试测试测试测试测试测试测试\n" +
            "测试测试测试测试测试测试测试测试测试测试\n测试测试测试测试测试测试测试测试\n测试测试测试测试测试测试";
    // Use this for initialization
    void Start () {
        windowRect = new Rect (500,140,350,510);
    }
    
    // Update is called once per frame
    void Update () {
    
    }
    void OnGUI(){
        GUI.skin = myGUISking;
        windowRect = GUI.Window (0,windowRect,DoMyWindow,"");
    }

    void DoMyWindow( int windowID){
        GUILayout.BeginVertical ();
        GUILayout.Space (8);
        GUILayout.Button ("", "MyButtonSkin");
        GUILayout.Space (8);
        GUILayout.Label ("","MyDividerSkin");
        GUILayout.Label ("MyLabelSkin","MyLabelSkin");
        GUILayout.Label ("","MyDividerSkin");
        GUILayout.Label ("","MyDividerSkin");
        GUILayout.Label ("","MyDividerSkin");
        GUILayout.Label ("","MyDividerSkin");

        GUILayout.BeginHorizontal ();
        scrollPosition = GUILayout.BeginScrollView (scrollPosition, false, true);
        GUILayout.Label (info,"MyTextSkin");
        GUILayout.EndScrollView ();
        GUILayout.EndHorizontal ();

        GUILayout.EndVertical ();
        GUI.DragWindow (new Rect(0,0,10000,10000));
    }

}

bubuko.com,布布扣

GUI原理很简单,和flash组件差不多,只能unity3d中是可视化编辑,调整各种属性,然后即可得到视图效果。

 

GUI 控件实例学习二(C#),布布扣,bubuko.com

GUI 控件实例学习二(C#)

原文:http://www.cnblogs.com/fldoing/p/3847724.html

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