Page 1 of 1

Custom response menu not being a UI

Posted: Tue May 21, 2019 5:46 am
by Nhysi
Hi,

I'm making a narrative game where you play cards instead of selecting a button to interact. So I made my 3D card hand system that instantiate cards for each responses with a linked sprite. (and everything about hand management, grabbing cards, ..) I'm currently trying to integrate my system to work with Dialogue System.

I have read the documentation about TemplateDialogueUI but it looks like it's only designed for UI elements. Can you please help me figure out how I can do this?

This is the first project I've done with Dialogue System and so far it's an incredible tool. Thank you for your work.

Re: Custom response menu not being a UI

Posted: Tue May 21, 2019 9:13 am
by Tony Li
Hi,

Thanks for using the Dialogue System!

If you still want to show subtitle panels, I recommend continuing to use the Standard Dialogue UI for everything except the menu. (For example, the Basic Standard Dialogue UI that's assigned by default to the Dialogue Manager prefab is a Standard Dialogue UI.)

A Standard Dialogue UI is composed of subtitle panels and menu panels. Typically there are two subtitle panels (one for NPCs, one for PCs) and one menu panel.

The StandardDialogueUI script delegates its work to these panels, which are defined by the scripts StandardUISubtitlePanel and StandardUIMenuPanel.

You can write a subclass of StandardUIMenuPanel and override the ShowResponses and HideResponses method. (You may also want to override other methods, too, depending on what you need to show and what functionality you want to replace.) ShowResponses() receives an array of Response objects and a target, which is the dialogue UI. Associate a card with each Response object. When the player plays a card, call this code:

Code: Select all

target.SendMessage("OnClick", response);
Then set up a menu panel using your subclass, even if the panel is just an empty GameObject in the dialogue UI. It will exist only to hold your script. Assign it to the StandardDialogueUI's Menu Panels list and Default Menu Panel field.

If you don't want to inherit StandardDialogueUI, you can make a subclass of AbstractDialogueUI instead. This gives you a little more of a head start than the blank TemplateDialogueUI.cs.

But if you want to implement the entire UI from scratch without anything from AbstractDialogueUI, you can certainly use TemplateDialogueUI. It doesn't make any assumptions about UI elements. It has method stubs such as ShowSubtitle and ShowResponses but it doesn't care how you implement them. Some devs have implemented them using text-to-speech and voice recognition for virtual assistants and Amazon Echo apps, others have implemented them using gestures in VR, etc.