本文整理汇总了Python中toontown.toonbase.ToontownTimer.ToontownTimer.setPos方法的典型用法代码示例。如果您正苦于以下问题:Python ToontownTimer.setPos方法的具体用法?Python ToontownTimer.setPos怎么用?Python ToontownTimer.setPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.toonbase.ToontownTimer.ToontownTimer
的用法示例。
在下文中一共展示了ToontownTimer.setPos方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createDoorTimer
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import setPos [as 别名]
def createDoorTimer(self, team):
timer = ToontownTimer(useImage=False, highlightNearEnd=False)
timer['text_font'] = ToontownGlobals.getMinnieFont()
timer.setFontColor(PartyGlobals.CogActivityColors[team])
timer.setScale(7.0)
timer.setPos(0.2, -0.03, 0.0)
return timer
示例2: DistributedCheckers
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import setPos [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):
#.........这里部分代码省略.........
示例3: DistributedChineseCheckers
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import setPos [as 别名]
class DistributedChineseCheckers(DistributedNode.DistributedNode):
def __init__(self, cr):
NodePath.__init__(self, 'DistributedChineseCheckers')
DistributedNode.DistributedNode.__init__(self, cr)
self.cr = cr
self.reparentTo(render)
self.boardNode = loader.loadModel('phase_6/models/golf/checker_game.bam')
self.boardNode.reparentTo(self)
self.board = ChineseCheckersBoard()
self.playerTags = render.attachNewNode('playerTags')
self.playerTagList = []
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.moveList = []
self.mySquares = []
self.playerSeats = None
self.accept('mouse1', self.mouseClick)
self.traverser = base.cTrav
self.pickerNode = CollisionNode('mouseRay')
self.pickerNP = 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.1599999999999999, 0, -0.82999999999999996)
self.clockNode.setScale(0.29999999999999999)
self.clockNode.hide()
self.playerColors = [
Vec4(0, 0.90000000000000002, 0, 1),
Vec4(0.90000000000000002, 0.90000000000000002, 0, 1),
Vec4(0.45000000000000001, 0, 0.45000000000000001, 1),
Vec4(0.20000000000000001, 0.40000000000000002, 0.80000000000000004, 1),
Vec4(1, 0.45000000000000001, 1, 1),
Vec4(0.80000000000000004, 0, 0, 1)]
self.tintConstant = Vec4(0.25, 0.25, 0.25, 0)
self.ghostConstant = Vec4(0, 0, 0, 0.5)
self.startingPositions = [
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9],
[
10,
11,
12,
13,
23,
24,
25,
35,
36,
46],
[
65,
75,
76,
86,
87,
88,
98,
99,
100,
101],
[
111,
112,
113,
114,
115,
116,
117,
118,
#.........这里部分代码省略.........
示例4: DistributedPicnicTable
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import setPos [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 setPos [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 setPos [as 别名]
class DistributedGameTable(DistributedObject.DistributedObject):
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
self.tableModelPath = 'phase_6/models/golf/game_table.bam'
self.numSeats = 6
self.__toonTracks = {}
self.gameMenu = None
self.game = None
self.gameDoId = 0
self.timerFunc = None
self.gameWantTimer = False
self.cameraBoardTrack = None
self.tutorial = None
self.fsm = ClassicFSM.ClassicFSM(
'DistributedGameTable',
[
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()
def generate(self):
DistributedObject.DistributedObject.generate(self)
self.picnicTableNode = render.attachNewNode('gameTable')
self.picnicTable = loader.loadModel(self.tableModelPath)
self.picnicTable.reparentTo(self.picnicTableNode)
self.loader = self.cr.playGame.hood.loader
self.picnicTableNode.reparentTo(self.loader.geom)
def announceGenerate(self):
DistributedObject.DistributedObject.announceGenerate(self)
self.tableCloth = self.picnicTable.find('**/basket_locator')
cn = CollisionNode('tableCloth_sphere')
self.tableClothSphereNode = self.tableCloth.attachNewNode(cn)
cs = CollisionSphere(0, 0, -2, 5.5)
self.tableClothSphereNode.node().addSolid(cs)
self.seats = []
self.jumpOffsets = []
self.picnicTableSphereNodes = []
for i in xrange(self.numSeats):
self.seats.append(self.picnicTable.find('**/*seat' + str(i+1)))
self.jumpOffsets.append(self.picnicTable.find('**/*jumpOut' + str(i+1)))
cn = CollisionNode('picnicTable_sphere_{0}_{1}'.format(self.doId, i))
self.picnicTableSphereNodes.append(self.seats[i].attachNewNode(cn))
cs = CollisionSphere(0, 0, 0, 2)
self.picnicTableSphereNodes[i].node().addSolid(cs)
self.clockNode = ToontownTimer()
self.clockNode.setPos(1.16, 0, -0.83)
self.clockNode.setScale(0.3)
self.clockNode.hide()
self.buttonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui.bam')
self.upButton = self.buttonModels.find('**//InventoryButtonUp')
self.downButton = self.buttonModels.find('**/InventoryButtonDown')
self.rolloverButton = self.buttonModels.find('**/InventoryButtonRollover')
self.joinButton = None
self.observeButton = None
self.exitButton = None
self.tutorialButton = None
angle = self.picnicTable.getH()
angle -= 90
radAngle = math.radians(angle)
unitVec = Vec3(math.cos(radAngle), math.sin(radAngle), 0)
unitVec *= 30.0
self.endPos = self.picnicTable.getPos() + unitVec
self.enableCollisions()
def disable(self):
DistributedObject.DistributedObject.disable(self)
self.fsm.request('off')
self.clearToonTracks()
# TODO: Disable choice buttons.
# TODO: Stop sleep tracking.
self.destroyGameMenu()
self.disableCollisions()
del self.gameMenu
if self.cameraBoardTrack:
self.cameraBoardTrack.finish()
#.........这里部分代码省略.........
示例7: DistributedPicnicBasket
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import setPos [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)])
#.........这里部分代码省略.........
示例8: DistributedViewingBlock
# 需要导入模块: from toontown.toonbase.ToontownTimer import ToontownTimer [as 别名]
# 或者: from toontown.toonbase.ToontownTimer.ToontownTimer import setPos [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()
#.........这里部分代码省略.........