public void Continue() { if (mDialogEntries.Count == 0) { if (mDismissedCallback != null) { mDismissedCallback(0); mDismissedCallback = null; } return; } DialogEntry entry = mDialogEntries[0]; mDialogEntries.RemoveAt(0); AudioPlayer.PlaySound(entry.audio); if (entry.isInfoExchangeRequest) { UIController.Get().ShowMessage( entry.speaker, entry.sprites, entry.message, new string[] { "Yes", "No" }, new UIButtonCallback[] { buttonIndex => { InsertInformationExchange(0); Continue(); }, buttonIndex => { InsertDialogue(0, entry.speaker, entry.sprites, "Alright. Let's talk more later."); Continue(); }, }); } else if (entry.isInfoExchange) { if (entry.speaker.IsPlayer) { // Show prompt, and share the result with other participants of this dialog UIController.Get().AskForSentence(entry.sprites, sentence => { ShareInfo(GameState.Get().Player, sentence); Continue(); }); } else { // The GameState round-clues is guaranteed to be a recent clue that is not the result of combining multiple clues ClueInfo clueInfo = GameState.Get().mRoundClues[entry.speaker.PersonId]; string message; if (clueInfo != null) { Sentence newInfo = clueInfo.GetSentence(); message = "I found out " + entry.speaker.Speak(newInfo); // TODO: Announce the room where it was found if (newInfo.Subject.Type() == NounType.Unique) { message = "I found " + entry.speaker.Speak(newInfo); // TODO: Announce the room where it was found } ShareInfo(entry.speaker, newInfo); PlayerJournal.AddListen(entry.speaker.PersonId, newInfo); } else { message = "I found nothing."; } UIController.Get().ShowMessage(entry.speaker, entry.sprites, message, new string[] { "Continue" }, new UIButtonCallback[] { buttonIndex => Continue() }); } } else if (entry.isCustomSentence) { UIController.Get().AskForSentence(new Sprite[] { }, sentence => { if (entry.customSentenceCallback != null) { entry.customSentenceCallback(sentence); } Continue(); }, entry.subjectOverrides, entry.objectOverrides); } else // a regular message, just show it { UIController.Get().ShowMessage(entry.speaker, entry.sprites, entry.message, new string[] { "Continue" }, new UIButtonCallback[] { buttonIndex => Continue() }); } }
public DialogBlock(PersonState[] participants, UIButtonCallback endDialogCallback = null) { Participants = participants; mDismissedCallback = endDialogCallback; }