本文整理汇总了Python中toontown.toonbase.ToontownTimer.ToontownTimer.stop方法的典型用法代码示例。如果您正苦于以下问题:Python ToontownTimer.stop方法的具体用法?Python ToontownTimer.stop怎么用?Python ToontownTimer.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.toonbase.ToontownTimer.ToontownTimer
的用法示例。
在下文中一共展示了ToontownTimer.stop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DistributedCheckers
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import stop [as 别名]
class DistributedCheckers(DistributedNode.DistributedNode):
def __init__(self, cr):
NodePath.__init__(self, 'DistributedCheckers')
DistributedNode.DistributedNode.__init__(self, cr)
self.cr = cr
self.reparentTo(render)
self.boardNode = loader.loadModel('phase_6/models/golf/regular_checker_game.bam')
self.boardNode.reparentTo(self)
self.board = CheckersBoard()
self.exitButton = None
self.inGame = False
self.waiting = True
self.startButton = None
self.playerNum = None
self.turnText = None
self.isMyTurn = False
self.wantTimer = True
self.leaveButton = None
self.screenText = None
self.turnText = None
self.exitButton = None
self.numRandomMoves = 0
self.blinker = Sequence()
self.moveList = []
self.mySquares = []
self.myKings = []
self.isRotated = False
self.accept('mouse1', self.mouseClick)
self.traverser = base.cTrav
self.pickerNode = CollisionNode('mouseRay')
self.pickerNP = base.camera.attachNewNode(self.pickerNode)
self.pickerNode.setFromCollideMask(ToontownGlobals.WallBitmask)
self.pickerRay = CollisionRay()
self.pickerNode.addSolid(self.pickerRay)
self.myHandler = CollisionHandlerQueue()
self.traverser.addCollider(self.pickerNP, self.myHandler)
self.buttonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
self.upButton = self.buttonModels.find('**//InventoryButtonUp')
self.downButton = self.buttonModels.find('**/InventoryButtonDown')
self.rolloverButton = self.buttonModels.find('**/InventoryButtonRollover')
self.clockNode = ToontownTimer()
self.clockNode.setPos(1.16, 0, -0.83)
self.clockNode.setScale(0.3)
self.clockNode.hide()
self.playerColors = [Vec4(0, 0, 1, 1), Vec4(0, 1, 0, 1)]
self.tintConstant = Vec4(0.25, 0.25, 0.25, 0.5)
self.ghostConstant = Vec4(0, 0, 0, 0.8)
self.startingPositions = [[0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11], [20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31]]
self.knockSound = base.loadSfx('phase_5/audio/sfx/GUI_knock_1.ogg')
self.clickSound = base.loadSfx('phase_3/audio/sfx/GUI_balloon_popup.ogg')
self.moveSound = base.loadSfx('phase_6/audio/sfx/CC_move.ogg')
self.accept('stoppedAsleep', self.handleSleep)
self.fsm = ClassicFSM.ClassicFSM('ChineseCheckers', [State.State('waitingToBegin', self.enterWaitingToBegin, self.exitWaitingToBegin, ['playing', 'gameOver']), State.State('playing', self.enterPlaying, self.exitPlaying, ['gameOver']), State.State('gameOver', self.enterGameOver, self.exitGameOver, ['waitingToBegin'])], 'waitingToBegin', 'waitingToBegin')
x = self.boardNode.find('**/locator*')
self.locatorList = x.getChildren()
tempList = []
for x in xrange(0, 32):
self.locatorList[x].setTag('GamePeiceLocator', '%d' % x)
tempList.append(self.locatorList[x].attachNewNode(CollisionNode('picker%d' % x)))
tempList[x].node().addSolid(CollisionSphere(0, 0, 0, 0.39))
for z in self.locatorList:
y = loader.loadModel('phase_6/models/golf/regular_checker_piecewhite.bam')
y.find('**/checker_k*').hide()
zz = loader.loadModel('phase_6/models/golf/regular_checker_pieceblack.bam')
zz.find('**/checker_k*').hide()
y.reparentTo(z)
y.hide()
zz.reparentTo(z)
zz.hide()
return
def setName(self, name):
self.name = name
def announceGenerate(self):
#.........这里部分代码省略.........
示例2: __init__
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import stop [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):
#.........这里部分代码省略.........
示例3: DistributedChineseCheckers
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import stop [as 别名]
#.........这里部分代码省略.........
114,
115,
116,
117,
118,
119,
120],
[
74,
84,
85,
95,
96,
97,
107,
108,
109,
110],
[
19,
20,
21,
22,
32,
33,
34,
44,
45,
55]]
self.nonOpposingPositions = []
self.knockSound = base.loadSfx('phase_5/audio/sfx/GUI_knock_1.mp3')
self.clickSound = base.loadSfx('phase_3/audio/sfx/GUI_balloon_popup.mp3')
self.moveSound = base.loadSfx('phase_6/audio/sfx/CC_move.mp3')
self.accept('stoppedAsleep', self.handleSleep)
ClassicFSM = ClassicFSM
State = State
import direct.fsm
self.fsm = ClassicFSM.ClassicFSM('ChineseCheckers', [
State.State('waitingToBegin', self.enterWaitingToBegin, self.exitWaitingToBegin, [
'playing',
'gameOver']),
State.State('playing', self.enterPlaying, self.exitPlaying, [
'gameOver']),
State.State('gameOver', self.enterGameOver, self.exitGameOver, [
'waitingToBegin'])], 'waitingToBegin', 'waitingToBegin')
x = self.boardNode.find('**/locators')
self.locatorList = x.getChildren()
tempList = []
for x in range(0, 121):
self.locatorList[x].setTag('GamePeiceLocator', '%d' % x)
tempList.append(self.locatorList[x].attachNewNode(CollisionNode('picker%d' % x)))
tempList[x].node().addSolid(CollisionSphere(0, 0, 0, 0.115))
for z in self.locatorList:
y = loader.loadModel('phase_6/models/golf/checker_marble.bam')
z.setColor(0, 0, 0, 0)
y.reparentTo(z)
def setName(self, name):
self.name = name
def announceGenerate(self):
DistributedNode.DistributedNode.announceGenerate(self)
示例4: DistributedPicnicTable
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import stop [as 别名]
class DistributedPicnicTable(DistributedNode.DistributedNode):
def __init__(self, cr):
self.cr = cr
NodePath.__init__(self, 'DistributedPicnicTable')
DistributedNode.DistributedNode.__init__(self, cr)
self.reparentTo(render)
self.picnicTable = loader.loadModel('phase_6/models/golf/game_table')
self.picnicTable.reparentTo(self)
self.picnicTableSphereNodes = []
self.numSeats = 6
self.seats = []
self.jumpOffsets = []
self.inGame = False
self.requestSeat = None
self.gameState = None
self.cameraBoardTrack = Func(self.doNothing)
self.seatBumpForObserve = 0
self.winTrack = Sequence()
self.outTrack = Sequence()
self.joinButton = None
self.observeButton = None
self.tutorialButton = None
self.exitButton = None
self.isPlaying = False
self.gameMenu = None
self.game = None
self.gameZone = None
self.tutorial = None
self.timerFunc = None
self.gameDoId = None
self.gameWantTimer = False
self.tableState = [None,
None,
None,
None,
None,
None]
self.haveAnimated = []
self.winSound = base.loadSfx('phase_6/audio/sfx/KART_Applause_1.ogg')
self.happyDance = base.loadSfx('phase_5/audio/sfx/AA_heal_happydance.ogg')
self.accept('stoppedAsleep', self.handleSleep)
base.localAvatar.startSleepWatch(self.handleSleep)
self.__toonTracks = {}
self.fsm = ClassicFSM.ClassicFSM('PicnicTable', [State.State('off', self.enterOff, self.exitOff, ['chooseMode', 'observing']),
State.State('chooseMode', self.enterChooseMode, self.exitChooseMode, ['sitting', 'off', 'observing']),
State.State('sitting', self.enterSitting, self.exitSitting, ['off']),
State.State('observing', self.enterObserving, self.exitObserving, ['off'])], 'off', 'off')
self.fsm.enterInitialState()
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')
self.tableclothSphereNode = self.tableCloth.attachNewNode(CollisionNode('tablecloth_sphere'))
self.tableclothSphereNode.node().addSolid(CollisionSphere(0, 0, -2, 5.5))
self.clockNode = ToontownTimer()
self.clockNode.setPos(1.16, 0, -0.83)
self.clockNode.setScale(0.3)
self.clockNode.hide()
def announceGenerate(self):
DistributedNode.DistributedNode.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.tableState = [None,
None,
None,
None,
None,
None]
self.requestTableState()
self.buttonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
self.upButton = self.buttonModels.find('**//InventoryButtonUp')
self.downButton = self.buttonModels.find('**/InventoryButtonDown')
self.rolloverButton = self.buttonModels.find('**/InventoryButtonRollover')
angle = self.getH()
angle -= 90
radAngle = deg2Rad(angle)
unitVec = Vec3(math.cos(radAngle), math.sin(radAngle), 0)
unitVec *= 30.0
self.endPos = self.getPos() + unitVec
dist = Vec3(self.endPos - self.getPos()).length()
wheelAngle = dist / (0.7 * math.pi) * 360
self.__enableCollisions()
def handleSleep(self, task = None):
if self.fsm.getCurrentState().getName() == 'chooseMode':
self.cancelButtonPushed()
elif self.fsm.getCurrentState().getName() == 'sitting':
self.sendUpdate('requestExit', [])
if self.gameMenu != None:
self.gameMenu.removeButtons()
self.gameMenu.picnicFunction = None
self.gameMenu = None
if task != None:
task.done
#.........这里部分代码省略.........
示例5: DistributedFindFour
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import stop [as 别名]
class DistributedFindFour(DistributedNode.DistributedNode):
def __init__(self, cr):
NodePath.__init__(self, 'DistributedFindFour')
DistributedNode.DistributedNode.__init__(self, cr)
self.cr = cr
self.reparentTo(render)
self.boardNode = loader.loadModel('phase_6/models/golf/findfour_game.bam')
self.boardNode.reparentTo(self)
self.board = [[0,
0,
0,
0,
0,
0,
0],
[0,
0,
0,
0,
0,
0,
0],
[0,
0,
0,
0,
0,
0,
0],
[0,
0,
0,
0,
0,
0,
0],
[0,
0,
0,
0,
0,
0,
0],
[0,
0,
0,
0,
0,
0,
0]]
self.exitButton = None
self.inGame = False
self.waiting = True
self.startButton = None
self.playerNum = None
self.turnText = None
self.isMyTurn = False
self.wantTimer = True
self.leaveButton = None
self.screenText = None
self.turnText = None
self.exitButton = None
self.numRandomMoves = 0
self.blinker = Sequence()
self.playersTurnBlinker = Sequence()
self.yourTurnBlinker = Sequence()
self.winningSequence = Sequence()
self.moveSequence = Sequence()
self.moveList = []
self.mySquares = []
self.playerSeats = None
self.moveCol = None
self.move = None
self.accept('mouse1', self.mouseClick)
self.traverser = base.cTrav
self.pickerNode = CollisionNode('mouseRay')
self.pickerNP = camera.attachNewNode(self.pickerNode)
self.pickerNode.setFromCollideMask(BitMask32(4096))
self.pickerRay = CollisionRay()
self.pickerNode.addSolid(self.pickerRay)
self.myHandler = CollisionHandlerQueue()
self.traverser.addCollider(self.pickerNP, self.myHandler)
self.buttonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
self.upButton = self.buttonModels.find('**//InventoryButtonUp')
self.downButton = self.buttonModels.find('**/InventoryButtonDown')
self.rolloverButton = self.buttonModels.find('**/InventoryButtonRollover')
self.clockNode = ToontownTimer()
self.clockNode.setPos(1.16, 0, -0.83)
self.clockNode.setScale(0.3)
self.clockNode.hide()
self.tintConstant = Vec4(0.25, 0.25, 0.25, 0)
self.ghostConstant = Vec4(0, 0, 0, 0.5)
self.knockSound = base.loadSfx('phase_5/audio/sfx/GUI_knock_1.ogg')
self.clickSound = base.loadSfx('phase_3/audio/sfx/GUI_balloon_popup.ogg')
self.moveSound = base.loadSfx('phase_6/audio/sfx/CC_move.ogg')
self.accept('stoppedAsleep', self.handleSleep)
from direct.fsm import ClassicFSM, State
self.fsm = ClassicFSM.ClassicFSM('ChineseCheckers', [State.State('waitingToBegin', self.enterWaitingToBegin, self.exitWaitingToBegin, ['playing', 'gameOver']), State.State('playing', self.enterPlaying, self.exitPlaying, ['gameOver']), State.State('gameOver', self.enterGameOver, self.exitGameOver, ['waitingToBegin'])], 'waitingToBegin', 'waitingToBegin')
startLoc = self.boardNode.find('**/locators')
#.........这里部分代码省略.........
示例6: DistributedGameTable
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import stop [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,
text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.8,
示例7: __init__
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import stop [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()
#.........这里部分代码省略.........