Well, that still doesn't help me with the issue - Delay only works after Response Menu, as in the video.
Re: Don't Disable Response Menu and Global Delay
Posted: Fri Feb 07, 2020 5:01 pm
by Tony Li
Oh! I think I understand now. You want the hide animation to play. Then you want to delay for a duration before the other character's panel plays its show animation. Is that correct?
If so, the easiest way to do that is to manually close the subtitle panel but still allow the sequence to run a little longer. You could use the SendMessage() sequencer command to tell the subtitle panel to close. For example:
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class HideDelayModifySequence : MonoBehaviour
{
private int lastSpeakerId = -1;
private void OnConversationStart(Transform actor)
{
lastSpeakerId = -1;
}
private void OnConversationLine(Subtitle subtitle)
{
if (subtitle.speakerInfo.id != lastSpeakerId && subtitle.dialogueEntry.id != 0)
{
var ui = DialogueManager.dialogueUI as StandardDialogueUI;
var panel = subtitle.speakerInfo.isNPC ? ui.conversationUIElements.defaultNPCSubtitlePanel : ui.conversationUIElements.defaultPCSubtitlePanel;
var closeAndDelayCommand = $"SendMessage(Close,,{panel.name})@{{{{end}}}}; Delay(3)@{{{{end}}}}";
subtitle.sequence = string.IsNullOrEmpty(subtitle.sequence)
? $"{closeAndDelayCommand}; {{default}}"
: $"{closeAndDelayCommand}; {subtitle.sequence}";
lastSpeakerId = subtitle.speakerInfo.id;
}
}
}
[EDIT: Fixed typo; added complete script]
Re: Don't Disable Response Menu and Global Delay
Posted: Fri Feb 07, 2020 6:20 pm
by bubucha
Yeah, you got the idea right.
I tried the code, but it, once again, does nothing.
I am not sure, but it is almost like ignored. I even tried to close the subtitle panels in ShowSubtitle, before calling base, but no effect. I can see them being closed and reopened, but still no delay.
Re: Don't Disable Response Menu and Global Delay
Posted: Fri Feb 07, 2020 7:56 pm
by Tony Li
There was a typo. I had "{{end}}" in the script. But since this is in a C# $"string", it interpreted the "{{" as a single {. I updated the script in my previous reply. Here's a full scene example:
So I tried it. Right now it closes the panel during the type. So... Yeah. Pretty much doesn't work.
I also tried setting up a Delay in the database directly in Sequence field, but it didn't produce any delays either.
Let's try to make it native through code. So that I can override a class and a method that works with delays and assign the logic there (if new speaker => Delay). Could you suggest me where do I start looking? Because overriding ShowSubtitles doesn't work, too. There is a lot happening during ConversationView class as I have seen. Perhaps it happens somewhere there?
Re: Don't Disable Response Menu and Global Delay
Posted: Sat Feb 08, 2020 8:17 pm
by Tony Li
I don't understand what doesn't work. Did you try the example scene?
Here's a copy of the example scene with longer text so you can see it type everything: