public override void OnDestroy() { base.OnDestroy(); if (IsSelected) { TextInputController.RemoveTextInputListener(); } }
GameObject InstantiateStringInput(UserDefinedConstants.Entry <string> entry) { var obj = Instantiate(stringInputPrefab, settingsContainer.transform); TextInputController text = obj.GetComponent <TextInputController>(); text.key = entry._name; text.value = entry; text.label = entry._label; return(obj); }
protected override void OnPreviewTextInput(TextCompositionEventArgs e) { Regex re = new Regex(@"\W", RegexOptions.IgnoreCase); bool b = re.IsMatch(e.Text); if (b) { TextInputController.Override(this, e); return; } }
public void Deselect() { color = DefaultColor; if (IsSelected) { TextInputController.RemoveTextInputListener(); } IsSelected = false; }
private void InputChanged(TextInputEventArgs args) { Text = TextInputController.NewInput(args, Text); if (Text.Length > maxLength) { //Limit the length of the input text: Text = Text.Substring(0, maxLength); } inputFieldText.Text = string.IsNullOrWhiteSpace(Text) ? placeholderText : Text; }
//--------------------------------------------------------------- public void GetTextFromInputField() { string input = ""; //Find the input field game object //As there s only Input Field GameObject as child of the input panel, its index is 0 GameObject inputFieldGameObj = inputPanel.transform.GetChild(0).gameObject; TextInputController inputController = inputFieldGameObj.GetComponent <TextInputController> (); if (inputController.GetIsTextCommitable()) { InputField inputField = inputFieldGameObj.GetComponent <InputField> (); input = inputField.text; inputField.text = ""; } Debug.Log("input is: " + input); //return input; }
public void Click() { TextInputController.SetTextInputListener((EventArg1 <TextInputEventArgs>)OnClick); }