Question about Dialog UI
Re: Question about Dialog UI
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.
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
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:
For example, if you want the portrait to appear in subtitle panel 2, configure the actor's Dialogue Actor component to use panel 2:
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:
For example, if you want the portrait to appear in subtitle panel 2, configure the actor's Dialogue Actor component to use panel 2:
Re: Question about Dialog UI
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
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:
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
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? 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? 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.
Is it possible to somehow display player subtitles and Menu text on the response GameObject during the selection, so it would look like this? 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? 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.
Re: Question about Dialog UI
Yes. Make a subclass of StandardUIResponseButton so you can override it to show the response entry's currentMenuText and currentDialogueText.
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
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
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
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
I missed a little something above. Please add "DialogueManager.instance." in front of StartCoroutine. I fixed my post above.