mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 19:52:37 -06:00
ToontownTimer callback support
This commit is contained in:
parent
4990317c41
commit
6bb4ea0dbe
1 changed files with 4 additions and 3 deletions
|
@ -80,15 +80,16 @@ class ToontownTimer(DirectFrame):
|
|||
if task.time >= task.duration:
|
||||
self.timerExpired()
|
||||
if task.callback:
|
||||
task.callback()
|
||||
task.callback(*task.extraArgs)
|
||||
return Task.done
|
||||
else:
|
||||
return Task.cont
|
||||
|
||||
def countdown(self, duration, callback = None):
|
||||
def countdown(self, duration, callback = None, extraArgs = []):
|
||||
self.countdownTask = Task.Task(self._timerTask)
|
||||
self.countdownTask.duration = duration
|
||||
self.countdownTask.callback = callback
|
||||
self.countdownTask.extraArgs = extraArgs
|
||||
taskMgr.remove('timerTask%s' % self.timerId)
|
||||
return taskMgr.add(self.countdownTask, 'timerTask%s' % self.timerId)
|
||||
|
||||
|
|
Loading…
Reference in a new issue