Page 1 of 1

Is there any way to just disable the GUI?

Posted: Tue Jul 14, 2015 8:24 am
by bluebuttongames
I already have a GUI custom built, I'm looking to just hook into Dialogue system for the dialogue tree/localisation functionality.

Thanks,

Re: Is there any way to just disable the GUI?

Posted: Tue Jul 14, 2015 9:12 am
by Tony Li
Absolutely! The Dialogue System uses an abstract interface named IDialogueUI that includes methods such as ShowSubtitle() and ShowResponses(). It doesn't care how those methods are implemented, so you're free to provide your own GUI code. You can find a template script in Scripts/Templates/TemplateDialogueUI.cs. Just rename it and fill it in with your hooks. Then add the script to your GUI and assign it to the Dialogue Manager's Dialogue UI field.

Re: Is there any way to just disable the GUI?

Posted: Tue Jul 14, 2015 4:22 pm
by bluebuttongames
That's great. But how do I just literally turn the entire thing off without providing a UI?

Re: Is there any way to just disable the GUI?

Posted: Tue Jul 14, 2015 5:00 pm
by Tony Li
How do you intend to use the Dialogue System?

Do you only want the data structure and localization, with none of the interactive functionality built into the Dialogue System? If this is the case then, briefly, the Dialogue System uses a Model-View-Controller (MVC) architecture. If you're only using it for the data structure, you can create your own instances of ConversationModel and not connect it to any ConversationView or ConversationController. But in this case you're responsible for moving the conversation from one state to the next.

I suspect I might be misunderstanding your needs, however, since this omits a lot of useful functionality. Once I have a clearer idea of what you want to do, I can provide more helpful details.

Re: Is there any way to just disable the GUI?

Posted: Tue Jul 14, 2015 5:27 pm
by bluebuttongames
Yes that's correct, I only want the data structure and localization. I'm fine with being responsible for moving the state of the conversations.

If it clears things up for you I was using another system, in which I managed all the conversation states manually and now I'm looking to integrate yours into my existing code.

Thanks for the help.

Re: Is there any way to just disable the GUI?

Posted: Tue Jul 14, 2015 5:49 pm
by Tony Li
Got it. In that case, the easiest thing is to add a Dialogue Manager GameObject (in actuality it's a DialogueSystemController component on a GameObject named "Dialogue Manager") and leave the Dialogue UI field unassigned. It will load a stub UI, but you can ignore it. If you don't want to load this stub UI, you could make a blank implementation of IDialogueUI using a copy of TemplateDialogueUI.cs, add it to an empty GameObject (such as an empty child of Dialogue Manager), and assign it to the Dialogue UI field.

Technically you can omit the Dialogue Manager entirely, but it handles a lot of stuff for you automatically such as loading the Initial Database and initializing the Lua environment. If you really want to omit Dialogue Manager, then load the dialogue database yourself, set Localization.Language to set the current language, and call DialogueLua.AddChatMapperVariables() to initialize Lua.

Then create a ConversationModel with code similar to this:

Code: Select all

var model = new ConversationModel(yourDatabase, "Title", actorTransform, conversantTransform, false,
                                  yourIsDialogueEntryValidDelegate, initialDialogueEntryID);
if (!model.HasValidEntry) Debug.Log("There aren't any valid dialogue entries at this time.");
The first dialogue entry is in model.FirstEntry, which is a ConversationState.

To change states: (In this example to the first valid NPC response)

Code: Select all

var newState = model.GetState(currentState.FirstNPCResponse.destinationEntry));
ConversationState has three variables:
  • subtitle: The text and other info of this dialogue entry.
  • npcResponses: Valid NPC dialogue entries that link from this entry. (Valid means their Conditions field evaluates to true.)
  • pcResponses: Valid PC dialogue entries that link from this entry.