本文整理汇总了Python中toontown.toontowngui.TTDialog.TTGlobalDialog类的典型用法代码示例。如果您正苦于以下问题:Python TTGlobalDialog类的具体用法?Python TTGlobalDialog怎么用?Python TTGlobalDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTGlobalDialog类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __handleEnterSphere
def __handleEnterSphere(self, collEntry):
if base.localAvatar.doId == self.lastAvId and globalClock.getFrameCount() <= self.lastFrame + 1:
self.notify.debug('Ignoring duplicate entry for avatar.')
return
if base.localAvatar.hp > 0:
def handleEnterRequest(self = self):
self.ignore('stoppedAsleep')
if hasattr(self.dialog, 'doneStatus') and self.dialog.doneStatus == 'ok':
self.d_requestEnter(base.cr.isPaid())
elif self.cr and not self.isDisabled():
self.cr.playGame.getPlace().setState('walk')
else:
self.notify.warning('Warning! Object has already been disabled.')
self.dialog.ignoreAll()
self.dialog.cleanup()
del self.dialog
self.cr.playGame.getPlace().fsm.request('stopped')
self.accept('stoppedAsleep', handleEnterRequest)
doneEvent = 'enterRequest|dialog'
if self.kartPad.isPractice():
msg = TTLocalizer.StartingBlock_EnterPractice
else:
raceName = TTLocalizer.KartRace_RaceNames[self.kartPad.trackType]
numTickets = RaceGlobals.getEntryFee(self.kartPad.trackId, self.kartPad.trackType)
msg = TTLocalizer.StartingBlock_EnterNonPractice % (raceName, numTickets)
self.dialog = TTGlobalDialog(msg, doneEvent, 4)
self.dialog.accept(doneEvent, handleEnterRequest)
示例2: __handleEnterSphere
def __handleEnterSphere(self, collEntry):
if base.localAvatar.doId == self.lastAvId and globalClock.getFrameCount(
) <= self.lastFrame + 1:
self.notify.debug('Ignoring duplicate entry for avatar.')
return
if base.localAvatar.hp > 0:
def handleEnterRequest(self=self):
self.ignore('stoppedAsleep')
if hasattr(
self.dialog,
'doneStatus') and self.dialog.doneStatus == 'ok':
self.d_requestEnter(base.cr.isPaid())
else:
self.cr.playGame.getPlace().setState('walk')
self.dialog.ignoreAll()
self.dialog.cleanup()
del self.dialog
self.cr.playGame.getPlace().fsm.request('stopped')
self.accept('stoppedAsleep', handleEnterRequest)
doneEvent = 'enterRequest|dialog'
msg = TTLocalizer.StartingBlock_EnterShowPad
self.dialog = TTGlobalDialog(msg, doneEvent, 4)
self.dialog.accept(doneEvent, handleEnterRequest)
示例3: rejectEnter
def rejectEnter(self, errCode):
self.notify.debugStateCall(self)
def handleTicketError(self = self):
self.ignore('stoppedAsleep')
self.dialog.ignoreAll()
self.dialog.cleanup()
del self.dialog
self.cr.playGame.getPlace().setState('walk')
doneEvent = 'errorCode|dialog'
if errCode == KartGlobals.ERROR_CODE.eTickets:
msg = TTLocalizer.StartingBlock_NotEnoughTickets
self.dialog = TTGlobalDialog(msg, doneEvent, 2)
self.dialog.accept(doneEvent, handleTicketError)
self.accept('stoppedAsleep', handleTicketError)
elif errCode == KartGlobals.ERROR_CODE.eBoardOver:
msg = TTLocalizer.StartingBlock_NoBoard
self.dialog = TTGlobalDialog(msg, doneEvent, 2)
self.dialog.accept(doneEvent, handleTicketError)
self.accept('stoppedAsleep', handleTicketError)
elif errCode == KartGlobals.ERROR_CODE.eNoKart:
msg = TTLocalizer.StartingBlock_NoKart
self.dialog = TTGlobalDialog(msg, doneEvent, 2)
self.dialog.accept(doneEvent, handleTicketError)
self.accept('stoppedAsleep', handleTicketError)
elif errCode == KartGlobals.ERROR_CODE.eOccupied:
msg = TTLocalizer.StartingBlock_Occupied
self.dialog = TTGlobalDialog(msg, doneEvent, 2)
self.dialog.accept(doneEvent, handleTicketError)
self.accept('stoppedAsleep', handleTicketError)
elif errCode == KartGlobals.ERROR_CODE.eTrackClosed:
msg = TTLocalizer.StartingBlock_TrackClosed
self.dialog = TTGlobalDialog(msg, doneEvent, 2)
self.dialog.accept(doneEvent, handleTicketError)
self.accept('stoppedAsleep', handleTicketError)
else:
self.cr.playGame.getPlace().setState('walk')
示例4: DistributedViewingBlock
class DistributedViewingBlock(DistributedStartingBlock):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedViewingBlock')
sphereRadius = 6
def __init__(self, cr):
DistributedStartingBlock.__init__(self, cr)
self.timer = None
return
def delete(self):
if self.timer is not None:
self.timer.destroy()
del self.timer
DistributedStartingBlock.delete(self)
return
def generateInit(self):
self.notify.debugStateCall(self)
DistributedObject.DistributedObject.generateInit(self)
self.nodePath = NodePath(self.uniqueName('StartingBlock'))
self.collSphere = CollisionSphere(-1, 6.75, -1, self.sphereRadius)
self.collSphere.setTangible(0)
self.collNode = CollisionNode(self.uniqueName('StartingBlockSphere'))
self.collNode.setCollideMask(ToontownGlobals.WallBitmask)
self.collNode.addSolid(self.collSphere)
self.collNodePath = self.nodePath.attachNewNode(self.collNode)
def announceGenerate(self):
self.notify.debugStateCall(self)
DistributedObject.DistributedObject.announceGenerate(self)
self.nodePath.reparentTo(render)
self.accept(self.uniqueName('enterStartingBlockSphere'), self.__handleEnterSphere)
if (__debug__):
if self.testLOD:
self.__generateKartAppearTrack()
def setPadLocationId(self, padLocationId):
self.notify.debugStateCall(self)
self.movieNode = self.nodePath.attachNewNode(self.uniqueName('MovieNode'))
self.exitMovieNode = self.nodePath.attachNewNode(self.uniqueName('ExitMovieNode'))
if padLocationId % 2:
self.movieNode.setPosHpr(0, 6.5, 0, 0, 0, 0)
else:
self.movieNode.setPosHpr(0, -6.5, 0, 0, 0, 0)
self.exitMovieNode.setPosHpr(3, 6.5, 0, 270, 0, 0)
self.collNodePath.reparentTo(self.movieNode)
def __handleEnterSphere(self, collEntry):
if base.localAvatar.doId == self.lastAvId and globalClock.getFrameCount() <= self.lastFrame + 1:
self.notify.debug('Ignoring duplicate entry for avatar.')
return
if base.localAvatar.hp > 0:
def handleEnterRequest(self = self):
self.ignore('stoppedAsleep')
if hasattr(self.dialog, 'doneStatus') and self.dialog.doneStatus == 'ok':
self.d_requestEnter(base.cr.isPaid())
else:
self.cr.playGame.getPlace().setState('walk')
self.dialog.ignoreAll()
self.dialog.cleanup()
del self.dialog
self.cr.playGame.getPlace().fsm.request('stopped')
self.accept('stoppedAsleep', handleEnterRequest)
doneEvent = 'enterRequest|dialog'
msg = TTLocalizer.StartingBlock_EnterShowPad
self.dialog = TTGlobalDialog(msg, doneEvent, 4)
self.dialog.accept(doneEvent, handleEnterRequest)
def generateCameraMoveTrack(self):
self.cPos = camera.getPos(self.av)
self.cHpr = camera.getHpr(self.av)
cameraPos = Point3(23, -10, 7)
cameraHpr = Point3(65, -10, 0)
camera.wrtReparentTo(self.nodePath)
cameraTrack = LerpPosHprInterval(camera, 1.5, cameraPos, cameraHpr)
return cameraTrack
def makeGui(self):
self.notify.debugStateCall(self)
if self.timer is not None:
return
self.timer = ToontownTimer()
self.timer.setScale(0.3)
self.timer.setPos(1.16, 0, -.73)
self.timer.hide()
DistributedStartingBlock.makeGui(self)
return
def showGui(self):
self.notify.debugStateCall(self)
self.timer.show()
DistributedStartingBlock.showGui(self)
def hideGui(self):
self.notify.debugStateCall(self)
if not hasattr(self, 'timer') or self.timer is None:
return
self.timer.reset()
#.........这里部分代码省略.........
示例5: DistributedStartingBlock
#.........这里部分代码省略.........
else:
self.movieNode.setPosHpr(-3.0, 0, 0, -90.0, 0, 0)
def setActive(self, isTangible):
self.collSphere.setTangible(isTangible)
def __handleEnterSphere(self, collEntry):
if base.localAvatar.doId == self.lastAvId and globalClock.getFrameCount() <= self.lastFrame + 1:
self.notify.debug('Ignoring duplicate entry for avatar.')
return
if base.localAvatar.hp > 0:
def handleEnterRequest(self = self):
self.ignore('stoppedAsleep')
if hasattr(self.dialog, 'doneStatus') and self.dialog.doneStatus == 'ok':
self.d_requestEnter(base.cr.isPaid())
elif self.cr and not self.isDisabled():
self.cr.playGame.getPlace().setState('walk')
else:
self.notify.warning('Warning! Object has already been disabled.')
self.dialog.ignoreAll()
self.dialog.cleanup()
del self.dialog
self.cr.playGame.getPlace().fsm.request('stopped')
self.accept('stoppedAsleep', handleEnterRequest)
doneEvent = 'enterRequest|dialog'
if self.kartPad.isPractice():
msg = TTLocalizer.StartingBlock_EnterPractice
else:
raceName = TTLocalizer.KartRace_RaceNames[self.kartPad.trackType]
numTickets = RaceGlobals.getEntryFee(self.kartPad.trackId, self.kartPad.trackType)
msg = TTLocalizer.StartingBlock_EnterNonPractice % (raceName, numTickets)
self.dialog = TTGlobalDialog(msg, doneEvent, 4)
self.dialog.accept(doneEvent, handleEnterRequest)
def d_movieFinished(self):
self.notify.debugStateCall(self)
self.sendUpdate('movieFinished', [])
def d_requestEnter(self, paid):
self.notify.debugStateCall(self)
self.sendUpdate('requestEnter', [paid])
def d_requestExit(self):
self.notify.debugStateCall(self)
self.exitRequested = True
self.hideGui()
self.sendUpdate('requestExit', [])
def rejectEnter(self, errCode):
self.notify.debugStateCall(self)
def handleTicketError(self = self):
self.ignore('stoppedAsleep')
self.dialog.ignoreAll()
self.dialog.cleanup()
del self.dialog
self.cr.playGame.getPlace().setState('walk')
doneEvent = 'errorCode|dialog'
if errCode == KartGlobals.ERROR_CODE.eTickets:
msg = TTLocalizer.StartingBlock_NotEnoughTickets
self.dialog = TTGlobalDialog(msg, doneEvent, 2)
self.dialog.accept(doneEvent, handleTicketError)
self.accept('stoppedAsleep', handleTicketError)
示例6: setOccupied
def setOccupied(self, avId):
self.notify.debug('%d setOccupied: %d' % (self.doId, avId))
if self.av != None:
self.finishMovie()
if not self.av.isEmpty() and not self.av.isDisabled():
self.av.loop('neutral')
self.av.setParent(ToontownGlobals.SPRender)
self.av.startSmooth()
self.finishMovie()
if self.kart:
self.kart.delete()
self.kart = None
if self.kartNode:
self.kartNode.removeNode()
self.kartNode = None
self.placedAvatar = 0
self.ignore(self.av.uniqueName('disable'))
self.av = None
wasLocalToon = self.localToonKarting
self.lastAvId = self.avId
self.lastFrame = globalClock.getFrameCount()
self.avId = avId
self.localToonKarting = 0
if self.avId == 0:
self.collSphere.setTangible(0)
self.request('Off')
else:
self.collSphere.setTangible(1)
av = self.cr.doId2do.get(self.avId)
self.placedAvatar = 0
if self.avId == base.localAvatar.doId:
self.localToonKarting = 1
if av != None:
self.av = av
self.av.stopSmooth()
self.placedAvatar = 0
self.acceptOnce(self.av.uniqueName('disable'), self.__avatarGone)
self.kartNode = render.attachNewNode(self.av.uniqueName('KartNode'))
self.kartNode.setPosHpr(self.nodePath.getPos(render), self.nodePath.getHpr(render))
self.kart = Kart()
self.kart.baseScale = 1.6
self.kart.setDNA(self.av.getKartDNA())
self.kart.generateKart()
self.kart.resetGeomPos()
self.av.wrtReparentTo(self.nodePath)
self.av.setAnimState('neutral', 1.0)
if not self.localToonKarting:
av.stopSmooth()
self.__placeAvatar()
self.avParent = av.getParent()
else:
self.notify.warning('Unknown avatar %d in kart block %d ' % (self.avId, self.doId))
self.avId = 0
if wasLocalToon and not self.localToonKarting:
place = base.cr.playGame.getPlace()
if place:
if self.exitRequested:
place.setState('walk')
else:
def handleDialogOK(self = self):
self.ignore('stoppedAsleep')
place.setState('walk')
self.dialog.ignoreAll()
self.dialog.cleanup()
del self.dialog
doneEvent = 'kickedOutDialog'
msg = TTLocalizer.StartingBlock_KickSoloRacer
self.dialog = TTGlobalDialog(msg, doneEvent, style=1)
self.dialog.accept(doneEvent, handleDialogOK)
self.accept('stoppedAsleep', handleDialogOK)
return