EditorGUILayout.IntPopup 整数弹出选择菜单

static function IntPopup (selectedValue : int, displayedOptions : string[], optionValues : int[], params options : GUILayoutOption[]) : int
static function IntPopup (selectedValue : int, displayedOptions : string[], optionValues : int[], style : GUIStyle, params options : GUILayoutOption[]) : int
static function IntPopup (selectedValue : int, displayedOptions : GUIContent[], optionValues : int[], params options : GUILayoutOption[]) : int
static function IntPopup (selectedValue : int, displayedOptions : GUIContent[], optionValues : int[], style : GUIStyle, params options : GUILayoutOption[]) : int
static function IntPopup (label : string, selectedValue : int, displayedOptions : string[], optionValues : int[], params options : GUILayoutOption[]) : int
static function IntPopup (label : string, selectedValue : int, displayedOptions : string[], optionValues : int[], style : GUIStyle, params options : GUILayoutOption[]) : int
static function IntPopup (property : SerializedProperty, displayedOptions : GUIContent[], optionValues : int[], label : GUIContent, params options : GUILayoutOption[]) : void
static function IntPopup (property : SerializedProperty, displayedOptions : GUIContent[], optionValues : int[], label : GUIContent, style : GUIStyle, params options : GUILayoutOption[]) : void
static function IntPopup (label : GUIContent, selectedValue : int, displayedOptions : GUIContent[], optionValues : int[], params options : GUILayoutOption[]) : int
static function IntPopup (label : GUIContent, selectedValue : int, displayedOptions : GUIContent[], optionValues : int[], style : GUIStyle, params options : GUILayoutOption[]) : int

Parameters参数

Returns

int - The value of the option that has been selected by the user.

返回整数,用户选择的选项的值。

Description描述

Make an integer popup selection field.

制作一个整数弹出选择字段。

Takes the currently selected integer as a parameter and returns the integer selected by the user.

采用当前选择的整数作为参数并返回用户选择的整数。

EditorGUILayout.IntPopup 整数弹出选择菜单

Rescales the current selected GameObject.
重新调整当前选项的游戏物体。

// Simple Editor Script that lets you rescale the current selected GameObject.

//重新调整当前选项的游戏物体。

class EditorGUILayoutIntPopup extends EditorWindow {

	var selectedSize : int = 1;

	var names : String[] = ["Normal", "Double", "Quadruple"];

	var sizes : int[] = [1,2,4];



	@MenuItem("Examples/Editor GUILayout Int Popup usage")

	static function Init() {

		var window = GetWindow(EditorGUILayoutIntPopup);

		window.Show();

	}

	function OnGUI() {

		selectedSize = EditorGUILayout.IntPopup("Resize Scale: ", selectedSize, names, sizes);

		if(GUILayout.Button("Scale"))

			ReScale();

	}

	function ReScale() {

		if(Selection.activeTransform)

			Selection.activeTransform.localScale =

				Vector3(selectedSize, selectedSize, selectedSize);

		else Debug.LogError("No Object selected, please select an object to scale.");

	}

}
Page last updated: 2011-7-14