Page 1 of 1

Show portrait + icon during dialogues

Posted: Thu Mar 03, 2022 7:42 pm
by Wiik
Hi,
is there a way to also show an icon ?
To looks like this :
Image

Also how could i make the continue button behave like this :
. text is typing > continue button > text is typed > continue button > next node
because it's behaving like this :
. text is typing > continue button > next node

Re: Show portrait + icon during dialogues

Posted: Thu Mar 03, 2022 8:07 pm
by Tony Li
Wiik wrote: Thu Mar 03, 2022 7:42 pmis there a way to also show an icon ?
To looks like this : [see image above]
To show a big portrait and a small portrait (the one inside the text box), you can make a subclass of StandardUISubtitlePanel or StandardDialogueUI. For example, if you make a subclass of StandardDialogueUI, you could override the ShowSubtitle() method like this:

Code: Select all

public class MyDialogueUI : StandardDialogueUI
{
    public Image smallPortraitImage; // Assign in inspector.
    
    public override void ShowSubtitle(Subtitle subtitle)
    {
        base.ShowSubtitle(subtitle);
        // For the small portrait, always use the actor's main portrait sprite:
        var actor = DialogueManager.masterDatabase.GetActor(subtitle.speakerInfo.id);
        smallPortraitImage.enabled = (actor != null);
        if (actor != null) smallPortraitImage.sprite = actor.spritePortrait;
    }
}
Wiik wrote: Thu Mar 03, 2022 7:42 pmAlso how could i make the continue button behave like this :
. text is typing > continue button > text is typed > continue button > next node
because it's behaving like this :
. text is typing > continue button > next node
Add a StandardUIContinueButtonFastForward component to the continue button. Assign the Subtitle Text to it. Configure the Button's OnClick() to call StandardUIContinueButtonFastForward.OnFastForward.

To see an example, examine any of the dialogue UI prefabs that ship with the Dialogue System, such as the Basic Standard Dialogue UI.

Re: Show portrait + icon during dialogues

Posted: Fri Mar 04, 2022 8:59 am
by Wiik
Thanks Tony,
Could you tell me where should i paste the code ?
Sry, i have 0 knowledge in coding.

Re: Show portrait + icon during dialogues

Posted: Fri Mar 04, 2022 10:42 am
by Tony Li
Hi,

Here's an example with the code:

DS_DualPortraitExample_2022-03-04.unitypackage

I started with the VN Template Standard Dialogue UI prefab. I replaced the StandardDialogueUI component with the DualPortraitDialogueUI script contains in the example above. Then I added a small portrait image and assigned it to the DualPortraitDialogueUI component.

Finally, in the conversation's first node, I used this sequence to tell the player and NPC (Oracle) to use portrait #2 for their large portrait images.

Code: Select all

{{default}};
SetPortrait(Oracle, pic=2);
SetPortrait(Player, pic=2);

Re: Show portrait + icon during dialogues

Posted: Fri Mar 04, 2022 4:13 pm
by Wiik
Awesome !
Thanks Tony, the example really helped me.

Re: Show portrait + icon during dialogues

Posted: Fri Mar 04, 2022 5:01 pm
by Tony Li
Glad to help!