GUI基础,泛型,集合

1.GUI基础:


一.Label


Label (position : Rect, text : string) : void

Label (position : Rect, image : Texture) : void

Label (position : Rect, content : GUIContent) : void

Label (position : Rect, text : string, style : GUIStyle) : void

Label (position : Rect, image : Texture, style : GUIStyle) : void

Label (position : Rect, content : GUIContent, style : GUIStyle) : void 

 

 

public Texture2D img;

void OnGUI() {

        GUI.Label(new Rect(10, 10, 100, 20), "Hello World!");

        GUI.Label(new Rect(10,50,img.width,img.height),img);

    }

 

 

二.Box


Box (position : Rect, text : string) : void

Box (position : Rect, image : Texture) : void

Box (position : Rect, content : GUIContent) : void

Box (position : Rect, text : string, style : GUIStyle) : void

Box (position : Rect, image : Texture, style : GUIStyle) : void

Box (position : Rect, content : GUIContent, style : GUIStyle) : void 

 

 

public Texture2D img;

void OnGUI() {

        GUI.Label(new Rect(10, 10, 100, 20), "Hello World!");

        GUI.Label(new Rect(10,50,img.width,img.height),img);

    }


2.泛型的概念


泛型是程序设计语言的一种特性。允许程序员在类型程序设计语言中编写代码时定义一些可变部分,那些部分在使用前必须作出指明。各种程序设计语言和其编译器,运行环境对泛型的支持均不一样将类型参数化达到代码复用提高软件工作效率的一种数据类型。泛型类是引用类型,是堆对象,主要是引入类型参数这个概念,字符串不是基本类型。

声明:此篇文档时来自于【狗刨学习网】社区-unity极致学院,是网友自行发布的Unity3D学习文章,如果有什么内容侵犯了你的相关权益,请与官方沟通,我们会即时处理。

3.集合的格式


 [code] ArrayList   

 List   泛型                 

Arraylisa  a:new ArrList ();

A.dd(object);

A.dd(“aaaa”);

A.dd(“bbbb”);

Foreach (string  s in a){

 

}

 

a.Sort();

a.Remove(“cccc”);

a.Remove(0);

 

4.泛型的用法


List<string > a=new List<string >();

a.Add(“aa”);

A.add(“bb”);

 

 

 

Class Person{

Private int id;

Private strring name;

封装  }

 

 

Public void Get() {

List <Person>  a= new List<Person>();

Person  p1=new Person();

P1.Id=101;

P1.Name=”2ling”;

 

Person p2=new person();

P2.name=”c:”;

A.add(p1);

Q.add(p2);

  }[/code]


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值