Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 4
0
        public void Deselect()
        {
            color = DefaultColor;

            if (IsSelected)
            {
                TextInputController.RemoveTextInputListener();
            }

            IsSelected = false;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
    //---------------------------------------------------------------
    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;
    }
Exemplo n.º 7
0
 public void Click()
 {
     TextInputController.SetTextInputListener((EventArg1 <TextInputEventArgs>)OnClick);
 }