Page 1 of 1

Accumulate text in one place, but seperate portraits

Posted: Tue Nov 24, 2020 2:08 am
by NotVeryProfessional
I've found the accumulate text function and the included templates that use it, but I can't get to work what I want for my game:

All text from all speakers should be accumulated together, so I can scroll through it. Like so:

Player: Hey, how are you?
Josh: I'm fine thank you.
Player: Hey, can I ask a question?
...

The WRPG template does that. However, it does it by having only one portrait, etc. I want them split, like in the basic or the VN template, to get this visuals:
dialog.jpg
dialog.jpg (74.97 KiB) Viewed 435 times
As you can see, my current attempt only shows one side of the conversation, because it's based on the VN template which has seperate subtitle panels for each participant, and that they point to the same text doesn't make it accumulate together.

How can I achieve my desired effect? (I also have a 2nd NPC subtitle panel, not visible here, just in case that makes a difference)

Re: Accumulate text in one place, but seperate portraits

Posted: Tue Nov 24, 2020 8:43 pm
by Tony Li
Hi,

You can use a small subclass of StandardUISubtitlePanel to keep the text in sync. Here's an example scene:

DS_SharedSubtitleTextExample_2020-11-25.unitypackage

It's made in Unity 2020.1. The dialogue UI is based on the WRPG prefab.

And here's the script that's in the example package:

SharedTextSubtitlePanel.cs

Code: Select all

using PixelCrushers.DialogueSystem;
public class SharedTextSubtitlePanel : StandardUISubtitlePanel
{
    private StandardDialogueUI ui;

    protected override void Awake()
    {
        base.Awake();
        ui = GetComponentInParent<StandardDialogueUI>();
    }

    public override void SetContent(Subtitle subtitle)
    {
        base.SetContent(subtitle);
        foreach (var panel in ui.conversationUIElements.subtitlePanels)
        {
            panel.accumulatedText = accumulatedText;
        }
    }
}

Re: Accumulate text in one place, but seperate portraits

Posted: Wed Nov 25, 2020 4:21 am
by NotVeryProfessional
brilliant, I'll give that a try. Thanks!

Re: Accumulate text in one place, but seperate portraits

Posted: Wed Nov 25, 2020 6:06 pm
by NotVeryProfessional
This almost works, but when the player is speaking, the NPC portrait is replaced with the player portrait (and the player portrait remains as well). Probably a small hickup in the code somewhere. I'll see if I can find it myself.

Re: Accumulate text in one place, but seperate portraits

Posted: Wed Nov 25, 2020 6:28 pm
by NotVeryProfessional
Got it. The "PC Image" of the Response Panel was set up wrongly, pointing to the NPC image.

Re: Accumulate text in one place, but seperate portraits

Posted: Wed Nov 25, 2020 7:22 pm
by Tony Li
Thanks for catching that. I totally forgot to reassign the portrait image to the response panel. I just updated the example scene my previous reply so future readers will have a corrected version.