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


Python ToontownTimer.countdown方法代码示例

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


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

示例1: DistributedCheckers

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

#.........这里部分代码省略.........
        self.ignore('stoppedAsleep')
        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):
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:70,代码来源:DistributedCheckers.py

示例2: __init__

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import countdown [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 countdown [as 别名]

#.........这里部分代码省略.........
        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:
                        toon.setY(toon.getY() - 1.0)
                    else:
                        toon.setY(toon.getY() + 1.0)
            if x != 0:
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:70,代码来源:DistributedPicnicTable.py

示例4: DistributedChineseCheckers

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

#.........这里部分代码省略.........
            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.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:
开发者ID:ponyboy837,项目名称:Toontown-2003-Server,代码行数:70,代码来源:DistributedChineseCheckers.py

示例5: DistributedFindFour

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

#.........这里部分代码省略.........
        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
        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')
开发者ID:Keithybub,项目名称:ToonTownReviveOld,代码行数:70,代码来源:DistributedFindFour.py

示例6: DistributedGameTable

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

#.........这里部分代码省略.........
        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,
                text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.8,
                image=(self.upButton, self.downButton, self.rolloverButton),
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:70,代码来源:DistributedGameTable.py

示例7: __init__

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

示例8: DistributedPicnicBasket

# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import countdown [as 别名]
class DistributedPicnicBasket(DistributedObject.DistributedObject):
    seatState = Enum('Empty, Full, Eating')
    notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPicnicBasket')
    
    def __init__(self, cr):
        DistributedObject.DistributedObject.__init__(self, cr)
        self.localToonOnBoard = 0
        self.seed = 0
        self.random = None
        self.picnicCountdownTime = base.config.GetFloat('picnic-countdown-time', ToontownGlobals.PICNIC_COUNTDOWN_TIME)
        self.picnicBasketTrack = None
        self.fsm = ClassicFSM.ClassicFSM('DistributedTrolley', [
            State.State('off', self.enterOff, self.exitOff, [
                'waitEmpty',
                'waitCountdown']),
            State.State('waitEmpty', self.enterWaitEmpty, self.exitWaitEmpty, [
                'waitCountdown']),
            State.State('waitCountdown', self.enterWaitCountdown, self.exitWaitCountdown, [
                'waitEmpty'])], 'off', 'off')
        self.fsm.enterInitialState()
        self._DistributedPicnicBasket__toonTracks = { }

    
    def generate(self):
        DistributedObject.DistributedObject.generate(self)
        self.loader = self.cr.playGame.hood.loader
        self.foodLoader = [
            'phase_6/models/golf/picnic_sandwich.bam',
            'phase_6/models/golf/picnic_apple.bam',
            'phase_6/models/golf/picnic_cupcake.bam',
            'phase_6/models/golf/picnic_chocolate_cake.bam']
        self.fullSeat = []
        self.food = []
        for i in range(4):
            self.food.append(None)
            self.fullSeat.append(self.seatState.Empty)
        
        self.picnicItem = 0

    
    def announceGenerate(self):
        self.picnicTable = self.loader.geom.find('**/*picnic_table_' + str(self.tableNumber))
        self.picnicTableSphereNodes = []
        self.numSeats = 4
        self.seats = []
        self.jumpOffsets = []
        self.basket = None
        for i in range(self.numSeats):
            self.seats.append(self.picnicTable.find('**/*seat%d' % (i + 1)))
            self.jumpOffsets.append(self.picnicTable.find('**/*jumpOut%d' % (i + 1)))
        
        self.tablecloth = self.picnicTable.find('**/basket_locator')
        DistributedObject.DistributedObject.announceGenerate(self)
        for i in range(self.numSeats):
            self.picnicTableSphereNodes.append(self.seats[i].attachNewNode(CollisionNode('picnicTable_sphere_%d_%d' % (self.getDoId(), i))))
            self.picnicTableSphereNodes[i].node().addSolid(CollisionSphere(0, 0, 0, 2))
        
        self.tableclothSphereNode = self.tablecloth.attachNewNode(CollisionNode('tablecloth_sphere'))
        self.tableclothSphereNode.node().addSolid(CollisionSphere(0, 0, -1, 4))
        angle = self.startingHpr[0]
        angle -= 90
        radAngle = deg2Rad(angle)
        unitVec = Vec3(math.cos(radAngle), math.sin(radAngle), 0)
        unitVec *= 30.0
        self.endPos = self.startingPos + unitVec
        dist = Vec3(self.endPos - self.enteringPos).length()
        wheelAngle = (dist / 0.5 * 1.3999999999999999 * math.pi) * 360
        self.seatNumber = 0
        self.clockNode = ToontownTimer()
        self.clockNode.setPos(1.1599999999999999, 0, -0.82999999999999996)
        self.clockNode.setScale(0.29999999999999999)
        self.clockNode.hide()

    
    def disable(self):
        DistributedObject.DistributedObject.disable(self)
        self.fsm.request('off')
        self.clearToonTracks()
        for i in range(self.numSeats):
            del self.picnicTableSphereNodes[0]
        
        del self.picnicTableSphereNodes
        self.notify.debug('Deleted self loader ' + str(self.getDoId()))
        self.picnicTable.removeNode()
        self.picnicBasketTrack = None

    
    def delete(self):
        self.notify.debug('Golf kart getting deleted: %s' % self.getDoId())
        DistributedObject.DistributedObject.delete(self)
        del self.fsm

    
    def setState(self, state, seed, timestamp):
        self.seed = seed
        if not self.random:
            self.random = RandomNumGen.RandomNumGen(seed)
        
        self.fsm.request(state, [
            globalClockDelta.localElapsedTime(timestamp)])
#.........这里部分代码省略.........
开发者ID:OldToontown,项目名称:OldToontown,代码行数:103,代码来源:DistributedPicnicBasket.py

示例9: DistributedViewingBlock

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

#.........这里部分代码省略.........
        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()
        self.timer.hide()
        DistributedStartingBlock.hideGui(self)
        return

    def countdown(self):
        countdownTime = KartGlobals.COUNTDOWN_TIME - globalClockDelta.localElapsedTime(self.kartPad.getTimestamp(self.avId))
        self.timer.countdown(countdownTime)

    def enterEnterMovie(self):
        self.notify.debug('%d enterEnterMovie: Entering the Enter Movie State.' % self.doId)
        if base.config.GetBool('want-qa-regression', 0):
            raceName = TTLocalizer.KartRace_RaceNames[self.kartPad.trackType]
            self.notify.info('QA-REGRESSION: KARTING: %s' % raceName)
        pos = self.nodePath.getPos(render)
        hpr = self.nodePath.getHpr(render)
        pos.addZ(1.7)
        hpr.addX(270)
        self.kartNode.setPosHpr(pos, hpr)
        toonTrack = self.generateToonMoveTrack()
        kartTrack = self.generateKartAppearTrack()
        jumpTrack = self.generateToonJumpTrack()
        name = self.av.uniqueName('EnterRaceTrack')
        if self.av is not None and self.localToonKarting:
            cameraTrack = self.generateCameraMoveTrack()
            self.finishMovie()
            self.movieTrack = Sequence(Parallel(cameraTrack, Sequence()), kartTrack, jumpTrack, Func(self.makeGui), Func(self.showGui), Func(self.countdown), Func(self.request, 'Waiting'), Func(self.d_movieFinished), name=name, autoFinish=1)
        else:
            self.finishMovie()
            self.movieTrack = Sequence(toonTrack, kartTrack, jumpTrack, name=name, autoFinish=1)
        self.movieTrack.start()
        self.exitRequested = True
        return
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:104,代码来源:DistributedStartingBlock.py


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