messaging-app-like UI
-
- Posts: 45
- Joined: Wed Jan 09, 2019 7:49 am
messaging-app-like UI
Hi,
I'd like to display the conversations I'm creating with the Dialog System plug-in in a smartphone-messaging-app-like UI, as in the sketch below.
I've built the basic architecture within Unity but I don't know how to go about making it work with the plug-in, especially how to instantiate a new subtitle panel for each dialog entry. Should I do it by script or is there a box to tick somewhere ?
Thanks!
I'd like to display the conversations I'm creating with the Dialog System plug-in in a smartphone-messaging-app-like UI, as in the sketch below.
I've built the basic architecture within Unity but I don't know how to go about making it work with the plug-in, especially how to instantiate a new subtitle panel for each dialog entry. Should I do it by script or is there a box to tick somewhere ?
Thanks!
Re: messaging-app-like UI
Hi,
You might want to start with the Textline template, which is available on the Dialogue System Extras page. It instantiates a new subtitle panel for each "message". It might be a good starting point. To try it out, import the Dialogue System, Menu Framework (also available on the Extras page), and Textline. Then add the example scenes and play the start scene.
You might want to start with the Textline template, which is available on the Dialogue System Extras page. It instantiates a new subtitle panel for each "message". It might be a good starting point. To try it out, import the Dialogue System, Menu Framework (also available on the Extras page), and Textline. Then add the example scenes and play the start scene.
-
- Posts: 45
- Joined: Wed Jan 09, 2019 7:49 am
Re: messaging-app-like UI
Oh that's perfect! Thanks a lot!
Just one thing, I seem to be missing some assets in my project :
And I've got a bunch of errors related to MenuUtility.cs
Just one thing, I seem to be missing some assets in my project :
And I've got a bunch of errors related to MenuUtility.cs
Re: messaging-app-like UI
Did you import the Menu Framework, too?
-
- Posts: 45
- Joined: Wed Jan 09, 2019 7:49 am
Re: messaging-app-like UI
Hi, sorry it took me so long to reply, I was finishing another video game. I had indeed forgotten to import the Menu Framework, thanks!
But I didn’t need it in the end. I took the phone UI prefab from the Textline package and put it in the standard Dialogue Manager so I could have the phone menu and the conversations in the same scene. I created a menu with buttons to start the corresponding conversation, but there’s two things I was wondering :
- Is there a way to put a conversation on hold, leaving it at any moment to start another conversation, and returning to it later (without changing scene) ?
- Can I have some messages that are already displayed when I start the conversations, indicating the characters already chatted before ?
Thanks
But I didn’t need it in the end. I took the phone UI prefab from the Textline package and put it in the standard Dialogue Manager so I could have the phone menu and the conversations in the same scene. I created a menu with buttons to start the corresponding conversation, but there’s two things I was wondering :
- Is there a way to put a conversation on hold, leaving it at any moment to start another conversation, and returning to it later (without changing scene) ?
- Can I have some messages that are already displayed when I start the conversations, indicating the characters already chatted before ?
Thanks
Re: messaging-app-like UI
Hi,
To put a conversation on hold, call the TextlineDialogueUI's OnRecordPersistentData() method. This saves the current state of the conversation. Example:
To resume a conversation using TextlineDialogueUI, set the dialogue variable "Conversation" and call OnApplyPersistentData(). Example:
Without TextlineDialogueUI, normally you'd record the position of the conversation before stopping, and then restart the conversation at that point. Example:
However, this doesn't keep a history like TextlineDialogueUI does.
There is also a Conversation State Saver component, but it only saves the state of the currently-active conversation. If you save the game while a conversation is active, and then reload the saved game, it will resume the conversation at that point. But if you save the game while no conversation is active, it will not resume any conversation.
1. Add dialogue entry nodes to the beginning of the conversation, and set their Sequence fields to None(). When you start a conversation, it will blast through these nodes until it gets to a node with a different Sequence. However, if you've configured Pre Delay Settings, each of these nodes will delay for the specified duration.
2. Or, preconfigure the "history" of the conversation. This requires getting under the hood a bit more than #1, but it also bypasses the caveats of #1. Say you have a conversation named "Bob". TextlineDialogueUI stores the history of this conversation in a dialogue variable named DialogueEntryRecords_Bob, in this format:
The first # is the number of dialogue entries in the history.
Each pair of #'s after that indicates a conversation ID and an entry ID. For example:
means the history has 3 entries: [1:1], [1:3], and [1:7]. The first entry is conversation ID 1, entry ID 1. The second entry is conversation ID 1, entry ID 3. And the third entry is conversation ID 1, entry ID 7.
Of course, if none of these fit exactly what you want to do, you're also free to write your own dialogue UI. The Dialogue System doesn't hold you to any of the built-in UI implementations.
If it's a TextlineDialogueUI conversation, first make sure Use Conversation Variable is ticked. This allows it to record the states of more than one conversation.Tetralogia wrote: ↑Tue Jan 29, 2019 10:09 am- Is there a way to put a conversation on hold, leaving it at any moment to start another conversation, and returning to it later (without changing scene) ?
To put a conversation on hold, call the TextlineDialogueUI's OnRecordPersistentData() method. This saves the current state of the conversation. Example:
Code: Select all
FindObjectOfType<TextlineDialogueUI>().OnRecordPersistentData();
DialogueManager.StopConversation();
Code: Select all
DialogueLua.SetVariable("Conversation", "Your Conversation Title");
FindObjectOfType<TextlineDialogueUI>().OnApplyPersistentData();
Code: Select all
int lastEntryID = DialogueManager.currentConversationState.subtitle.dialogueEntry.id;
DialogueManager.StopConversation();
...
DialogueManager.StartConversation(DialogueManager.lastConversationStarted, player, npc, lastEntryID);
There is also a Conversation State Saver component, but it only saves the state of the currently-active conversation. If you save the game while a conversation is active, and then reload the saved game, it will resume the conversation at that point. But if you save the game while no conversation is active, it will not resume any conversation.
I can think of two ways to do this.Tetralogia wrote: ↑Tue Jan 29, 2019 10:09 am- Can I have some messages that are already displayed when I start the conversations, indicating the characters already chatted before ?
1. Add dialogue entry nodes to the beginning of the conversation, and set their Sequence fields to None(). When you start a conversation, it will blast through these nodes until it gets to a node with a different Sequence. However, if you've configured Pre Delay Settings, each of these nodes will delay for the specified duration.
2. Or, preconfigure the "history" of the conversation. This requires getting under the hood a bit more than #1, but it also bypasses the caveats of #1. Say you have a conversation named "Bob". TextlineDialogueUI stores the history of this conversation in a dialogue variable named DialogueEntryRecords_Bob, in this format:
Code: Select all
"#;#;#;..."
Each pair of #'s after that indicates a conversation ID and an entry ID. For example:
Code: Select all
3;1;1;1;3;1;7
Of course, if none of these fit exactly what you want to do, you're also free to write your own dialogue UI. The Dialogue System doesn't hold you to any of the built-in UI implementations.
-
- Posts: 45
- Joined: Wed Jan 09, 2019 7:49 am
Re: messaging-app-like UI
Thanks a lot, it worked out for me!
Last question (I think) : When i reach the last entry of a conversation, it disables the Dialogue Panel and resets the whole conversation from the start. How do I prevent that, so I can go back to a finished conversation and re-read it?
Last question (I think) : When i reach the last entry of a conversation, it disables the Dialogue Panel and resets the whole conversation from the start. How do I prevent that, so I can go back to a finished conversation and re-read it?
Re: messaging-app-like UI
One way is to make a subclass of TextlineDialogueUI. Override the Close() method:Tetralogia wrote: ↑Wed Jan 30, 2019 12:47 pmLast question (I think) : When i reach the last entry of a conversation, it disables the Dialogue Panel and resets the whole conversation from the start. How do I prevent that, so I can go back to a finished conversation and re-read it?
Code: Select all
public override void Close()
{
OnRecordPersistentData(); // Save the conversation at the end.
base.Close(); // Then allow it to close.
}
-
- Posts: 45
- Joined: Wed Jan 09, 2019 7:49 am
Re: messaging-app-like UI
I may have done something wrong, I'm not familiar with method overriding (kind of new to programming) :
- I created a subclass to TextlineDialogueUI
- I wrote an override method Close() with OnRecordPersistentData();
- I'm calling it at the last entry of my conversation
I commented out base.Close() both on my subclass and on TextlineDialogueUI because I actually never need a conversation to be closed. When I reach the end of the conversation, its current state is saved, but if I go back to it later, it restores the conversation from DialogueEntryRecords_"ConversationTitle" : 0.
- I created a subclass to TextlineDialogueUI
- I wrote an override method Close() with OnRecordPersistentData();
- I'm calling it at the last entry of my conversation
I commented out base.Close() both on my subclass and on TextlineDialogueUI because I actually never need a conversation to be closed. When I reach the end of the conversation, its current state is saved, but if I go back to it later, it restores the conversation from DialogueEntryRecords_"ConversationTitle" : 0.
Re: messaging-app-like UI
The Close() method should close the dialogue UI, so call both lines:
Don't comment out base.Close() in either class.
To keep the conversation at the last entry, instead set its Sequence field to:
To replace TextlineDialogueUI with your custom subclass:
1. Inspect the dialogue UI GameObject.
2. From the Inspector's three-bar menu in the upper right, select Debug.
3. Drag your custom subclass script into the TextlineDialogueUI component's Script field.
4. From the Inspector's three-bar menu in the upper right, switch back to Normal.
Code: Select all
OnRecordPersistentData(); // Save the conversation at the end.
base.Close(); // Then allow it to close.
To keep the conversation at the last entry, instead set its Sequence field to:
Code: Select all
WaitForMessage(Forever)
1. Inspect the dialogue UI GameObject.
2. From the Inspector's three-bar menu in the upper right, select Debug.
3. Drag your custom subclass script into the TextlineDialogueUI component's Script field.
4. From the Inspector's three-bar menu in the upper right, switch back to Normal.