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.
Expand dialogue for more details
Re: Expand dialogue for more details
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:
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?
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;
Re: Expand dialogue for more details
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
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
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
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.