本文整理汇总了C#中InputField.ActivateInputField方法的典型用法代码示例。如果您正苦于以下问题:C# InputField.ActivateInputField方法的具体用法?C# InputField.ActivateInputField怎么用?C# InputField.ActivateInputField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputField
的用法示例。
在下文中一共展示了InputField.ActivateInputField方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
input = gameObject.GetComponentsInChildren<InputField>()[0];
input.ActivateInputField();
input.onEndEdit.AddListener (OnSubmit);
input.Select();
}
示例2: Start
/// <summary>
/// Get the `InputField` child object of this gameObject
/// and activate it so the user does not have to
/// click on it prior to entering a number.
/// </summary>
public void Start()
{
inputField = GetComponentInChildren<InputField>();
if (inputField == null) {
throw new MissingComponentException();
}
inputField.ActivateInputField();
}
示例3: SubmitCommand
public void SubmitCommand(InputField inputField)
{
var cmd = inputField.text;
AppendTextToConsole("> " + cmd + "\n");
inputField.text = "";
inputField.Select();
inputField.ActivateInputField();
ParseCommand(cmd);
}
示例4: Update
// Update is called once per frame
void Update()
{
if (activeRitual)
{
inputFieldObj.SetActive(true);
inputField = inputFieldObj.GetComponent<InputField>();
inputField.Select();
inputField.ActivateInputField();
if (initRitual == false)
{
initRitual = true;
inputField.text = "Enter Password; ";
}
if (Input.GetKeyDown(KeyCode.Return))
{
if (passwordEntered == false)
{
passwordEntered = true;
if (inputField.text.CompareTo(password) == 0)
{
passwordCorrect = true;
inputField.text = "password correct\nplease right click";
}
else
{
passwordCorrect = false;
inputField.text = "password incorrect";
Application.LoadLevel("level");
}
}
else
{
inputField.text = DoComputerStuff(inputField.text);
}
}
if (Input.GetMouseButtonDown(1))
{
inputFieldObj.SetActive(false);
activeRitual = false;
Debug.Log("PC Ritual");
}
}
}
示例5: OnInputEnter
public void OnInputEnter(InputField inputField)
{
// First Name only.
if (Regex.IsMatch (inputField.text, "^[A-Z]?[a-z]{2,14}$"))
{
GameManager.Instance.SetPlayerName (inputField.text);
if(GameManager.Instance.doLoadTutorial)
Application.LoadLevel ("Tutorial");
else
Application.LoadLevel ("Level 1");
}
else
{
inputField.text = "";
inputField.placeholder.GetComponent<Text>().text = "Invalid Name";
inputField.ActivateInputField();
}
}
示例6: EnsureInputFieldCoroutine
private IEnumerator EnsureInputFieldCoroutine(InputField inputField)
{
yield return null;
while(!TouchScreenKeyboard.visible && inputField.text.Length == 0)
{
inputField.ActivateInputField();
inputField.Select();
yield return null;
}
}
示例7: ValChanged
public void ValChanged(InputField field)
{
if (field.text.Length > 0)
{
playerName = field.text;
Application.LoadLevel(7);
}
else{
field.placeholder.GetComponent<Text>().text = "Please enter a name";
field.ActivateInputField();
field.Select();
}
}
示例8: ActivateInputFieldWithoutSelection
IEnumerator ActivateInputFieldWithoutSelection(InputField inputField)
{
inputField.ActivateInputField();
// wait for the activation to occur in a lateupdate
yield return new WaitForEndOfFrame();
// make sure we're still the active ui
if (EventSystem.current.currentSelectedGameObject == inputField.gameObject)
{
// To remove hilight we'll just show the caret at the end of the line
inputField.MoveTextEnd(false);
}
}