2015-03-03 22:10:12 +00:00
|
|
|
from direct.distributed.DistributedObject import DistributedObject
|
|
|
|
from direct.directnotify.DirectNotifyGlobal import directNotify
|
|
|
|
|
|
|
|
class TTCodeRedemptionMgr(DistributedObject):
|
|
|
|
neverDisable = 1
|
|
|
|
notify = directNotify.newCategory('TTCodeRedemptionMgr')
|
|
|
|
|
|
|
|
def __init__(self, cr):
|
|
|
|
DistributedObject.__init__(self, cr)
|
|
|
|
|
|
|
|
def announceGenerate(self):
|
|
|
|
DistributedObject.announceGenerate(self)
|
2015-04-20 14:29:11 +00:00
|
|
|
base.cr.codeRedemptionMgr = self
|
2015-03-03 22:10:12 +00:00
|
|
|
|
|
|
|
def delete(self):
|
2015-04-20 14:29:11 +00:00
|
|
|
if hasattr(base.cr, 'codeRedemptionMgr'):
|
2015-04-04 10:29:27 +00:00
|
|
|
del base.cr.codeRedemptionMgr
|
2015-03-03 22:10:12 +00:00
|
|
|
DistributedObject.delete(self)
|
|
|
|
|
|
|
|
def redeemCode(self, code, callback):
|
2015-04-04 10:29:27 +00:00
|
|
|
self.callback = callback
|
|
|
|
self.sendUpdate('redeemCode', [code])
|
2015-03-03 22:10:12 +00:00
|
|
|
|
2015-04-04 10:29:27 +00:00
|
|
|
def redeemCodeResult(self, result):
|
2015-04-28 07:07:50 +00:00
|
|
|
self.callback(result)
|