码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-07-16 17:41:40      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   2014   

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#)

标签:style   blog   http   color   os   2014   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!