Show portrait + icon during dialogues

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Show portrait + icon during dialogues

Post 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
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show portrait + icon during dialogues

Post 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.
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Re: Show portrait + icon during dialogues

Post by Wiik »

Thanks Tony,
Could you tell me where should i paste the code ?
Sry, i have 0 knowledge in coding.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show portrait + icon during dialogues

Post 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);
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Re: Show portrait + icon during dialogues

Post by Wiik »

Awesome !
Thanks Tony, the example really helped me.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show portrait + icon during dialogues

Post by Tony Li »

Glad to help!
Post Reply