查看: 1404|回复: 0
打印 上一主题 下一主题

Unity3D脚本中文教程2.15

[复制链接]

5552

主题

2

听众

8万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
11

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-5-18 15:28:50 |只看该作者 |倒序浏览
GUILayoutOption 类


内部类用来传递布局选项给GUILayout函数,不要直接使用这些,而是在GUILayout类的布局函数中构造它们。

参见:

GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight


GUILayoutUtility 类


用于实现并扩展GUILayout类的工具函数。

使用这个类制作你自己的GUI布局代码

类方法

◆ static function BeginGroup(GroupName : string) : void
◆ static function BeginLayoutGroup(style : GUIStyle, options : GUILayoutOption[], LayoutType : System.Type) : GUILayoutGroup

描述:普通的辅助函数 – 当创建一个布局组的时候使用这个。它将确保所有的事情都正确的排列。

style : 组选项的风格

option : 使用的布局选项

LayoutType : 创建的布局组的类型

◆ static function EndGroup(groupName : string) : void

◆ static function GetAspectRect(aspect : float) : Rect

◆ static function GetAspectRect(aspect : floar, style : GUIStyle) : Rect

◆ static function GetAspectRect(aspect : float,  params options : GUILayoutOption[]) : Rect

◆ static function GetAspectRect(aspect : float,  style : GUIStyle, params options:  GUILayoutOption[]) : Rect

参数

aspect  这个元素的宽高比(宽/高)

style  一个可选的风格。如果指定风格的padding将被添加到返回举行的尺寸并且这个风格的margin将被用于间距。

options 一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由Style定义的设置。参见GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

返回Rect – 控制的矩形

描述:用一个制定的宽高比获取一个矩形。

◆ static function GetRect(content : GUIContent, style : GUIStyle,  params options : GUILayoutOption[]) : Rect

参数

content  让出空间所显示的内容

style用于布局的GUIStyle

options  一个可选的布局选项的列表。它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置。参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILAyout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight

返回Rect – 一个足够大的矩形区域用来包含用/style/渲染时的/content/。

描述:获取一个以特定风格显示内容的矩形。

◆ static function GetRect(width : float,  height : float) : Rect

◆ static function GetRect(width : float,  height : float,  params options : GUILayoutOption[]) : Rect

◆ static function GetRect(width : float, height : float, style : GUIStyle,  params options : GUILayoutOption[]) : Rect

参数

width  你想要的区域的宽度

height  你想要的区域的高度

style  用了布局的可选GUIStyle,如果指定,风格的padding将被添加到尺寸并且它的margin将被用于间距

options 一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置。

参见:GUILayout.Width,  GUILayout.Height,  GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

返回Rect – 用于放置控件的矩形

描述:用一个固定的内容区域获取一个矩形

◆ static function GetRect(minWidth : float,  maxWidth : float,  minHeight : float,  maxHeight : float) : Rect

◆ static function GetRect(minWidth : float,  maxWidth : float,  minHeight : float,  maxHeight : float, style : GUIStyle) : Rect

◆ static function GetRect(minWidth : float, maxWidth : float, minHeight : float, maxHeight :  float, params options : GUILayerOption[]) : Rect

◆ static function GetRect(minWidth : float, maxWidth : float, minHeight : float, maxHeight :  float, style : GUIStyle, paramas option : GUILayoutOption[]) : Rect

参数

minWidth  传回区域的最小宽度

maxWidth  传回区域的最大宽度

minHeight  传回区域的最小高度

maxHeight  传回区域的最大宽度

style  一个可选的风格。如果指定,风格的padding将被添加到尺寸并且它的margin将被用于间距

options 一个可选的布局选项的列表。它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置。

参见:GUILayout.Width,  GUILayout.Height,  GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

返回Rect – 一个矩形区域在两个轴上的尺寸介于minWidth和maxWidth之间

描述:从布局系统获取一个可扩展的矩形,矩形的尺寸将在min和max值之间。

分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-6-18 05:00 , Processed in 0.063660 second(s), 28 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部