Page 1 of 1

Access timeout count

Posted: Tue May 26, 2020 3:11 pm
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

Re: Access timeout count

Posted: Tue May 26, 2020 5:15 pm
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.

Re: Access timeout count

Posted: Sun Jun 07, 2020 6:47 am
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

Re: Access timeout count

Posted: Sun Jun 07, 2020 7:23 am
by Tony Li
Glad to help!