返回介绍

GUI.SelectionGrid 选择表格

发布于 2019-12-18 15:37:45 字数 5108 浏览 1063 评论 0 收藏 0

JavaScript => public static function SelectionGrid(position: Rect, selected: int, texts: string[], xCount: int): int;
JavaScript =>public static function SelectionGrid(position: Rect, selected: int, images: Texture[], xCount: int): int;
JavaScript =>public static function SelectionGrid(position: Rect, selected: int, content: GUIContent[], xCount: int): int;
JavaScript =>public static function SelectionGrid(position: Rect, selected: int, texts: string[], xCount: int, style: GUIStyle): int;
JavaScript =>public static function SelectionGrid(position: Rect, selected: int, images: Texture[], xCount: int, style: GUIStyle): int;
JavaScript =>public static function SelectionGrid(position: Rect, selected: int, contents: GUIContent[], xCount: int, style: GUIStyle): int;

C# => public static int SelectionGrid(Rect position, int selected, string[] texts, int xCount);
C# =>public static int SelectionGrid(Rect position, int selected, Texture[] images, int xCount);
C# =>public static int SelectionGrid(Rect position, int selected, GUIContent[] content, int xCount);
C# =>public static int SelectionGrid(Rect position, int selected, string[] texts, int xCount, GUIStyle style);
C# =>public static int SelectionGrid(Rect position, int selected, Texture[] images, int xCount, GUIStyle style);
C# =>public static int SelectionGrid(Rect position, int selected, GUIContent[] contents, int xCount, GUIStyle style);

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皮肤。

Returns 返回

int The index of the selected button.
返回int类型,被选择按钮的索引号。

Description 描述

Make a grid of buttons.

创建一个网格按钮。

JavaScript:

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);
	}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : 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);
    }
}

gui

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文