mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 12:12:36 -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:
|
if task.time >= task.duration:
|
||||||
self.timerExpired()
|
self.timerExpired()
|
||||||
if task.callback:
|
if task.callback:
|
||||||
task.callback()
|
task.callback(*task.extraArgs)
|
||||||
return Task.done
|
return Task.done
|
||||||
else:
|
else:
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
def countdown(self, duration, callback = None):
|
def countdown(self, duration, callback = None, extraArgs = []):
|
||||||
self.countdownTask = Task.Task(self._timerTask)
|
self.countdownTask = Task.Task(self._timerTask)
|
||||||
self.countdownTask.duration = duration
|
self.countdownTask.duration = duration
|
||||||
self.countdownTask.callback = callback
|
self.countdownTask.callback = callback
|
||||||
|
self.countdownTask.extraArgs = extraArgs
|
||||||
taskMgr.remove('timerTask%s' % self.timerId)
|
taskMgr.remove('timerTask%s' % self.timerId)
|
||||||
return taskMgr.add(self.countdownTask, 'timerTask%s' % self.timerId)
|
return taskMgr.add(self.countdownTask, 'timerTask%s' % self.timerId)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue