Hi!
I'm creating a messenger-like system and running into some problems. What I try to achieve is controlling multiple conversations individually. For instance,
I have started 2 conversations by script (DialogueManager.StartConversation(...)). Both conversations go on simultaneously and player can switch between 2 panels by turning on/off the panel.
- Conversation A (with Dialogue Panel A) [Speaker: Player, Listener: NPC-A]
- Conversation B (with Dialogue Panel B) [Speaker: Player, Listener: NPC-B]
However, I cannot figure out how to specify one conversation and stop it individually. When I call DialogueManager.StopConversation(), all conversations stop.
Is there a way specify conversations or stop conversations individually?
Thanks in advance!
Questions about controlling multiple conversations individually
-
- Posts: 14
- Joined: Tue Dec 08, 2020 6:33 am
Re: Questions about controlling multiple conversations individually
Hi,
Yes. DialogueManager.instance.activeConversations has information about each conversation. It's a list of ActiveConversationRecords.
When you start a conversation using DialogueManager.StartConversation(), its info will be added as the last ActiveConversationRecord:
To stop an individual conversation, call the Close() method on its ConversationController. Example:
If you're using continue buttons, you can advance a specific conversation by calling its ConversationView's OnContinueConversation method. You also need to specify its dialogue UI:
Yes. DialogueManager.instance.activeConversations has information about each conversation. It's a list of ActiveConversationRecords.
When you start a conversation using DialogueManager.StartConversation(), its info will be added as the last ActiveConversationRecord:
Code: Select all
DialogueManager.StartConversation("Foo");
ActiveConversationRecord fooConversation = DialogueManager.instance.activeConversations.Last(); // (Uses System.Linq Last() extension method for shorter code example.)
Code: Select all
fooConversation.conversationController.Close();
Code: Select all
var dialogueUI = fooConversation.conversationView.displaySettings.dialogueUI.GetComponent(typeof(IDialogueUI));
fooConversation.conversationView.OnContinueConversation(dialogueUI);
-
- Posts: 14
- Joined: Tue Dec 08, 2020 6:33 am
Re: Questions about controlling multiple conversations individually
Thank you for saving my day!
It works perfectly!
It works perfectly!