当前位置: 首页>>代码示例>>Python>>正文


Python ToontownTimer.show方法代码示例

本文整理汇总了Python中toontown.toonbase.ToontownTimer.ToontownTimer.show方法的典型用法代码示例。如果您正苦于以下问题:Python ToontownTimer.show方法的具体用法?Python ToontownTimer.show怎么用?Python ToontownTimer.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在toontown.toonbase.ToontownTimer.ToontownTimer的用法示例。


在下文中一共展示了ToontownTimer.show方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DistributedCheckers

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]

#.........这里部分代码省略.........
        self.fsm = None
        return

    def delete(self):
        DistributedNode.DistributedNode.delete(self)
        self.table.gameDoId = None
        self.table.game = None
        if self.exitButton:
            self.exitButton.destroy()
        if self.startButton:
            self.startButton.destroy()
        self.clockNode.stop()
        self.clockNode.hide()
        self.table.startButtonPushed = None
        self.ignore('mouse1')
        self.ignore('stoppedAsleep')
        self.fsm = None
        self.table = None
        return

    def getTimer(self):
        self.sendUpdate('requestTimer', [])

    def setTimer(self, timerEnd):
        if self.fsm.getCurrentState() != None and self.fsm.getCurrentState().getName() == 'waitingToBegin' and not self.table.fsm.getCurrentState().getName() == 'observing':
            self.clockNode.stop()
            time = globalClockDelta.networkToLocalTime(timerEnd)
            timeLeft = int(time - globalClock.getRealTime())
            if timeLeft > 0 and timerEnd != 0:
                if timeLeft > 60:
                    timeLeft = 60
                self.clockNode.setPos(1.16, 0, -0.83)
                self.clockNode.countdown(timeLeft, self.startButtonPushed)
                self.clockNode.show()
            else:
                self.clockNode.stop()
                self.clockNode.hide()
        return

    def setTurnTimer(self, turnEnd):
        if self.fsm.getCurrentState() != None and self.fsm.getCurrentState().getName() == 'playing':
            self.clockNode.stop()
            time = globalClockDelta.networkToLocalTime(turnEnd)
            timeLeft = int(time - globalClock.getRealTime())
            if timeLeft > 0:
                self.clockNode.setPos(-.74, 0, -0.2)
                if self.isMyTurn:
                    self.clockNode.countdown(timeLeft, self.doNothing)
                else:
                    self.clockNode.countdown(timeLeft, self.doNothing)
                self.clockNode.show()
        return

    def gameStart(self, playerNum):
        if playerNum != 255:
            self.playerNum = playerNum
            if self.playerNum == 1:
                self.playerColorString = 'white'
            else:
                self.playerColorString = 'black'
            self.playerColor = self.playerColors[playerNum - 1]
            self.moveCameraForGame()
        self.fsm.request('playing')

    def sendTurn(self, playersTurn):
        if self.fsm.getCurrentState().getName() == 'playing':
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:70,代码来源:DistributedCheckers.py

示例2: __init__

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]
class CogdoFlyingGuiManager:
    ClearMessageDisplayEventName = 'ClearMessageDisplayEvent'
    EagleTargetingLocalPlayerEventName = 'EagleTargetingLocalPlayerEvent'
    EagleAttackingLocalPlayerEventName = 'EagleAttackingLocalPlayerEvent'
    FirstPressOfCtrlEventName = 'FirstPressOfCtrlEvent'
    PickedUpFirstPropellerEventName = 'PickedUpFirstPropellerEvent'
    InvulnerableEventName = 'InvulnerableEvent'
    StartRunningOutOfTimeMusicEventName = 'StartRunningOutOfTimeEvent'

    def __init__(self, level):
        self._level = level
        self.root = NodePath('CogdoFlyingGui')
        self.root.reparentTo(aspect2d)
        self.root.stash()
        self._initTimer()
        self._initHud()
        self._initMessageDisplay()
        self.sentTimeRunningOutMessage = False
        self._refuelGui = CogdoFlyingFuelGui(self.root)
        self._progressGui = CogdoFlyingProgressGui(self.root, self._level)

    def _initHud(self):
        self._memoGui = CogdoMemoGui(self.root)
        self._memoGui.posNextToLaffMeter()

    def _initTimer(self):
        self._timer = ToontownTimer()
        self._timer.reparentTo(self.root)
        self._timer.posInTopRightCorner()

    def _initMessageDisplay(self):
        audioMgr = base.cogdoGameAudioMgr
        sound = audioMgr.createSfx('popupHelpText')
        self._messageDisplay = CogdoGameMessageDisplay('CogdoFlyingMessageDisplay', self.root, sfx=sound)

    def destroyTimer(self):
        if self._timer is not None:
            self._timer.stop()
            self._timer.destroy()
            self._timer = None
        return

    def onstage(self):
        self.root.unstash()
        self._refuelGui.hide()
        self._progressGui.hide()

    def presentProgressGui(self):
        ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._progressGui, 'present_progress_gui'))

    def presentRefuelGui(self):
        ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._refuelGui, 'present_fuel_gui'))

    def presentTimerGui(self):
        ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._timer, 'present_timer_gui'))

    def presentMemoGui(self):
        ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._memoGui, 'present_memo_gui'))

    def offstage(self):
        self.root.stash()
        self._refuelGui.hide()
        self._progressGui.hide()
        self.hideTimer()

    def getTimeLeft(self):
        return Globals.Gameplay.SecondsUntilGameOver - self._timer.getElapsedTime()

    def isTimeRunningOut(self):
        return self.getTimeLeft() < Globals.Gameplay.TimeRunningOutSeconds

    def startTimer(self, duration, timerExpiredCallback = None, keepHidden = False):
        if self._timer is None:
            self._initTimer()
        self._timer.setTime(duration)
        self._timer.countdown(duration, timerExpiredCallback)
        if keepHidden:
            self.hideTimer()
        else:
            self.showTimer()
        return

    def stopTimer(self):
        if hasattr(self, '_timer') and self._timer is not None:
            self.hideTimer()
            self._timer.stop()
        return

    def showTimer(self):
        self._timer.show()

    def hideTimer(self):
        self._timer.hide()

    def forceTimerDone(self):
        if self._timer.countdownTask != None:
            self._timer.countdownTask.duration = 0
        return

    def showRefuelGui(self):
#.........这里部分代码省略.........
开发者ID:nate97,项目名称:src,代码行数:103,代码来源:CogdoFlyingGuiManager.py

示例3: DistributedPicnicTable

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]

#.........这里部分代码省略.........

    def delete(self):
        self.__disableCollisions()
        self.ignore('stoppedAsleep')
        DistributedNode.DistributedNode.delete(self)
        self.disableChoiceButtons()
        self.cameraBoardTrack = None
        del self.winTrack
        del self.outTrack
        self.fsm = None
        self.gameZone = None
        self.clearToonTracks()
        self.cameraBoardTrack = None

    def setName(self, name):
        self.name = name

    def setGameDoId(self, doId):
        self.gameDoId = doId
        self.game = self.cr.doId2do[doId]
        self.game.setHpr(self.getHpr())
        self.gameWantTimer = self.game.wantTimer
        if self.gameState == 1:
            self.game.fsm.request('playing')

    def setTimerFunc(self, function):
        self.timerFunc = function

    def setTimer(self, timerEnd):
        self.clockNode.stop()
        time = globalClockDelta.networkToLocalTime(timerEnd)
        self.timeLeft = int(time - globalClock.getRealTime())
        if self.gameWantTimer and self.game != None:
            self.showTimer()

    def showTimer(self):
        self.clockNode.stop()
        self.clockNode.countdown(self.timeLeft, self.timerFunc)
        self.clockNode.show()

    def requestTableState(self):
        self.sendUpdate('requestTableState', [])

    def setTableState(self, tableStateList, isplaying):
        y = 0
        print 'SET TABLE STATE'
        if isplaying == 0:
            self.isPlaying = False
        else:
            self.isPlaying = True
        for x in tableStateList:
            if x != 0:
                if x not in self.tableState and self.cr.doId2do.has_key(x) and x not in self.haveAnimated:
                    seatIndex = tableStateList.index(x)
                    toon = self.cr.doId2do[x]
                    toon.stopSmooth()
                    toon.setAnimState('Sit', 1.0)
                    dest = self.seats[seatIndex].getPos(self.tableCloth)
                    hpr = self.seats[seatIndex].getHpr(render)
                    toon.setHpr(hpr)
                    if seatIndex > 2:
                        toon.setH(self.getH() + 180)
                    toon.wrtReparentTo(self)
                    toon.setPos(dest)
                    toon.setZ(toon.getZ() + 1.35)
                    if seatIndex > 2:
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:70,代码来源:DistributedPicnicTable.py

示例4: DistributedChineseCheckers

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]

#.........这里部分代码省略.........
        
        if self.startButton:
            self.startButton.destroy()
        
        self.clockNode.stop()
        self.clockNode.hide()
        self.table.startButtonPushed = None
        self.ignore('mouse1')
        self.ignore('stoppedAsleep')
        self.fsm = None
        self.table = None
        self.cleanPlayerTags()
        del self.playerTags
        del self.playerTagList
        self.playerSeats = None
        self.yourTurnBlinker.finish()

    
    def getTimer(self):
        self.sendUpdate('requestTimer', [])

    
    def setTimer(self, timerEnd):
        if self.fsm.getCurrentState() != None and self.fsm.getCurrentState().getName() == 'waitingToBegin' and not (self.table.fsm.getCurrentState().getName() == 'observing'):
            self.clockNode.stop()
            time = globalClockDelta.networkToLocalTime(timerEnd)
            timeLeft = int(time - globalClock.getRealTime())
            if timeLeft > 0 and timerEnd != 0:
                if timeLeft > 60:
                    timeLeft = 60
                
                self.clockNode.setPos(1.1599999999999999, 0, -0.82999999999999996)
                self.clockNode.countdown(timeLeft, self.startButtonPushed)
                self.clockNode.show()
            else:
                self.clockNode.stop()
                self.clockNode.hide()
        

    
    def setTurnTimer(self, turnEnd):
        if self.fsm.getCurrentState() != None and self.fsm.getCurrentState().getName() == 'playing':
            self.clockNode.stop()
            time = globalClockDelta.networkToLocalTime(turnEnd)
            timeLeft = int(time - globalClock.getRealTime())
            if timeLeft > 0:
                self.clockNode.setPos(-0.73999999999999999, 0, -0.20000000000000001)
                if self.isMyTurn:
                    self.clockNode.countdown(timeLeft, self.doRandomMove)
                else:
                    self.clockNode.countdown(timeLeft, self.doNothing)
                self.clockNode.show()
            
        

    
    def gameStart(self, playerNum):
        if playerNum != 255:
            self.playerNum = playerNum
            self.playerColor = self.playerColors[playerNum - 1]
            self.moveCameraForGame()
            playerPos = playerNum - 1
            import copy as copy
            self.nonOpposingPositions = copy.deepcopy(self.startingPositions)
            if playerPos == 0:
                self.nonOpposingPositions.pop(0)
开发者ID:ponyboy837,项目名称:Toontown-2003-Server,代码行数:70,代码来源:DistributedChineseCheckers.py

示例5: DistributedFindFour

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]

#.........这里部分代码省略.........

    def delete(self):
        DistributedNode.DistributedNode.delete(self)
        self.table.gameDoId = None
        self.table.game = None
        if self.exitButton:
            self.exitButton.destroy()
        if self.startButton:
            self.startButton.destroy()
        self.clockNode.stop()
        self.clockNode.hide()
        self.table.startButtonPushed = None
        self.ignore('mouse1')
        self.ignore('stoppedAsleep')
        self.fsm = None
        self.table = None
        self.winningSequence.finish()
        taskMgr.remove('playerTurnTask')
        return

    def getTimer(self):
        self.sendUpdate('requestTimer', [])

    def setTimer(self, timerEnd):
        if self.fsm.getCurrentState() != None and self.fsm.getCurrentState().getName() == 'waitingToBegin' and not self.table.fsm.getCurrentState().getName() == 'observing':
            self.clockNode.stop()
            time = globalClockDelta.networkToLocalTime(timerEnd)
            timeLeft = int(time - globalClock.getRealTime())
            if timeLeft > 0 and timerEnd != 0:
                if timeLeft > 60:
                    timeLeft = 60
                self.clockNode.setPos(1.16, 0, -0.83)
                self.clockNode.countdown(timeLeft, self.startButtonPushed)
                self.clockNode.show()
            else:
                self.clockNode.stop()
                self.clockNode.hide()
        return

    def setTurnTimer(self, turnEnd):
        if self.fsm.getCurrentState() != None and self.fsm.getCurrentState().getName() == 'playing':
            self.clockNode.stop()
            time = globalClockDelta.networkToLocalTime(turnEnd)
            timeLeft = int(time - globalClock.getRealTime())
            if timeLeft > 0:
                self.clockNode.setPos(0.64, 0, -0.27)
                self.clockNode.countdown(timeLeft, self.doRandomMove)
                self.clockNode.show()
        return

    def gameStart(self, playerNum):
        if playerNum != 255:
            self.playerNum = playerNum
            if self.playerNum == 1:
                self.playerColorString = 'Red'
            else:
                self.playerColorString = 'Yellow'
            self.moveCameraForGame()
        self.fsm.request('playing')

    def sendTurn(self, playersTurn):
        if self.fsm.getCurrentState().getName() == 'playing':
            if playersTurn == self.playerNum:
                self.isMyTurn = True
                taskMgr.add(self.turnTask, 'playerTurnTask')
            self.enableTurnScreenText(playersTurn)
开发者ID:Keithybub,项目名称:ToonTownReviveOld,代码行数:70,代码来源:DistributedFindFour.py

示例6: DistributedGameTable

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]

#.........这里部分代码省略.........

    def exitObserving(self):
        pass

    def enterSitting(self):
        pass

    def exitSitting(self):
        self.destroyGameMenu()

    def destroyGameMenu(self):
        if self.gameMenu:
            self.gameMenu.removeButtons()
            self.gameMenu.picnicFunction = None
            self.gameMenu = None

    def setPosHpr(self, x, y, z, h, p, r):
        self.picnicTable.setPosHpr(x, y, z, h, p, r)

    def storeToonTrack(self, avId, track):
        self.clearToonTrack(avId)
        self.__toonTracks[avId] = track

    def clearToonTrack(self, avId):
        oldTrack = self.__toonTracks.get(avId)
        if oldTrack:
            oldTrack.pause()
            cleanupDelayDeletes(oldTrack)

    def clearToonTracks(self):
        for avId in self.__toonTracks:
            self.clearToonTrack(avId)

    def showTimer(self):
        self.clockNode.stop()
        self.clockNode.countdown(self.timeLeft, self.timerFunc)
        self.clockNode.show()

    def setTimer(self, timerEnd):
        self.clockNode.stop()
        time = globalClockDelta.networkToLocalTime(timerEnd)
        self.timeLeft = int(time - globalClock.getRealTime())
        if self.gameWantTimer and (self.game is not None):
            self.showTimer()

    def setTimerFunc(self, function):
        self.timerFunc = function

    def allowWalk(self):
        base.cr.playGame.getPlace().setState('walk')

    def disallowWalk(self):
        base.cr.playGame.getPlace().setState('stopped')

    def enableChoiceButtons(self):
        if (not self.game) or (not self.game.playing):
            self.joinButton = DirectButton(
                relief=None, text=TTLocalizer.PicnicTableJoinButton,
                text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.8,
                image=(self.upButton, self.downButton, self.rolloverButton),
                image_color=(1, 0, 0, 1), image_scale=(20, 1, 11),
                pos=(0, 0, 0.8), scale=0.15,
                command=lambda self=self: self.joinButtonPushed())
        else:
            self.observeButton = DirectButton(
                relief=None, text=TTLocalizer.PicnicTableObserveButton,
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:70,代码来源:DistributedGameTable.py

示例7: DistributedPicnicBasket

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]

#.........这里部分代码省略.........
        self.notify.debug('Entering Picnic Table Sphere.... %s' % self.getDoId())
        self.loader.place.detectedPicnicTableSphereCollision(self)

    
    def handleEnterPicnicTable(self, i):
        toon = base.localAvatar
        self.sendUpdate('requestBoard', [
            i])

    
    def fillSlot0(self, avId):
        self.fillSlot(0, avId)

    
    def fillSlot1(self, avId):
        self.fillSlot(1, avId)

    
    def fillSlot2(self, avId):
        self.fillSlot(2, avId)

    
    def fillSlot3(self, avId):
        self.fillSlot(3, avId)

    
    def fillSlot(self, index, avId):
        self.notify.debug('fill Slot: %d for %d' % (index, avId))
        if avId == 0:
            pass
        1
        self.fullSeat[index] = self.seatState.Full
        if avId == base.localAvatar.getDoId():
            self.clockNode.show()
            if index == 0 or index == 3:
                side = -1
            else:
                side = 1
            if hasattr(self.loader.place, 'trolley'):
                self.loader.place.trolley.fsm.request('boarding', [
                    self.tablecloth,
                    side])
            else:
                self.notify.warning('fillSlot no trolley in place')
            self.localToonOnBoard = 1
        
        if avId == base.localAvatar.getDoId():
            if hasattr(self.loader.place, 'trolley'):
                self.loader.place.trolley.fsm.request('boarded')
                self.loader.place.trolley.exitButton.hide()
            
        
        if self.cr.doId2do.has_key(avId):
            toon = self.cr.doId2do[avId]
            toon.stopSmooth()
            toon.wrtReparentTo(self.tablecloth)
            sitStartDuration = toon.getDuration('sit-start')
            jumpTrack = self.generateToonJumpTrack(toon, index)
            track = Sequence(jumpTrack, Func(toon.setAnimState, 'Sit', 1.0))
            self.notify.debug('### fillSlot: fullSeat = %s' % self.fullSeat)
            if self.fullSeat.count(0) == 3:
                self.notify.debug('### fillSlot: adding basketAppear')
                if self.picnicBasketTrack:
                    self.picnicBasketTrack.finish()
                
                waitDuration = track.getDuration()
开发者ID:OldToontown,项目名称:OldToontown,代码行数:70,代码来源:DistributedPicnicBasket.py

示例8: DistributedViewingBlock

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]
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()
#.........这里部分代码省略.........
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:103,代码来源:DistributedStartingBlock.py

示例9: __init__

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import show [as 别名]
class CogdoMazeGuiManager:

    def __init__(self, maze, bossCode):
        self.maze = maze
        self.root = NodePath('CogdoMazeGui')
        self.root.reparentTo(aspect2d)
        self.mazeMapGui = CogdoMazeMapGui(self.maze.collisionTable)
        if bossCode is not None:
            self._bossGui = CogdoMazeBossGui(bossCode)
        else:
            self._bossGui = None
        self._memoGui = CogdoMemoGui(self.root)
        self._memoGui.posNextToLaffMeter()
        self._presentGuiIval = None
        self._presentTimerIval = None
        self._hud = CogdoMazeHud()
        self._timer = None
        self._initMessageDisplay()
        return

    def _initTimer(self):
        self._timer = ToontownTimer()
        self._timer.hide()
        self._timer.posInTopRightCorner()

    def _initMessageDisplay(self):
        self.messageDisplay = CogdoGameMessageDisplay('CogdoMazeMessageDisplay', self.root, pos=Globals.MessageLabelPos)

    def destroy(self):
        ToontownIntervals.cleanup('present_gui')
        ToontownIntervals.cleanup('present_timer')
        ToontownIntervals.cleanup('present_memo')
        self._hud.destroy()
        self._hud = None
        self._memoGui.destroy()
        self._memoGui = None
        if self._bossGui is not None:
            self._bossGui.destroy()
            self._bossGui = None
        self.messageDisplay.destroy()
        self.messageDisplay = None
        self.destroyMazeMap()
        self.destroyTimer()
        if self._presentGuiIval:
            self._presentGuiIval.pause()
            self._presentGuiIval = None
        if self._presentTimerIval:
            self._presentTimerIval.pause()
            self._presentTimerIval = None
        return

    def destroyMazeMap(self):
        if hasattr(self, 'mazeMapGui') and self.mazeMapGui is not None:
            self.mazeMapGui.destroy()
            del self.mazeMapGui
        return

    def destroyTimer(self):
        if self._timer is not None:
            self._timer.stop()
            self._timer.destroy()
            self._timer = None
        return

    def showPickupCounter(self):
        ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._memoGui, 'present_memo'))

    def startGame(self, firstMessage):
        self._presentGuiIval = ToontownIntervals.start(Sequence(ToontownIntervals.getPresentGuiIval(self._bossGui, '', startPos=(0, 0, -0.15)), Func(self.mazeMapGui.show), ToontownIntervals.getPulseLargerIval(self.mazeMapGui, '', scale=self.mazeMapGui.getScale()), Func(self.setMessage, firstMessage), name='present_gui'))

    def hideMazeMap(self):
        self.mazeMapGui.hide()

    def showBossGui(self):
        if self._bossGui is not None:
            self._bossGui.show()
        return

    def hideBossGui(self):
        if self._bossGui is not None:
            self._bossGui.hide()
        return

    def revealMazeMap(self):
        self.mazeMapGui.revealAll()

    def hideLock(self, lockIndex):
        self.mazeMapGui.hideLock(lockIndex)

    def showTimer(self, duration, timerExpiredCallback = None):
        if self._timer is None:
            self._initTimer()
        self._timer.setTime(duration)
        self._timer.countdown(duration, timerExpiredCallback)
        self._timer.show()
        self._presentTimerIval = ToontownIntervals.start(ToontownIntervals.getPresentGuiIval(self._timer, 'present_timer', startPos=(0, 0, 0.35)))
        return

    def hideTimer(self):
        if hasattr(self, 'timer') and self._timer is not None:
#.........这里部分代码省略.........
开发者ID:Teku16,项目名称:ToontownPlanet,代码行数:103,代码来源:CogdoMazeGuiManager.py


注:本文中的toontown.toonbase.ToontownTimer.ToontownTimer.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。