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:
|
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)
|
||||||
|
|
||||||
|
@ -113,4 +114,4 @@ class ToontownTimer(DirectFrame):
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
self.destroy()
|
self.destroy()
|
||||||
self.notify.warning('Call destroy, not cleanup')
|
self.notify.warning('Call destroy, not cleanup')
|
Loading…
Reference in a new issue