本文整理汇总了Python中toontown.minigame.DistributedMinigame.DistributedMinigame类的典型用法代码示例。如果您正苦于以下问题:Python DistributedMinigame类的具体用法?Python DistributedMinigame怎么用?Python DistributedMinigame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DistributedMinigame类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, cr):
DistributedMinigame.__init__(self, cr)
self.gameFSM = ClassicFSM.ClassicFSM(
"DistributedCogThiefGame",
[
State.State("off", self.enterOff, self.exitOff, ["play"]),
State.State("play", self.enterPlay, self.exitPlay, ["cleanup"]),
State.State("cleanup", self.enterCleanup, self.exitCleanup, []),
],
"off",
"cleanup",
)
self.addChildGameFSM(self.gameFSM)
self.cameraTopView = (0, 0, 55, 0, -90.0, 0)
self.barrels = []
self.cogInfo = {}
self.lastTimeControlPressed = 0
self.stolenBarrels = []
self.useOrthoWalk = base.config.GetBool("cog-thief-ortho", 1)
self.resultIval = None
self.gameIsEnding = False
self.__textGen = TextNode("cogThiefGame")
self.__textGen.setFont(ToontownGlobals.getSignFont())
self.__textGen.setAlign(TextNode.ACenter)
return
示例2: onstage
def onstage(self):
self.notify.debug("onstage")
DistributedMinigame.onstage(self)
self.gameBoard.reparentTo(render)
lt = base.localAvatar
lt.reparentTo(render)
self._DistributedCogThiefGame__placeToon(self.localAvId)
lt.setSpeed(0, 0)
self.moveCameraToTop()
toonSD = self.toonSDs[self.localAvId]
toonSD.enter()
toonSD.fsm.request("normal")
self.stopGameWalk()
for cogIndex in xrange(self.getNumCogs()):
suit = self.cogInfo[cogIndex]["suit"].suit
pos = self.cogInfo[cogIndex]["pos"]
suit.reparentTo(self.gameBoard)
suit.setPos(pos)
for avId in self.avIdList:
self.toonHitTracks[avId] = Wait(0.10000000000000001)
self.toonRNGs = []
for i in xrange(self.numPlayers):
self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen))
self.sndTable = {"hitBySuit": [None] * self.numPlayers, "falling": [None] * self.numPlayers}
for i in xrange(self.numPlayers):
self.sndTable["hitBySuit"][i] = base.loadSfx("phase_4/audio/sfx/MG_Tag_C.mp3")
self.sndTable["falling"][i] = base.loadSfx("phase_4/audio/sfx/MG_cannon_whizz.mp3")
base.playMusic(self.music, looping=1, volume=0.80000000000000004)
self.introTrack = self.getIntroTrack()
self.introTrack.start()
示例3: onstage
def onstage(self):
self.notify.debug('onstage')
DistributedMinigame.onstage(self)
self.gameBoard.reparentTo(render)
self.sky.reparentTo(render)
lt = base.localAvatar
lt.reparentTo(render)
self.__placeToon(self.localAvId)
lt.setSpeed(0, 0)
toonSD = self.toonSDs[self.localAvId]
toonSD.enter()
toonSD.fsm.request('normal')
self.stopGameWalk()
for cogIndex in xrange(self.getNumCogs()):
suit = self.cogInfo[cogIndex]['suit'].suit
pos = self.cogInfo[cogIndex]['pos']
suit.reparentTo(self.gameBoard)
suit.setPos(pos)
for avId in self.avIdList:
self.toonHitTracks[avId] = Wait(0.1)
self.toonRNGs = []
for i in xrange(self.numPlayers):
self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen))
self.sndTable = {'hitBySuit': [None] * self.numPlayers,
'falling': [None] * self.numPlayers}
for i in xrange(self.numPlayers):
self.sndTable['hitBySuit'][i] = base.loadSfx('phase_4/audio/sfx/MG_Tag_C.ogg')
self.sndTable['falling'][i] = base.loadSfx('phase_4/audio/sfx/MG_cannon_whizz.ogg')
base.playMusic(self.music, looping=1, volume=0.8)
return
示例4: unload
def unload(self):
self.notify.debug('unload')
DistributedMinigame.unload(self)
del self.music
self.removeChildGameFSM(self.gameFSM)
del self.gameFSM
self.gameBoard.removeNode()
self.sky.removeNode()
del self.gameBoard
for barrel in self.barrels:
barrel.removeNode()
del self.barrels
for avId in self.toonSDs.keys():
toonSD = self.toonSDs[avId]
toonSD.unload()
del self.toonSDs
self.timer.destroy()
del self.timer
self.rewardPanel.destroy()
del self.rewardPanel
self.jarImage.removeNode()
del self.jarImage
del self.sndRewardTick
示例5: setGameStart
def setGameStart(self, timestamp):
if not self.hasLocalToon:
return
self.notify.debug('setGameStart')
DistributedMinigame.setGameStart(self, timestamp)
if not config.GetBool('cog-thief-endless', 0):
self.timer.show()
self.timer.countdown(CTGG.GameTime, self.__gameTimerExpired)
self.clockStopTime = None
self.rewardPanel.reparentTo(base.a2dTopRight)
self.scoreMult = MinigameGlobals.getScoreMult(self.cr.playGame.hood.id)
self.__startRewardCountdown()
self.gameFSM.request('play')
return
示例6: __init__
def __init__(self, cr):
DistributedMinigame.__init__(self, cr)
self.gameFSM = ClassicFSM.ClassicFSM('DistributedCogThiefGame', [State.State('off', self.enterOff, self.exitOff, ['play']), State.State('play', self.enterPlay, self.exitPlay, ['cleanup']), State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'off', 'cleanup')
self.addChildGameFSM(self.gameFSM)
self.cameraTopView = (0, 0, 55, 0, -90.0, 0)
self.barrels = []
self.cogInfo = {}
self.lastTimeControlPressed = 0
self.stolenBarrels = []
self.resultIval = None
self.gameIsEnding = False
self.__textGen = TextNode('cogThiefGame')
self.__textGen.setFont(ToontownGlobals.getSignFont())
self.__textGen.setAlign(TextNode.ACenter)
return
示例7: setGameStart
def setGameStart(self, timestamp):
if not self.hasLocalToon:
return
self.notify.debug("setGameStart")
DistributedMinigame.setGameStart(self, timestamp)
if not base.config.GetBool("cog-thief-endless", 0):
self.timer.show()
self.timer.countdown(CTGG.GameTime, self.__gameTimerExpired)
self.clockStopTime = None
self.rewardPanel.reparentTo(aspect2d)
self.scoreMult = MinigameGlobals.getScoreMult(self.cr.playGame.hood.id)
self.__startRewardCountdown()
if self.introTrack.isPlaying():
self.introTrack.finish()
self.gameFSM.request("play")
return
示例8: offstage
def offstage(self):
self.notify.debug('offstage')
self.gameBoard.hide()
self.music.stop()
for barrel in self.barrels:
barrel.hide()
for avId in self.toonSDs.keys():
self.toonSDs[avId].exit()
for avId in self.avIdList:
av = self.getAvatar(avId)
if av:
av.resetLOD()
self.timer.reparentTo(hidden)
self.rewardPanel.reparentTo(hidden)
DistributedMinigame.offstage(self)
示例9: __init__
def __init__(self, cr):
DistributedMinigame.__init__(self, cr)
self.gameFSM = ClassicFSM.ClassicFSM('DistributedCogThiefGame', [State.State('off', self.enterOff, self.exitOff, ['play']), State.State('play', self.enterPlay, self.exitPlay, ['cleanup']), State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'off', 'cleanup')
self.addChildGameFSM(self.gameFSM)
toon = base.localAvatar
camera.reparentTo(toon)
camera.setPos(0,-15,5)
camera.setHpr(0, -5, 0)
self.barrels = []
self.cogInfo = {}
self.lastTimeControlPressed = 0
self.stolenBarrels = []
self.useOrthoWalk = config.GetBool('cog-thief-ortho', 0)
self.resultIval = None
self.gameIsEnding = False
self.__textGen = TextNode('cogThiefGame')
self.__textGen.setFont(ToontownGlobals.getSignFont())
self.__textGen.setAlign(TextNode.ACenter)
return
示例10: offstage
def offstage(self):
self.notify.debug("offstage")
self.gameBoard.hide()
self.music.stop()
for barrel in self.barrels:
barrel.hide()
for avId in self.toonSDs.keys():
self.toonSDs[avId].exit()
for avId in self.avIdList:
av = self.getAvatar(avId)
if av:
av.resetLOD()
self.timer.reparentTo(hidden)
self.rewardPanel.reparentTo(hidden)
if self.introTrack.isPlaying():
self.introTrack.finish()
del self.introTrack
DistributedMinigame.offstage(self)
示例11: setGameReady
def setGameReady(self):
if not self.hasLocalToon:
return
self.notify.debug('setGameReady')
if DistributedMinigame.setGameReady(self):
return
for avId in self.remoteAvIdList:
toon = self.getAvatar(avId)
if toon:
toon.reparentTo(render)
self.__placeToon(avId)
toon.useLOD(1000)
toonSD = CogThiefGameToonSD.CogThiefGameToonSD(avId, self)
self.toonSDs[avId] = toonSD
toonSD.load()
toonSD.enter()
toonSD.fsm.request('normal')
toon.startSmooth()
示例12: load
def load(self):
self.notify.debug('load')
DistributedMinigame.load(self)
self.music = base.loadMusic('phase_4/audio/bgm/MG_CogThief.ogg')
self.initCogInfo()
for barrelIndex in range(CTGG.NumBarrels):
barrel = loader.loadModel('phase_4/models/minigames/cogthief_game_gagTank')
barrel.setPos(CTGG.BarrelStartingPositions[barrelIndex])
barrel.setScale(self.BarrelScale)
barrel.reparentTo(render)
barrel.setTag('barrelIndex', str(barrelIndex))
collSphere = CollisionSphere(0, 0, 0, 4)
collSphere.setTangible(0)
name = 'BarrelSphere-%d' % barrelIndex
collSphereName = self.uniqueName(name)
collNode = CollisionNode(collSphereName)
collNode.setFromCollideMask(CTGG.BarrelBitmask)
collNode.addSolid(collSphere)
colNp = barrel.attachNewNode(collNode)
handler = CollisionHandlerEvent()
handler.setInPattern('barrelHit-%fn')
base.cTrav.addCollider(colNp, handler)
self.accept('barrelHit-' + collSphereName, self.handleEnterBarrel)
nodeToHide = '**/gagMoneyTen'
if barrelIndex % 2:
nodeToHide = '**/gagMoneyFive'
iconToHide = barrel.find(nodeToHide)
if not iconToHide.isEmpty():
iconToHide.hide()
self.barrels.append(barrel)
self.gameBoard = loader.loadModel('phase_4/models/minigames/cogthief_game')
self.gameBoard.find('**/floor_TT').hide()
self.gameBoard.find('**/floor_DD').hide()
self.gameBoard.find('**/floor_DG').hide()
self.gameBoard.find('**/floor_MM').hide()
self.gameBoard.find('**/floor_BR').hide()
self.gameBoard.find('**/floor_DL').hide()
zone = self.getSafezoneId()
if zone == ToontownGlobals.ToontownCentral:
self.gameBoard.find('**/floor_TT').show()
elif zone == ToontownGlobals.DonaldsDock:
self.gameBoard.find('**/floor_DD').show()
elif zone == ToontownGlobals.DaisyGardens:
self.gameBoard.find('**/floor_DG').show()
elif zone == ToontownGlobals.MinniesMelodyland:
self.gameBoard.find('**/floor_MM').show()
elif zone == ToontownGlobals.TheBrrrgh:
self.gameBoard.find('**/floor_BR').show()
elif zone == ToontownGlobals.DonaldsDreamland:
self.gameBoard.find('**/floor_DL').show()
else:
self.gameBoard.find('**/floor_TT').show()
self.gameBoard.setPosHpr(0, 0, 0, 0, 0, 0)
self.gameBoard.setScale(1.0)
self.toonSDs = {}
avId = self.localAvId
toonSD = CogThiefGameToonSD.CogThiefGameToonSD(avId, self)
self.toonSDs[avId] = toonSD
toonSD.load()
self.loadCogs()
self.toonHitTracks = {}
self.toonPieTracks = {}
self.sndOof = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
self.sndRewardTick = base.loadSfx('phase_3.5/audio/sfx/tick_counter.ogg')
self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.ogg')
self.timer = ToontownTimer.ToontownTimer()
self.timer.posInTopRightCorner()
self.timer.hide()
purchaseModels = loader.loadModel('phase_4/models/gui/purchase_gui')
self.jarImage = purchaseModels.find('**/Jar')
self.jarImage.reparentTo(hidden)
self.rewardPanel = DirectLabel(parent=hidden, relief=None, pos=(1.16, 0.0, 0.45), scale=0.65, text='', text_scale=0.2, text_fg=(0.95, 0.95, 0, 1), text_pos=(0, -0.13), text_font=ToontownGlobals.getSignFont(), image=self.jarImage)
self.rewardPanelTitle = DirectLabel(parent=self.rewardPanel, relief=None, pos=(0, 0, 0.06), scale=0.08, text=TTLocalizer.CannonGameReward, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1))
self.initGameWalk()
return
示例13: handleDisabledAvatar
def handleDisabledAvatar(self, avId):
self.notify.debug('handleDisabledAvatar')
self.notify.debug('avatar ' + str(avId) + ' disabled')
self.toonSDs[avId].exit(unexpectedExit=True)
del self.toonSDs[avId]
DistributedMinigame.handleDisabledAvatar(self, avId)