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); } }
void FinalizeText() { Debug.Log(typedSoFar + " typed!!"); string shifted = ShiftedText(typedSoFar); foreach (string code in specialCodes) { string formattedCode = code.Trim().ToLower(); if (typedSoFar.Equals(formattedCode)) { TerminatePuzzle(); DialogTester.puzzling = false; } } foreach (string txt in textToObj.Keys) { string formattedT = txt.Trim().ToLower(); if (formattedT.Equals(typedSoFar) || formattedT.Equals(shifted)) { if (textToObj[txt].Count > 0) { Text obj = textToObj[txt][0]; if (obj != null) { Destroy(obj); textToObj[txt].RemoveAt(0); Debug.Log("object destroyed!"); } if (textToObj[txt].Count <= 0) { textToObj.Remove(txt); } typedSoFar = ""; input.Clear(); return; } } } typedSoFar = ""; }