Page 1 of 1

Automatic continue button and click the screen after certain time

Posted: Tue Jan 17, 2023 7:09 pm
by Vacerdin
I want to develop 2 mechanics but i dont know how or where to start.

The automatic continue its just a button that can alternate between having the continue button to always and another state where the text just simply continues after certain time thats set up on the dialogue manager

The other one is a little more complicated. It just only shows if the continue is ON and the player didnt click the screen 10 seconds after de typewritter has ended or anything similar.

Is this even possible? :geek: :?:

Re: Automatic continue button and click the screen after certain time

Posted: Tue Jan 17, 2023 8:14 pm
by Tony Li
Hi,

Both are possible.

> The automatic continue its just a button that can alternate between having the continue button to always and another state where the text just simply continues after certain time thats set up on the dialogue manager

Use the SetContinueMode() sequencer command in your conversation to set the continue button to whatever states you want.


> The other one is a little more complicated. It just only shows if the continue is ON and the player didnt click the screen 10 seconds after de typewritter has ended or anything similar.

What shows? A reminder message? The continue button? If you want to show the continue button if the player didn't click the screen after 10 seconds, use these steps:

1. Set up a transparent, whole-screen continue button as described in #2 here: How To: Continue Without UI Button

2. Add a continue button or image that looks like a button. This is only for the visible button after 10 seconds. The actual continue button is the transparent, whole-screen continue button.

3. Add a script like this to the Subtitle Text GameObject:
ShowContinueButtonIfWaiting.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
[RequireComponent(typeof(AbstractTypewriterEffect))]
public class ShowContinueButtonIfWaiting : MonoBehaviour
{
    public GameObject visibleContinueButton;
    public float delay = 10f;

    public void Start() { visibleContinueButton.SetActive(false); }

    public void StartTimer() { Invoke(nameof(ShowVisibleContinueButton), delay); }

    public void StopTimer() { CancelInvoke(); }

    private void ShowVisibleContinueButton() { visibleContinueButton.SetActive(true); }
}
(Assign the visible continue button to the script.)

4. Configure the typewriter effect's OnEnd() UnityEvent to call ShowContinueButtonIfWaiting.StartTimer.

5. Configure the transparent, whole-screen continue button's OnClick() UnityEvent to additionally call ShowContinueButtonIfWaiting.STopTimer.

Re: Automatic continue button and click the screen after certain time

Posted: Mon Feb 06, 2023 2:55 am
by Vacerdin
Hello Tony!
Im sorry if i didnt answe. Ive been on vacations far away from my computer. I hope you´ve been well too
The code that you provided did work!
I just wanted to simply show a gif to click the screen :lol:
Everything works perfectly. Althought i have one question. is the "[RequireComponent(typeof(AbstractTypewriterEffect))]" important?

I wasnt able to attach the code with that line to my subtitle panel so i just erased it and it worked perfectly. Im using the text animator typewriter so i thought that was the problem.

Thanks for everything once again :)

Re: Automatic continue button and click the screen after certain time

Posted: Mon Feb 06, 2023 8:20 am
by Tony Li
Hi,

That line isn't required. It's fine to remove it.