- BeginArea
- BeginHorizontal
- BeginScrollView
- BeginVertical
- Box
- Button
- EndArea
- EndHorizontal
- EndScrollView
- EndVertical
- ExpandHeight
- ExpandWidth
- FlexibleSpace
- Height
- HorizontalScrollbar
- HorizontalSlider
- Label
- MaxHeight
- MaxWidth
- MinHeight
- MinWidth
- PasswordField
- RepeatButton
- SelectionGrid
- Space
- TextArea
- TextField
- Toggle
- Toolbar
- VerticalScrollbar
- VerticalSlider
- Width
- Window
GUILayout.SelectionGrid 选择表格
static function SelectionGrid (selected : int, texts : string[], xCount : int, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, images : Texture[], xCount : int, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, content : GUIContent[], xCount : int, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, texts : string[], xCount : int, style : GUIStyle, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, images : Texture[], xCount : int, style : GUIStyle, params options : GUILayoutOption[]) : int
static function SelectionGrid (selected : int, contents : GUIContent[], xCount : int, style : GUIStyle, params options : GUILayoutOption[]) : int
Parameters参数
-
selectedThe index of the selected button
被选择按钮的索引 -
textsAn array of strings to show on the buttons.
显示在按钮上的字符串的数组。 -
imagesAn array of textures on the buttons.
显示在按钮上的纹理的数组 -
contentsAn array of text, image and tooltips for the button.
用于这个按钮的文本、图片和工具提示的数组。 -
xCountHow many elements to fit in the horizontal direction. The elements will be scaled to fit unless the style defines a fixedWidth to use. The height of the control will be determined from the number of elements.
有多少元素适配水平方向。每个元素将自动缩放适配,除非样式应用了固定宽度,控件的高度取决于从元素的数量。 -
styleThe style to use. If left out, the button style from the current GUISkin is used.
使用的样式。如果不使用,该开关按钮使用当前的GUISkin皮肤 -
optionsAn optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
布局选项指定额外布局属性的一个可选列表。这里传递任意值都将覆盖由style定义的设置。
参考: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
int - The index of the selected button.
返回整数型,被选择按钮的索引。
Description描述
Make a Selection Grid
创建一个选择表格。
Selection grid in the Game View.
在游戏视图中的选择表格。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public int selGridInt = 0;
public string[] selStrings = new string[] {"Grid 1", "Grid 2", "Grid 3", "Grid 4"};
void OnGUI() {
selGridInt = GUILayout.SelectionGrid(selGridInt, selStrings, 2);
}
}
var selGridInt : int = 0;
var selStrings : String[] = ["Grid 1", "Grid 2", "Grid 3", "Grid 4"];
function OnGUI () {
selGridInt = GUILayout.SelectionGrid (selGridInt, selStrings, 2);
}