Page 2 of 2
Re: Skip dialogue choices outside of dialogue
Posted: Sat Oct 01, 2022 5:31 pm
by boz
It took me awhile to figure out and remember how the original code worked, but eventually got it. Thank you for the advice!
Code: Select all
private Response[] regularResponses;
protected override void SetResponseButtons(Response[] responses, Transform target)
{
regularResponses = responses;
foreach (Response response in responses)
{
response.enabled = false;
}
base.SetResponseButtons(regularResponses.ToArray(), target);
}
public void SelectCard(int index)
{
(DialogueManager.dialogueUI as StandardDialogueUI).OnClick(regularResponses[index]);
}
Re: Skip dialogue choices outside of dialogue
Posted: Sat Oct 01, 2022 8:31 pm
by Tony Li
Happy to help! I'm glad you got it working.
Re: Skip dialogue choices outside of dialogue
Posted: Wed Oct 05, 2022 10:58 pm
by boz
Okay, I started getting more complex with it and now I've hit a situation where I don't know how to customize the Response Button any further.
Essentially, when I'm setting up the button, I also want to store a reference to a script that controls other elements on the button (see the image for example). Like while I do things in the game, I want to update the number on the response button.
The problem I'm hitting is that there's no reference to the GameObject inside of SetResponseButtons(), so I don't know how to access the button template itself to get the reference.
Any advice? It can be something dirty for now because I'm prototyping. I've been hesitant to crack open the Response script and add a direct reference to what I want inside there, but if you think that's the way to go, then I'll do that.
Re: Skip dialogue choices outside of dialogue
Posted: Thu Oct 06, 2022 8:29 am
by Tony Li
Hi,
Make a subclass of StandardUIResponseButton with UI element(s)s for the [#/#] text. Use this on your response buttons instead of the original StandardUIResponseButton.
Then override StandardUIMenuPanel.SetResponseButton(), which is the method that sets up a single response button, to set those extra UI element(s).
Re: Skip dialogue choices outside of dialogue
Posted: Thu Oct 06, 2022 9:46 pm
by boz
Aha! That set me on the right track. I had another component trying to do something close to the same thing, but didn't think to make it inherit from StandardUIResponseButton instead. Thanks!
Code: Select all
protected override void SetResponseButton(StandardUIResponseButton button, Response response,
Transform target, int buttonNumber)
{
if (button is CardVoteResponseButton cardVoteResponseButton)
{
_responseButtons[buttonNumber] = cardVoteResponseButton;
_responseButtons[buttonNumber].currentIndex = buttonNumber;
}
base.SetResponseButton(button, response, target, buttonNumber);
}
Re: Skip dialogue choices outside of dialogue
Posted: Fri Oct 07, 2022 7:55 am
by Tony Li
Looks good!