- backgroundColor
- BeginGroup
- BeginScrollView
- Box
- BringWindowToBack
- BringWindowToFront
- Button
- changed
- color
- contentColor
- depth
- DragWindow
- DrawTexture
- enabled
- EndGroup
- EndScrollView
- FocusControl
- FocusWindow
- GetNameOfFocusedControl
- GUI
- HorizontalScrollbar
- HorizontalSlider
- Label
- matrix
- PasswordField
- RepeatButton
- ScrollTo
- SelectionGrid
- SetNextControlName
- skin
- TextArea
- TextField
- Toggle
- Toolbar
- tooltip
- UnfocusWindow
- VerticalScrollbar
- VerticalSlider
- Window
GUI.SelectionGrid 选择表格
static function SelectionGrid (position : Rect, selected : int, texts : String[], xCount : int) : int
static function SelectionGrid (position : Rect, selected : int, images : Texture[], xCount : int) : int
static function SelectionGrid (position : Rect, selected : int, content : GUIContent[], xCount : int) : int
static function SelectionGrid (position : Rect, selected : int, texts : String[], xCount : int, style : GUIStyle) : int
static function SelectionGrid (position : Rect, selected : int, images : Texture[], xCount : int, style : GUIStyle) : int
static function SelectionGrid (position : Rect, selected : int, contents : GUIContent[], xCount : int, style : GUIStyle) : int
Parameters参数
- positionRectangle on the screen to use for the grid.
用于网格在屏幕上的矩形位置。 - selectedThe index of the selected grid button
被选择表格按钮的索引号。 - textsAn array of strings to show on the grid buttons.
显示在网格按钮上的字符串数组。 - imagesAn array of textures on the grid buttons.
在网格按钮上的纹理图片数组。 - contentsAn array of text, image and tooltips for the grid button.
用于网格按钮的文本,图片和提示数组。 - xCountHow many elements to fit in the horizontal direction. The controls will be scaled to fit unless the style defines a fixedWidth to use.
在水平方向上有多少元素,控件将缩放去适合宽度,除非样式定义了固定宽度(fixedWidth)。 - styleThe style to use. If left out, the button style from the current GUISkin is used.
使用样式,如果不使用,按钮样式应用当前的GUISkin皮肤。
int - The index of the selected button.
返回int类型,被选择按钮的索引号。
Description描述
Make a grid of buttons.
创建一个网格按钮。
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 = GUI.SelectionGrid(new Rect(25, 25, 100, 30), selGridInt, selStrings, 2);
}
}
var selGridInt : int = 0;
var selStrings : String[] = ["Grid 1", "Grid 2", "Grid 3", "Grid 4"];
function OnGUI () {
selGridInt = GUI.SelectionGrid (Rect (25, 25, 100, 30), selGridInt, selStrings, 2);
}