/// <summary> /// Closes the currently-running conversation, which also sends OnConversationEnd messages /// to the participants. /// </summary> public void Close() { if (isActive) { isActive = false; if (DialogueDebug.logInfo) { Debug.Log(string.Format("{0}: Ending conversation.", new System.Object[] { DialogueDebug.Prefix })); } m_view.displaySettings.conversationOverrideSettings = null; m_view.FinishedSubtitleHandler -= OnFinishedSubtitle; m_view.SelectedResponseHandler -= OnSelectedResponse; m_view.Close(); m_model.InformParticipants(DialogueSystemMessages.OnConversationEnd, true); if (m_endConversationHandler != null) { m_endConversationHandler(this); } DialogueManager.instance.currentConversationState = null; } }
/// <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, Action endConversationHandler) { IsActive = true; this.model = model; this.view = view; this.alwaysForceResponseMenu = alwaysForceResponseMenu; this.endConversationHandler = endConversationHandler; model.InformParticipants("OnConversationStart"); view.FinishedSubtitleHandler += OnFinishedSubtitle; view.SelectedResponseHandler += OnSelectedResponse; GotoState(model.FirstState); }
/// <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); }
/// <summary> /// Closes the currently-running conversation, which also sends OnConversationEnd messages /// to the participants. /// </summary> public void Close() { if (IsActive) { IsActive = false; if (DialogueDebug.LogInfo) { Debug.Log(string.Format("{0}: Ending conversation.", new System.Object[] { DialogueDebug.Prefix })); } view.FinishedSubtitleHandler -= OnFinishedSubtitle; view.SelectedResponseHandler -= OnSelectedResponse; view.Close(); model.InformParticipants("OnConversationEnd"); if (endConversationHandler != null) { endConversationHandler(); } DialogueManager.Instance.CurrentConversationState = null; } }