Colour change to show correct answer
Colour change to show correct answer
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
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.
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
Happy to help!