Page 2 of 2
Re: Question about Dialog UI
Posted: Tue May 17, 2022 8:29 am
by Morgank
Hello once again.
Can you give me advice on how to load portrait images on start of the conversation and not on the first line of each conversant? I've read
this topic, but wasn't able to understand without the context what changes have author maid, so that portraits will load from the start.
Re: Question about Dialog UI
Posted: Tue May 17, 2022 9:40 am
by Tony Li
Hi,
I suspect the thread you referenced isn't relevant. That poster was doing something unique.
If you want a portrait to appear when the conversation starts, configure the actor to use a subtitle panel whose Visibility is set to Always From Start:
- alwaysFromStart.png (20 KiB) Viewed 637 times
For example, if you want the portrait to appear in subtitle panel 2, configure the actor's Dialogue Actor component to use panel 2:
- dialogueActorSubtitlePanel.png (26.42 KiB) Viewed 637 times
Re: Question about Dialog UI
Posted: Tue May 17, 2022 10:12 am
by Morgank
Thanks that helped me, but with some nuances. Now on start of the conversation in addition to the first message line NPC and PC panels appear without text and Hide Dialogue Panel Trigger does not work. I'll try to work around this with code.
Re: Question about Dialog UI
Posted: Tue May 17, 2022 10:30 am
by Tony Li
I just remembered that you're using the SMS Dialogue UI. I'm not sure where you could want to show the portraits when the conversation starts, but I don't think it would be in the template subtitle panels.
You may want to
not do what I suggested above. Instead, you could examine the conversation to identify the actors, and show their portrait images in some new, custom Image components. Here is a rough example:
Code: Select all
void OnConversationStart(Transform actor)
{
var conversation = DialogueManager.masterDatabase.GetConversation(DialogueManager.lastConversationStarted);
var actor = DialogueManager.masterDatabase.GetActor(conversation.ActorID);
var conversant = DialogueManager.masterDatabase.GetActor(conversation.ConversantID);
specialActorImage.sprite = actor.GetPortraitSprite();
specialConversantImage.sprite = conversant.GetPortraitSprite();
}
Re: Question about Dialog UI
Posted: Wed May 18, 2022 1:37 pm
by Morgank
Thanks alot! That helped, but game designer again gave me a couple of difficult tasks... May I ask you about them?
Is it possible to somehow display player subtitles and Menu text on the response GameObject during the selection, so it would look like this?
- Screenshot_1.jpg (13.5 KiB) Viewed 630 times
- Screenshot_2.jpg (40.6 KiB) Viewed 630 times
One should continue another. For the rest of the time text should the be displayed on the old objects.
And finally the second question... Is it possible to change the Dialog UI during runtime in OnTriggerEnter?
- Screenshot_39.png (8.72 KiB) Viewed 630 times
I saw in the code that it's a regular GameObject, but at some point it turns into an IDialogueUI object and I can't figure out how to do that. Right now the dialog system looks something like this, but the gamedesigner wants to use a different UI for conversations while moving.
- Screenshot_40.jpg (203.54 KiB) Viewed 630 times
Re: Question about Dialog UI
Posted: Wed May 18, 2022 1:47 pm
by Tony Li
Morgank wrote: ↑Wed May 18, 2022 1:37 pmIs it possible to somehow display player subtitles and Menu text on the response GameObject during the selection, so it would look like this?
Screenshot_1.jpg
Screenshot_2.jpg
One should continue another. For the rest of the time text should the be displayed on the old objects.
Yes. Make a subclass of StandardUIResponseButton so you can override it to show the response entry's currentMenuText and currentDialogueText.
Morgank wrote: ↑Wed May 18, 2022 1:37 pmIs it possible to change the Dialog UI during runtime in OnTriggerEnter?
Add an
Override Dialogue UI component to one of the two primary participants.
Alternatively, in C# use DialogueManager.UseDialogueUI(x).
Re: Question about Dialog UI
Posted: Thu May 19, 2022 9:53 am
by Morgank
I'm a little noob in overriding. Can you give me a tip on what I should override? If understand response button gets text here:
Code: Select all
public string text
{
get
{
return label.text;
}
set
{
label.text = UITools.StripRPGMakerCodes(value);
UITools.SendTextChangeMessage(label);
}
}
Re: Question about Dialog UI
Posted: Thu May 19, 2022 3:52 pm
by Tony Li
Since the response property gets set after the label is set, you can use a coroutine to wait until the end of the frame. Try this script:
Code: Select all
using System.Collections;
using UnityEngine;
using PixelCrushers;
using PixelCrushers.DialogueSystem;
public class CustomResponseButton : StandardUIResponseButton
{
public UITextField detailedLabel;
public override void SetFormattedText(FormattedText formattedText)
{
base.SetFormattedText(formattedText);
DialogueManager.instance.StartCoroutine(SetDetailedLabelAtEndOfFrame());
}
private IEnumerator SetDetailedLabelAtEndOfFrame()
{
yield return new WaitForEndOfFrame();
detailedLabel.text = FormattedText.Parse(response.destinationEntry.currentDialogueText).text;
}
}
Re: Question about Dialog UI
Posted: Fri May 20, 2022 5:09 am
by Morgank
Menu text is displaying, but detailed text not. When choices appear Unity gives coroutine error, but I don't know why. Object is active at this moment.
Code: Select all
Coroutine couldn't be started because the the game object 'FirstChoice' is inactive!
Re: Question about Dialog UI
Posted: Fri May 20, 2022 8:05 am
by Tony Li
I missed a little something above. Please add "DialogueManager.instance." in front of StartCoroutine. I fixed my post above.