Page 1 of 1
Colour change to show correct answer
Posted: Tue Jun 07, 2022 5:49 am
by jmnb
I would like to set up the dialogue system so that if a wrong answer is clicked the colours of the text change so that wrong answers appear in red and the correct answer appears in green. To do this i will have to prevent a mouse click from advancing the dialogue, and also communicate the colour change to the UI. Any tips on setting this up would be gratefully received! Thanks.
Re: Colour change to show correct answer
Posted: Tue Jun 07, 2022 10:51 am
by Tony Li
Hi,
You could add a script to your response buttons, and point the Button component's OnClick() event to a method in that script instead of StandardUIResponseButton.OnClick().
In that method, check if the answer is the right answer or wrong answer.
If it's the right answer, call the button's StandardUIResponseButton.OnClick() method.
If it's the wrong answer, loop through the buttons and set the colors. If your menu uses a button template to instantiate buttons into the menu as needed, loop through DialogueManager.standardDialogueUI.conversationUIElements.defaultMenuPanel.instantiatedButtons. If your menu uses a predesigned list of buttons in the Buttons list, loop through DialogueManager.standardDialogueUI.conversationUIElements.defaultMenuPanel.buttons.
Re: Colour change to show correct answer
Posted: Tue Jun 07, 2022 12:20 pm
by jmnb
Thanks!
Re: Colour change to show correct answer
Posted: Tue Jun 07, 2022 12:46 pm
by Tony Li
Happy to help!