Access timeout count

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Access timeout count

Post by joeylu »

I'm building a custom bubble menu dialogue, and trying to achieve an effect that when it reaches toward the timeout, the bubble will start fading out gradually.
In dialogue manager, the custom timeout has been set to a global timeout duration
In dialogue editor, sometime a dialog will have a specified timeout by setting the sequence SetTimeout(x)

I need to write a script to keep track the timer from StandardUITimer and do something before x seconds when it reaches to the timeout.

My current approach is to write a subclass for the StandardUITimer and override the UpdateTimeLeft method

is this a correct way to do the custom effects for the timeout duration period? (but I'm not acutally using the timer slider UI, in order to make it work I have to assign the slider and hide it)
and how do I get global timeout duration and the current menu sequence SetTimeout value from it?
tks
User avatar
Tony Li
Posts: 21676
Joined: Thu Jul 18, 2013 1:27 pm

Re: Access timeout count

Post by Tony Li »

Hi,

That's the way to do it. You don't have to assign a slider. Override StartCountdown() so you can record the total duration. Override UpdateTimeLeft so you can fade out when normalizedTimeLeft reaches a certain threshold. The normalizedTimeLeft value drops from 1 when the timer starts to 0 when the time is up. For example, if the total duration is 8 seconds, and normalizedTimeLeft is 0.25, then the seconds left is 8 * 0.25 = 2 seconds.
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: Access timeout count

Post by joeylu »

works perfectly, although I have to override the UpdateTimeLeft() method and making sure the if (slider == null) return; is not executed. Thanks Tony
User avatar
Tony Li
Posts: 21676
Joined: Thu Jul 18, 2013 1:27 pm

Re: Access timeout count

Post by Tony Li »

Glad to help!
Post Reply