GUI
- backgroundColor
- BeginGroup
- BeginScrollView
- Box
- BringWindowToBack
- BringWindowToFront
- Button
- changed
- color
- contentColor
- depth
- DragWindow
- DrawTexture
- enabled
- EndGroup
- EndScrollView
- FocusControl
- FocusWindow
- GetNameOfFocusedControl
- GUI
- HorizontalScrollbar
- HorizontalSlider
- Label
- matrix
- PasswordField
- RepeatButton
- ScrollTo
- SelectionGrid
- SetNextControlName
- skin
- TextArea
- TextField
- Toggle
- Toolbar
- tooltip
- UnfocusWindow
- VerticalScrollbar
- VerticalSlider
- Window
GUI.PasswordField 密码字段
static function PasswordField (position : Rect, password : String, maskChar : char) : String
static function PasswordField (position : Rect, password : String, maskChar : char, maxLength : int) : String
static function PasswordField (position : Rect, password : String, maskChar : char, style : GUIStyle) : String
static function PasswordField (position : Rect, password : String, maskChar : char, maxLength : int, style : GUIStyle) : String
Parameters参数
- positionRectangle on the screen to use for the text field.
用于文本字段在屏幕上矩形的位置。 - PasswordPassword to edit. The return value of this function should be assigned back to the string as shown in the example.
编辑的密码,这个函数返回值应该赋回给字符串,看下面的例子。 - maskCharCharacter to mask the password with.
用于密码的字符遮罩。 - maxLengthThe maximum length of the string. If left out, the user can type for ever and ever.
控制字符串的最大长度,如果不设置用户可以一直输入。 - styleThe style to use. If left out, the textField style from the current GUISkin is used.
使用样式,如果不设置,密码字段的样式将应用当前的GUISkin皮肤。
string - the edited password.
返回被编辑的密码。
Description描述
Make a text field where the user can enter a password.
创建文本字段,用户可以编辑密码。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public string passwordToEdit = "My Password";
void OnGUI() {
passwordToEdit = GUI.PasswordField(new Rect(10, 10, 200, 20), passwordToEdit, "*"[0], 25);
}
}
var passwordToEdit : String = "My Password";
function OnGUI () {
// 创建一个密码字段,用户可以编辑密码
passwordToEdit = GUI.PasswordField (Rect (10, 10, 200, 20), passwordToEdit, "*"[0], 25);
}
最后修改:2011年1月14日 Friday 21:30