Page 1 of 1

Yes and No buttons rather than continue?

Posted: Thu Nov 26, 2020 8:40 pm
by TecD
Hi,

Is it possible to change the continue button to two buttons, one of them yes and the other no?

and I am also trying to pass the result onto my code, whcih I am struggling to figure out how to do.
(I have tried var resp = DialogueLua.GetVariable("Response"); // with response setup as a variable.


Image

Re: Yes and No buttons rather than continue?

Posted: Thu Nov 26, 2020 8:50 pm
by TecD
Figured out how to do the variable at least:

bool resp = DialogueLua.GetVariable("Response").asBool

Not sure how to get it at the correct time (after player has clicked appropriate button).

Re: Yes and No buttons rather than continue?

Posted: Thu Nov 26, 2020 9:16 pm
by TecD
TecD wrote: Thu Nov 26, 2020 8:50 pm Not sure how to get it at the correct time (after player has clicked appropriate button).
Using event for this. Works ok. So just this question left:

Is it possible to change the continue button to two buttons, one of them yes and the other no?

Re: Yes and No buttons rather than continue?

Posted: Thu Nov 26, 2020 10:08 pm
by Tony Li
Hi,

Quick comment on the variable: You can also register a C# method with Lua and use that in the Script field. (video tutorial)

Yes, it's possible to add more buttons to the dialogue UI. I recommend adding the Yes and No buttons to your subtitle panel(s). If you want them to immediately continue the conversation, connect their OnClick() events to the dialogue UI's StandardDialogueUI.OnContinueConversation method. If you want the first click to fast-forward the typewriter and the second to continue, add a StandardUIContinueButtonFastForward component to both buttons and configure them like the continue button in the Basic Standard Dialogue UI prefab.

You can also add other items to your Yes / No buttons' OnClick() events, too. Otherwise there wouldn't be any difference between them.

Re: Yes and No buttons rather than continue?

Posted: Fri Nov 27, 2020 2:03 pm
by TecD
Tony Li wrote: Thu Nov 26, 2020 10:08 pm Hi,

Quick comment on the variable: You can also register a C# method with Lua and use that in the Script field. (video tutorial)
Awesome tutorial, thanks.
Tony Li wrote: Thu Nov 26, 2020 10:08 pm Yes, it's possible to add more buttons to the dialogue UI. I recommend adding the Yes and No buttons to your subtitle panel(s). If you want them to immediately continue the conversation, connect their OnClick() events to the dialogue UI's StandardDialogueUI.OnContinueConversation method. If you want the first click to fast-forward the typewriter and the second to continue, add a StandardUIContinueButtonFastForward component to both buttons and configure them like the continue button in the Basic Standard Dialogue UI prefab.

You can also add other items to your Yes / No buttons' OnClick() events, too. Otherwise there wouldn't be any difference between them.
Lost on this (which is what I really need), any chance you have a tutorial?

EDIT: I think half of the issue on my side is that I don't know where certain things originate from. e.g. I have been changing the "continue" text on several UI's in order to determine which one I should change.) I couldn't find any of my changed text when I ran my scene. I then found out that I should have changed the continue in "Example Bubble Standard UI Subtitle Panel", however I don't even know why this UI was initiated.

Re: Yes and No buttons rather than continue?

Posted: Fri Nov 27, 2020 2:38 pm
by Tony Li
Hi,

Would you please post a sketch or mock-up of what you want the UI to look like? I should be able to provide clearer, less-ambiguous info specific to your UI requirements.

Re: Yes and No buttons rather than continue?

Posted: Fri Nov 27, 2020 4:47 pm
by TecD
mockup5.png
mockup5.png (238.58 KiB) Viewed 308 times
This is a one way conversation, what is in the image is the only conversation. I just want to add the Yes and No (I partially have it).

mockup6.png
mockup6.png (10.01 KiB) Viewed 308 times
This is my npc character setup pre play. (The speech bubble npc)

mockup7.png
mockup7.png (12.37 KiB) Viewed 308 times

This is my npc character setup during play. (The speech bubble npc)

In the third image, I am not sure how the "Example Bubble Standard UI Subtitle Panel" gets there....

Sorry, not sure what's going on with the images. (ok images fixed) Sorry, edited this post about 20 times.

Re: Yes and No buttons rather than continue?

Posted: Fri Nov 27, 2020 5:26 pm
by Tony Li
You can just make those into response buttons. You don't have to do anything custom or unusual. Here's a version of the BubbleSubtitleExample package that's available on the Dialogue System Extras page:

DS_BubbleSubtitleExample_2020-11-27.unitypackage

I just added a new scene named "Bubble Subtitle Example Yes No Menu" that looks like this:

wantWaterYesNo.png
wantWaterYesNo.png (37.89 KiB) Viewed 305 times

(You can restyle it however you want.) The NPC has a Dialogue Actor component that points to a bubble subtitle panel. The bubble subtitle panel is a child of the NPC, and it has a menu panel inside it.

Re: Yes and No buttons rather than continue?

Posted: Fri Nov 27, 2020 7:57 pm
by TecD
Thanks, that helps a lot. I am just struggling with sizes and positioning (panel sizes), I will read some more posts/documentation to see if I can sort it out myself.

Thanks for the quick help.

Re: Yes and No buttons rather than continue?

Posted: Fri Nov 27, 2020 8:02 pm
by Tony Li
Glad to help. Working with Unity UI layouts is always a bit of a headache at first. I recommend Unity's official Unity UI tutorials, especially the ones on Rect Transforms and Layouts.