/// <summary> /// Handle Virtual Keyboard Actions. /// </summary> /// <param name="command"></param> public void HandleMessage(string command) { switch (command) { case Constants.CASE_TAP: if (j_prevButton == command && j_counter < j_doubleTapDelay) { j_counter = j_doubleTapDelay + 1; isUpperCase = isTempUpper = true; } else { if (isUpperCase) { isUpperCase = isTempUpper = false; } else { isTempUpper = !isTempUpper; } } string cntrl = isTempUpper ? Constants.CASE_UPPER : Constants.CASE_LOWER; if (j_handler != null) { j_handler(cntrl); } break; case Constants.BACK_SPACE: if (j_input == null || j_input.Text.Length <= 0) { break; } if (j_prevButton == command && j_counter < j_doubleTapDelay) { j_input.Text = ""; suggestedText.text = cachedTex = ""; ellipsistext = ""; } else { j_input.Text = j_input.Text.Substring(0, j_input.Text.Length - 1); if (j_input.Text.Length < cachedTex.Length) { cachedTex = j_input.Text; // j_input.Text.Substring(cachedTex.Length, j_input.Text.Length - cachedTex.Length); } } break; case Constants.ALPHABETS: if (alphabets.activeInHierarchy) { break; } special_characters.SetActive(false); alphabets.gameObject.SetActive(true); special_charactersText.SetActive(false); alphabetsText.gameObject.SetActive(true); break; case Constants.SPECIAL_CHARACTERS: if (special_characters.activeInHierarchy) { break; } alphabets.gameObject.SetActive(false); special_characters.SetActive(true); if (special_charactersText != null) { special_charactersText.SetActive(true); } if (alphabetsText != null) { alphabetsText.gameObject.SetActive(false); } break; case Constants.ENTER: j_input.HandleKeyboardEnterKey(); HideKeyBoard(); break; case Constants.NEWLINE: if (j_input.isMultiLineSupported()) { j_input.Text += "\n"; } break; case Constants.VOICECOMMAND: if (j_input != null) { JMRVoiceManager.Instance.ShowVoiceToolkit(); voiceCommandField = j_input; isListeningForVoiceCommand = true; HideKeyBoard(true, true); } break; default: if (command == " " && (j_input == null)) { break; } j_input.Text += command; break; } if (j_prevButton != Constants.CASE_TAP && !isUpperCase) { j_counter = 0; } if (isTempUpper && Constants.CASE_TAP != command && !isUpperCase) { j_handler(Constants.CASE_LOWER); isTempUpper = false; } if (command != Constants.CASE_TAP) { OnKeyPressed?.Invoke(command); } j_prevButton = command; }