NPC subtitle on Response Menu using Timeline

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
alexjet1000
Posts: 18
Joined: Thu Oct 01, 2020 11:18 am

NPC subtitle on Response Menu using Timeline

Post by alexjet1000 »

Hi Tony,

Im currently using the script "Close Subtitle Panel" as shown in the DS extras example for DS Timeline tracks, being able to stop timeline between dialogue lines.
This script always calls Close() method of the NPC panel, and then sends a ClosedSubtitle message to resume the timeline.
Thus, the NPC panel is always closed, and any Visibility option for the NPC panel wont take effect.

Question is, what´s the best workaround to keep the timeline stop behavior while also being able to keep NPC subtitle whenever a Response Menu shows up?

Id like to keep it being stopped just before the Response Menu, so after hitting continue on the NPC line, the response menu shows up, but the panel stays.

Can i access on runtime if the next entry is a Response Menu? I could add an "if" statement to the Close Subtitle Panel script so it only sends the ClosedSubtitle message and skips the Close().

Thank you in advance! :)
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC subtitle on Response Menu using Timeline

Post by Tony Li »

Hi,

You can check DialogueManager.currentConversationState.hasNPCResponse. You might also want to check hasAnyResponse to detect when you're on the last line of the conversation:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class CloseSubtitleButton : MonoBehaviour
{
    public void CloseSubtitle()
    {
        if (DialogueManager.currentConversationState.hasNPCResponse || 
            !DialogueManager.currentConversationState.hasAnyResponse)
        {
            GetComponentInParent<StandardUISubtitlePanel>().Close();
            Sequencer.Message("ClosedSubtitle");
        }
    }
}
alexjet1000
Posts: 18
Joined: Thu Oct 01, 2020 11:18 am

Re: NPC subtitle on Response Menu using Timeline

Post by alexjet1000 »

Hi Tony!

Thank you for the support.
I left the ClosedSubtitle out because it might need to call Continue on the timeline for the Response Menu to actually Show.

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class CloseSubtitleButton : MonoBehaviour
{
    public void CloseSubtitle()
    {
         if (DialogueManager.currentConversationState.hasNPCResponse || 
                !DialogueManager.currentConversationState.HasAnyResponses)
            {
                StandardUISubtitlePanel.Close();
            }

            Sequencer.Message("ClosedSubtitle");
    }
}
However, i noticed a different behavior on how the Panel is resized when DS updates its content.
Using Only During Content option has no problems, but when using any of the other options, the text box seems to not respond to resize.
If i type any text during runtime on the text field, it actually updates the size, but the DS text changes wont.
For Superceeded options it doesnt resize after the Response Menu.
For the rest of the options, it doesnt resizes at all.
Only During Content resizes fine always.

What could be causing this?
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC subtitle on Response Menu using Timeline

Post by Tony Li »

Hi,

In your dialogue UI, what manages the sizes of the panels? Are you using layout elements such as Content Size Fitter? If so, they should update automatically.
alexjet1000
Posts: 18
Joined: Thu Oct 01, 2020 11:18 am

Re: NPC subtitle on Response Menu using Timeline

Post by alexjet1000 »

Hi Tony,

Yes indeed, i have checked the height option in the layout group and its working!

Thank you for the help :)
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC subtitle on Response Menu using Timeline

Post by Tony Li »

Happy to help!
Post Reply