private void Update() { if (Input.GetKeyUp(KeyCode.Escape)) { yesNoDialog.Choice("Are you sure you wish to quit?", ConfirmQuit, CancelQuit); return; } }
private IEnumerator HandleDialogEvent(string name, string args, string dialog, int i) { newI = i; if (name.Equals("Lock Book")) { bool lockBook = System.Boolean.Parse(args.Trim()); left.enabled = !lockBook; right.enabled = !lockBook; leftLock.enabled = lockBook; rightLock.enabled = lockBook; yield return(new WaitForSeconds(0.1f)); result = true; done = true; yield return(true); } else if (name.Equals("Choice")) { string[] choices = args.Split(new char[] { ',' }); int yesChoice = System.Int32.Parse(choices [0].Trim()) - 1; int noChoice = System.Int32.Parse(choices [1].Trim()) - 1; YesNoDialog.dialog = yesNoDialog; yield return(StartCoroutine(YesNoDialog.ShowDialog(dialog))); if (YesNoDialog.Choice()) { newI = yesChoice; } else { newI = noChoice; } yield return(new WaitForSeconds(0.1f)); result = true; done = true; yield return(true); } result = false; done = true; yield return(false); }