Page 1 of 1

Expand dialogue for more details

Posted: Wed Jul 08, 2015 1:03 pm
by Anomalous
Hi, to save space for a mobile project, I'd like to have a list of summaries that the player can tap to expand to reveal more details, and tap again to hide the details. Is it possible to do this with Dialogue System? Thanks in advance.
Example.png
Example.png (66.91 KiB) Viewed 1051 times

Re: Expand dialogue for more details

Posted: Wed Jul 08, 2015 10:48 pm
by Tony Li
This is absolutely do-able. In fact, your project wouldn't be the first to do something like this. One game changed the button text if the mouse was hovering over a button. Another game displayed the expanded text in a separate text area.

Both games stored the summaries in the Menu Text field and the details in the Dialogue Text field.

To implement this, create a subclass of your dialogue UI (e.g., a subclass of UnityUIDialogueUI) and override the ShowResponses method. Change the buttons so they call your own click-handling method instead of the default response button method (UnityUIDialogueUI.OnClick). In your method, change the button's text. In Unity UI, response buttons have a UnityUIResponseButton component. You can change the button text to Dialogue Text with code similar to this:

Code: Select all

var responseButton = myButton.GetComponent<UnityUIResponseButton>();
responseButton.Text = responseButton.response.destinationEntry.DialogueText;
I'd provide more code, but I have a question: If the player taps the button to toggle between summary and details, how does the player actually "click" the button to select a response?

Re: Expand dialogue for more details

Posted: Thu Jul 09, 2015 4:08 am
by Anomalous
Thanks! I will buy Dialogue System then. The player isn't intended to select a response, the purpose is just to display information.

Re: Expand dialogue for more details

Posted: Thu Jul 09, 2015 10:10 am
by Tony Li
Sounds good! If you have any questions as you dig into the Dialogue System, don't hesitate to ask here or email me directly at tony (at) pixelcrushers.com.

Re: Expand dialogue for more details

Posted: Thu Jul 23, 2015 2:48 pm
by Anomalous
Thanks! A related question: Right now when I have too much dialogue text the button truncates it. Is it possible to implement a button that resizes itself to display all of its text?

Re: Expand dialogue for more details

Posted: Thu Jul 23, 2015 3:12 pm
by Tony Li
Absolutely. It's easiest to do in Unity UI, since you can use Content Size Fitters and Layout components, and Unity UI has a good set of tutorials. See the Unity UI "Nuke" dialogue UI for an example.