void processTyping() { TypedInput.TypedText t = input.ProcessTyping(); typedSoFar = t.text; if (t.finalized) { FinalizeText(); } else { SearchText(); } // if (Input.GetKeyDown(KeyCode.Backspace)) { // if (!typedSoFar.Equals("")){ // typedSoFar = typedSoFar.Substring(0, typedSoFar.Length -1); // Debug.Log(typedSoFar); // SearchText(); // } // } else if (Input.GetKeyDown(KeyCode.Return)) { // FinalizeText(); // } else { // foreach(KeyCode kcode in keycodes) { // if (Input.GetKeyDown(kcode)) { // if (kcode.ToString().Length > 1){ // typedSoFar += keyToString[kcode]; // } else { // typedSoFar += kcode.ToString().ToLower(); // } // Debug.Log(typedSoFar); // SearchText(); // } // } // } }
void Update() { if (activated && count >= 0) { computer.SetActive(true); inputField.enabled = true; prompt.enabled = true; response.enabled = true; talkText.enabled = true; Debug.Log("here"); prompt.enabled = true; prompt.text = promptStr; TypedInput.TypedText tt = ti.ProcessTyping(); if (inputEnabled) { typedSoFar = tt.text; inputField.text = typedSoFar; } if (tt.finalized) { Debug.Log("resetting"); count--; typedSoFar = ""; inputField.text = ""; ti.Clear(); response.text = "Incorrect password!"; response.text += "\nYou have " + count.ToString(); if (count == 1) { response.text += " attempt left."; } else { response.text += " attempts left."; } } if (count == 0) { response.text += "\nYou have been locked out of your computer."; inputEnabled = false; } else if (count > 0 && count < 5) { talkText.text = textResponses[5 - count - 1]; } else if (count < 0) { Terminate(); } Debug.Log("typed so far:" + inputField.text); } }