Page 1 of 1

Textline Dialogue UI does not want to register an additional subtitle panel.

Posted: Sat Mar 14, 2020 11:04 am
by Stalker_EG
Good afternoon. I already broke my whole head...
Textline Dialogue UI does not want to register an additional subtitle panel.

I have a dialogue between the Player and NPS.
Sometimes I need to insert subtitles from the author (He is defined in the database as a separate NPS, in the scene there is a GO with Dilogue Actror component with the panel number and color of subtitles).
when you play the dialog, the author's lines get into the standard NPS panel.

Where do I search?

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Posted: Sat Mar 14, 2020 11:49 am
by Tony Li
Hi,

Make a subclass of TextlineDialogueUI.cs. Use this subclass instead of TextlineDialogueUI. Override the GetTemplate method. The base method looks like this:

Code: Select all

protected virtual StandardUISubtitlePanel GetTemplate(Subtitle subtitle)
{
    return subtitle.speakerInfo.IsNPC ? conversationUIElements.defaultNPCSubtitlePanel : conversationUIElements.defaultPCSubtitlePanel;
}
If the subtitle's speaker is an NPC, it uses the default NPC panel. Otherwise it uses the default PC panel.

In your overridden method, you can get the speaker's desired panel instead:

Code: Select all

protected virtual StandardUISubtitlePanel GetTemplate(Subtitle subtitle)
{
    var ui = DialogueManager.dialogueUI as StandardDialogueUI;
    DialogueActor dialogueActor;
    var panel = ui.conversationUIElements.standardSubtitleControls.GetPanel(subtitle, out dialogueActor);
    if (dialogueActor != null) subtitle.formattedText.text = dialogueActor.AdjustSubtitleColor(subtitle);
    return panel;
}
(Note: You may need to update to version 2.2.5 to have access to the GetPanel() method.)

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Posted: Sat Mar 14, 2020 12:05 pm
by Stalker_EG
Thank you. It works with the tag [panel=2].
but if you define this panel in the Dilogue Actror component, it does not work(

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Posted: Sat Mar 14, 2020 12:15 pm
by Stalker_EG
It's working now! Thank you so much. The last problem was that there was a second NPS entry for the author in the attached database. I removed it and now everything is working.

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Posted: Sat Mar 14, 2020 12:32 pm
by Stalker_EG
Everything works except the color and other subtitle settings of the Dilogue Actror component.

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Posted: Sat Mar 14, 2020 5:17 pm
by Tony Li
You'll need to add a couple of lines to the script. I updated my previous post with the extra lines of code.