/// <summary> /// Goes to a conversation state. If the state is <c>null</c>, the conversation ends. /// </summary> /// <param name='state'> /// State. /// </param> public void GotoState(ConversationState state) { this.m_state = state; DialogueManager.instance.currentConversationState = state; if (state != null) { // Check for change of conversation: var newConversationID = m_model.GetConversationID(state); if (newConversationID != m_currentConversationID) { m_currentConversationID = newConversationID; m_model.InformParticipants(DialogueSystemMessages.OnLinkedConversationStart, true); m_model.UpdateParticipantsOnLinkedConversation(newConversationID); m_view.SetPCPortrait(m_model.GetPCSprite(), m_model.GetPCName()); SetConversationOverride(state); } // Use view to show current state: if (state.isGroup) { m_view.ShowLastNPCSubtitle(); } else { bool isPCResponseMenuNext, isPCAutoResponseNext; AnalyzePCResponses(state, out isPCResponseMenuNext, out isPCAutoResponseNext); m_view.StartSubtitle(state.subtitle, isPCResponseMenuNext, isPCAutoResponseNext); } } else { Close(); } }
/// <summary> /// Initializes a new ConversationController and starts the conversation in the model. /// Also sends OnConversationStart messages to the participants. /// </summary> /// <param name='model'> /// Data model of the conversation. /// </param> /// <param name='view'> /// View to use to provide a user interface for the conversation. /// </param> /// <param name='endConversationHandler'> /// Handler to call to inform when the conversation is done. /// </param> public ConversationController(ConversationModel model, ConversationView view, bool alwaysForceResponseMenu, EndConversationDelegate endConversationHandler) { isActive = true; this.m_model = model; this.m_view = view; this.m_endConversationHandler = endConversationHandler; model.InformParticipants(DialogueSystemMessages.OnConversationStart); view.FinishedSubtitleHandler += OnFinishedSubtitle; view.SelectedResponseHandler += OnSelectedResponse; m_currentConversationID = model.GetConversationID(model.firstState); SetConversationOverride(model.firstState); GotoState(model.firstState); }