Skip to main content

VirtualInputField

A class in Root.Township, the global namespace.

Client UI: a text field typed into with the in-game virtual keyboard, with a caret, a character limit, optional hidden (secret) text and links to the previous and next fields.

Constructors​

MemberWhat it is
VirtualInputField()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

10 private and internal fields
MemberWhat it is
private AltaEvent backspaceOnEmptyEvent run when backspace is pressed on an empty field.
private Transform caretCaret transform placed after the text.
private TouchScreenKeyboard keyboardIn-world touch screen keyboard that types into this field.
private int maxCharactersLimitMost characters allowed; -1 for no limit.
private VirtualInputField nextField focused when the keyboard asks for the next field.
private AltaEvent nextActionEvent run when the keyboard submits.
private bool nextOnlyWhenHasInputIf true, submitting an empty field does nothing.
private AltaEvent onLostFocusEvent run when the field loses focus.
private VirtualInputField previousField focused when the keyboard asks for the previous field.
private bool showSecretValue returned by IsShowingSecret.

Properties​

MemberWhat it is
int MaxCharactersLimit { get; }Most characters allowed, or -1 for no limit.
VirtualInputField Next { get; }Field to move to after this one.
VirtualInputField Previous { get; }Field to move back to.

Methods​

MemberWhat it is
override void GetFocus()Hands the virtual keyboard to this field with its current text.
void HandleKeyboardInput(string input)Keyboard callback with the new text.
void HandleKeyboardSubmit()Keyboard submit. Runs the next action, only when there is text if set to.
bool IsShowingSecret()Whether the field is set to show secret text.
override void LostFocus()Runs the lost focus event.
void UpdateInput(string input)Sets the text, masking it if secret, and moves the caret.
protected override void Awake()Runs the base setup.
protected override void DisplaySecret(bool isShowingSecret)Shows or hides the secret text and moves the caret.
protected override void UpdateInputWithSecret()Redraws the text masked unless the keyboard is showing secrets.
4 private and internal methods
MemberWhat it is
private void CheckNext()Runs nextAction only if the field has text.
private void IUseVirtualKeyboard.Next()Field to move to after this one.
private void IUseVirtualKeyboard.Previous()Field to move back to.
private void UpdateCaret()Moves the caret to the end of the shown text.

Used in​

Members of other types that take, return or hold a VirtualInputField: