If you only want the continue button to continue after a delay, don't call OnFastForward at all. Remove the StandardUIContinueButtonFastForward component. By calling OnContinueConversation() and then calling OnFastForward(), you're continuing twice. Change the script to this: (I also added a safeguard to prevent the player from clicking the continue button again while it's delaying.) ContinueButtonDelay.cs
public class ContinueButtonDelay : MonoBehaviour
{
public AbstractTypewriterEffect typewriterEffect; //<-- ASSIGN IN INSPECTOR.
private Coroutine currentCoroutine = null;
public void ContinueAfterDelay(float delay)
{
if (currentCoroutine == null)
{
currentCoroutine = StartCoroutine(ContinueAfterDelayCoroutine(delay));
}
}
IEnumerator ContinueAfterDelayCoroutine(float delay)
{
if ((typewriterEffect != null) && typewriterEffect.isPlaying) typewriterEffect.Stop();
yield return new WaitForSeconds(delay);
currentCoroutine = null;
GetComponentInParent<PixelCrushers.DialogueSystem.AbstractDialogueUI>().OnContinueConversation();
}
}
If you want to only fast forward the first time the player clicks the continue button, and then delay on the second time the player clicks the button, change the script to the version below, and configure the button's OnClick() event to call its OnFastForward() method. Also assign the subtitle text. CustomContinueButtonFastForward.cs
Last one seems like the most right fit for me but it would not dismiss the subtitle of the Player during the delay, right?
Ultimately, what I need is:
first click
- fast forward the typewriter effect second click
- committing continue
- player subtitle dismiss right away at this point
- delay of X second here
-after X second, NPC subtitle continues (or any other next node)
In that case, you could check if the current subtitle is PC or NPC. If it's PC, continue immediately. If it's NPC, delay then continue. CustomContinueButtonFastForward.cs
is in charge of dismissing Player dialogue which is making player dialogue to dismiss after the delay - (make it looks like its not interacted during the delay even though player pressed the button for Continue button)
For your player subtitle panel, make a subclass of StandardUIContinueButtonFastForward. Override OnFastForward. Hide the panel, wait a duration, then continue. Example: