Delays on conversations (again..)
Posted: Thu Sep 05, 2019 10:56 am
I'm really been pulling my hair today to get delays working properly in combination with animated bubbles, the typewriter and conversations.
I successfully subclassed StandardBarkUI, and rewrote it to use DoTween, and also a method I created to calculate the duration of the typewriter taking stop chars into account. It was very straight forward.
However, subclassing StandardUISubtitlePanel is a completely different beast. I guess it's due to handling of different windows opening and closing in relation to each other.
Here's what I want to do:
1) Start a conversation
2) Popup the bubble subtitle using DoTween (CustomStandardUISubtitlePanel->ShowSubtitle, replacing animatorMonitor.SetTrigger). The animation lasts for 0.3 seconds.
3) Delay the typewriter effect until 0.4 seconds (Edited UnityUITypewriterEffect)
4) Play the typewriter for the duration of the text with the stop characters
5) When the typewriter is finished, wait for 1.5 seconds, then hide subtitle with DoTween (CustomStandardUISubtitlePanel->HideSubtitle, replacing animatorMonitor.SetTrigger)
6) Wait for 1 second, then open the next subtitle, and repeat.
The problem is in step 4/5, the subtitle closes before the text is completed, even if I don't have any stop characters.
I couldn't find where in the code the duration of the subtitle is set. It seems to just skip forward after a while depending on the text length/cps.
I'd like to override this, to use the characters per second + duration of the stop chars (I made a static method for that in DialogueUtils.cs).
I have this default sequence, that I think I got from the forum. I don't understand why there are double delays in the middle. Is there any point? But I think this solves problem 6.
I have attached the files that I have worked with as a ZIP. If you can give any advice, it would be very helpful. I'm considering scrapping everything and starting over, but I'm not sure where to start.
Thank you!
Attached files:
- CustomStandardBarkUI.cs (Subclass of StandardBarkUI)
- CustomUISubtitlePanel.cs (Subclass of StandardUISubtitlePanel)
- DialogueUtils.cs (Custom script to get duration with stop chars)
- UnityUITypewriterEffect.cs (Overwritten original, couldn't subclass it I think)
I successfully subclassed StandardBarkUI, and rewrote it to use DoTween, and also a method I created to calculate the duration of the typewriter taking stop chars into account. It was very straight forward.
However, subclassing StandardUISubtitlePanel is a completely different beast. I guess it's due to handling of different windows opening and closing in relation to each other.
Here's what I want to do:
1) Start a conversation
2) Popup the bubble subtitle using DoTween (CustomStandardUISubtitlePanel->ShowSubtitle, replacing animatorMonitor.SetTrigger). The animation lasts for 0.3 seconds.
3) Delay the typewriter effect until 0.4 seconds (Edited UnityUITypewriterEffect)
Code: Select all
// This happens on line 260 before it starts typing
control.text = "<color=#00000000>" + control.text + "</color>";
if (delayBeforeStarting>0) yield return new WaitForSeconds(delayBeforeStarting); // private var
lastTime = DialogueTime.time; // Reset time due to delay
5) When the typewriter is finished, wait for 1.5 seconds, then hide subtitle with DoTween (CustomStandardUISubtitlePanel->HideSubtitle, replacing animatorMonitor.SetTrigger)
6) Wait for 1 second, then open the next subtitle, and repeat.
The problem is in step 4/5, the subtitle closes before the text is completed, even if I don't have any stop characters.
I couldn't find where in the code the duration of the subtitle is set. It seems to just skip forward after a while depending on the text length/cps.
I'd like to override this, to use the characters per second + duration of the stop chars (I made a static method for that in DialogueUtils.cs).
I have this default sequence, that I think I got from the forum. I don't understand why there are double delays in the middle. Is there any point? But I think this solves problem 6.
Code: Select all
SetDialoguePanel(false)@{{end}}->Message(Wait);
Delay(0.7)@Message(Wait)->Message(Hid);
Delay(0.7)@Message(Hid)->Message(Delayed);
SetDialoguePanel(true)@Message(Delayed)
Thank you!
Attached files:
- CustomStandardBarkUI.cs (Subclass of StandardBarkUI)
- CustomUISubtitlePanel.cs (Subclass of StandardUISubtitlePanel)
- DialogueUtils.cs (Custom script to get duration with stop chars)
- UnityUITypewriterEffect.cs (Overwritten original, couldn't subclass it I think)