Page 2 of 2

Re: multiple Textline Dialog UI in a scene

Posted: Fri Dec 06, 2019 5:26 pm
by Tony Li
If you call the Close() method of a specific TextlineDialogueUI component, it should only close that dialogue UI.

However, if you want to stop the conversation early, and not just close its dialogue UI, you'll want to do something slightly different.

When you start a conversation, the Dialogue System adds an ActiveConversationRecord object to the DialogueManager.instance.activeConversations list. The most recently-started conversation is at the end of the list. So maybe you'd want to record it like this:

Code: Select all

using System.Linq;
...
DialogueManager.StartConversation("Some Conversation");
var thisConversationRecord = DialogueManager.instance.activeConversations.Last();
The ActiveConversationRecord has a conversationController. If you call its Close() method, it will fully stop the entire conversation and close the associated dialogueUI:

Code: Select all

thisConversationRecord.conversationController.Close();

Re: multiple Textline Dialog UI in a scene

Posted: Fri Dec 06, 2019 6:57 pm
by Tetralogia
Whether I use base.Close() or thisConversationRecord.conversationController.Close(), the result is the same. I may be doing something wrong though.

I have two simultaneous conversations :

Image

and when the last entry of the second conversation (on the right) is reached, it closes its dialog UI, but it also seems to be erasing the previous lines in the first conversation :

Image

Re: multiple Textline Dialog UI in a scene

Posted: Fri Dec 06, 2019 9:02 pm
by Tony Li
Hi,

Can you please compare it to this example scene:

DS_Test2TextlineUIs_2019-12-06.unitypackage

You can play each conversation to the end, or you can click the "Cancel A Conversation" button to cancel one of them. The other one should stay visible and intact.

Re: multiple Textline Dialog UI in a scene

Posted: Sat Dec 07, 2019 4:50 am
by Tetralogia
Hi Tony!

Thanks to your example I found what I was doing wrong in my project: all my Textline Dialogue UIs were in the same canvas. I should have thought about that.

Thanks a lot for your example scene!

Re: multiple Textline Dialog UI in a scene

Posted: Sat Dec 07, 2019 8:40 am
by Tony Li
Hi,

You can make a subclass of TextlineDialogueUI and add a method to clear the content:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem.Extras;
public class CustomTextlineDialogueUI : TextlineDialogueUI
{
        public void ClearCurrentContent()
        {
            records.Clear();
            DestroyInstantiatedMessages();
        }
}
Then call ClearCurrentContent() when you want to clear the content to reuse the UI without closing it.

Re: multiple Textline Dialog UI in a scene

Posted: Sun Dec 08, 2019 5:24 am
by Tetralogia
Ok nice! Thanks :)