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参数

Returns

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);
}
最后修改:2011年1月14日 Friday 21:38

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。