Expand dialogue for more details

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Anomalous
Posts: 3
Joined: Wed Jul 08, 2015 12:49 pm

Expand dialogue for more details

Post 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 1088 times
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Expand dialogue for more details

Post 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?
Anomalous
Posts: 3
Joined: Wed Jul 08, 2015 12:49 pm

Re: Expand dialogue for more details

Post 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.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Expand dialogue for more details

Post 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.
Anomalous
Posts: 3
Joined: Wed Jul 08, 2015 12:49 pm

Re: Expand dialogue for more details

Post 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?
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Expand dialogue for more details

Post 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.
Post Reply