java获得passwordfiled_GUI.PasswordField 密码字段 - Unity5 中文 API 手册

JavaScript => public static function PasswordField(position: Rect, password: string, maskChar: char): string;

JavaScript => public static function PasswordField(position: Rect, password: string, maskChar: char, maxLength: int): string;

JavaScript => public static function PasswordField(position: Rect, password: string, maskChar: char, style: GUIStyle): string;

JavaScript => public static function PasswordField(position: Rect, password: string, maskChar: char, maxLength: int, style: GUIStyle): string;

C# => public static string PasswordField(Rect position, string password, char maskChar);

C# => public static string PasswordField(Rect position, string password, char maskChar, int maxLength);

C# => public static string PasswordField(Rect position, string password, char maskChar, GUIStyle style);

C# => public static string PasswordField(Rect position, string password, char maskChar, int maxLength, GUIStyle style);

Parameters 参数

position

Rectangle on the screen to use for the text field.

用于文本字段在屏幕上矩形的位置。

password

Password to edit. The return value of this function should be assigned back to the string as shown in the example.

编辑的密码,这个函数返回值应该赋回给字符串,看下面的例子。

maskChar

Character to mask the password with.

用于密码的字符遮罩。

maxLength

The maximum length of the string. If left out, the user can type for ever and ever.

控制字符串的最大长度,如果不设置用户可以一直输入。

style

The style to use. If left out, the textField style from the current GUISkin is used.

使用样式,如果不设置,密码字段的样式将应用当前的GUISkin皮肤。

Returns 返回

string The edited password.

返回被编辑的密码。

Description 描述

Make a text field where the user can enter a password.

创建文本字段,用户可以编辑密码。

JavaScript:

var passwordToEdit : String = "My Password";

function OnGUI () {

// Make a password field that modifies passwordToEdit.

passwordToEdit = GUI.PasswordField (Rect (10, 10, 200, 20), passwordToEdit, "*"[0], 25);

}

C#:

using UnityEngine;

using System.Collections;

public class ExampleClass : MonoBehaviour {

public string passwordToEdit = "My Password";

void OnGUI() {

passwordToEdit = GUI.PasswordField(new Rect(10, 10, 200, 20), passwordToEdit, "*"[0], 25);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值