コード例 #1
0
        public override void OnDestroy()
        {
            base.OnDestroy();

            if (IsSelected)
            {
                TextInputController.RemoveTextInputListener();
            }
        }
コード例 #2
0
    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);
    }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
        public void Deselect()
        {
            color = DefaultColor;

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

            IsSelected = false;
        }
コード例 #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;
        }
コード例 #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;
    }
コード例 #7
0
 public void Click()
 {
     TextInputController.SetTextInputListener((EventArg1 <TextInputEventArgs>)OnClick);
 }