Page 1 of 1

I have two questions in Dialogue Panel.

Posted: Sun Aug 20, 2023 4:26 am
by fbthd1234
Hello.

I have two questions.

1. I would like to treat the response that I selected at least once during the conversation with gray text. Is there a way to identify the response the player has chosen? If the feature is not provided, you want to save and implement an identifier for each response raised by the user. What is the unique ID of response to use as an identifier?

2. If the speaker changes during conversation, I want to put the enter key effect between texts. I think you can see that the Speaker has changed through Subtitle Class in the OnConversionLine function of StandardDialougeUI. Then I don't know where to approach after that and add '\n' or the appropriate rich text. TMP Text is in use.

I always appreciate the help you provide.
Best Regards.

Re: I have two questions in Dialogue Panel.

Posted: Sun Aug 20, 2023 8:56 am
by Tony Li
Hi,
fbthd1234 wrote: Sun Aug 20, 2023 4:26 am1. I would like to treat the response that I selected at least once during the conversation with gray text. Is there a way to identify the response the player has chosen? If the feature is not provided, you want to save and implement an identifier for each response raised by the user. What is the unique ID of response to use as an identifier?
Tick the Dialogue Manager GameObject's Display Settings > Input Settings > [em#] Tag For Old Responses:

emTagForOldResponses.png
emTagForOldResponses.png (46.51 KiB) Viewed 149 times

Then set the corresponding Emphasis Setting (em#) to be gray:

emphasis1.png
emphasis1.png (34.89 KiB) Viewed 149 times
fbthd1234 wrote: Sun Aug 20, 2023 4:26 am2. If the speaker changes during conversation, I want to put the enter key effect between texts. I think you can see that the Speaker has changed through Subtitle Class in the OnConversionLine function of StandardDialougeUI. Then I don't know where to approach after that and add '\n' or the appropriate rich text. TMP Text is in use.
You can add it to subtitle.formattedText.text:

Code: Select all

private int currentSpeakerID;

void OnConversationStart(Transform actor) { currentSpeakerID = -1; } // Reset.

void OnConversationLine(Subtitle subtitle)
{
    var text = subtitle.formattedText.text;
    if (string.IsNullOrEmpty(text)) return;
    if (subtitle.speakerInfo.id != currentSpeakerID)
    {
        currentSpeakerID = subtitle.speakerInfo.if;
        subtitle.formattedText.text = $"{text}\n";
    }
}