Unity 6.3
0 онлайн 3 гостей 3 в системе
Вход

GUI.SelectionGrid

Declaration

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

Параметры

Параметр Описание
должность Прямоугольник на экране для использования в сетке.
выбрано Индекс выбранной кнопки сетки.
тексты Массив строк для отображения на кнопках сетки.
изображения Массив текстур на кнопках сетки.
Содержание Массив текста, изображений и подсказок для кнопки сетки.
xCount Количество элементов, которые должны вписываться в горизонтальное направление. Контроллеры будут масштабироваться, чтобы вписаться, если стиль не определяет fixedWidth для использования.
стиль Используемый стиль. Если этот параметр не указан, то используется стиль button из текущего GUISkin.

Возвращаемое значение

инт Индекс выбранной кнопки.

Описание

Сделайте сетку из кнопок.

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() { // use 2 elements in the horizontal direction selGridInt = GUI.SelectionGrid(new Rect(25, 25, 100, 30), selGridInt, selStrings, 2); } }