EditorGUI.actionKey 动作键

static var actionKey : bool

Description描述

Is the platform-dependent "action" modifier key held down? (Read Only)

有平台相关的”action”修改键被按下?(只读)

The key is Command on Mac OS X, Control on Windows.

Mac OS X上为Command键,Windows上为Control (ctrl)键。

EditorGUI.actionKey 激活键

Action Key usage, key not pressed/key pressed.
动作键的用法,键按没按下/按下。

// Shows a password field with some "hidden" text.
//显示密码文本框,具有一些隐藏文本
// When the user presses the action key the password field becomes a text field.
//当用户点击action key,密码文本框转变为普通文本框

class EditorGUIActionKey extends EditorWindow {

	var text : String = "This is some text";

	@MenuItem("Examples/Show Hide password")
	static function Init() {
		var window = GetWindow(EditorGUIActionKey);
		window.position = Rect(0, 0, 250, 60);
		window.Show();
	}
	function OnGUI() {
		// Show the contents 显示内容
		if(EditorGUI.actionKey) {
			text = EditorGUI.TextField(Rect(0, 5, 245, 20), "Shown Text:", text);
		} else {
			// show the pasword field 显示密码文本框
			text = EditorGUI.PasswordField(Rect(0, 5, 245, 20), "Hidden Text:", text);
		}
		if(GUI.Button(Rect(0,30, 250, 20),"Close"))
			this.Close();
	}
	function OnInspectorUpdate() {
		Repaint();
	}
}

 

最后修改:2011年6月22日 Wednesday 9:22

本脚本参考基于Unity 3.4.1f5

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