public void TextInputCommand(KeyEventArgs args) { if (args != null && args.Key == Key.Enter) { ExecuteCurrentCommand(); } if (args != null && args.Key == Key.Back) { if (CurrentCommand.Length > 0) { CurrentCommand = CurrentCommand.Substring(0, CurrentCommand.Length - 1); } } }
bool IKeyboardReader.KeyIsPressed() { if (UnityEngine.Input.GetKeyDown(KeyCode.Backspace)) { CurrentCommand = CurrentCommand.Substring(0, CurrentCommand.Length - 1); Content = Content.Substring(0, Content.Length - 1); } else if (UnityEngine.Input.GetKeyDown(KeyCode.Return)) { WriteCommand("\n"); } else { WriteCommand(UnityEngine.Input.inputString); } return(true); }