Exemplo n.º 1
0
 void Awake()
 {
     if (currentBackColor.a == 0) currentBackColor = defaultBackColor;
     if (currentFontColor.a == 0) currentFontColor = defaultFontColor;
     CmdInput.text = CmdEnv;
     SubmittedText = CmdInput.text;
     CmdInput.onValidateInput += delegate (string input, int charIndex, char addedChar) { return Validate(addedChar); };
     CmdInput.onValueChanged.AddListener(delegate
     {
         if (CurrentText.Length > CmdInput.text.Length && CmdInput.caretPosition < SubmittedText.Length)
         {
             CmdInput.SetTextWithoutNotify(CurrentText);
             CmdInput.MoveTextEnd(false);
             CmdInput.caretPosition = SubmittedText.Length;
         }
         StartCoroutine(ScrollToEnd());
     });
     backgroundImg.GetComponent<Button>().onClick.AddListener(delegate { CmdInput.Select(); });
 }