def unload(self):
     DistributedPartyTrampolineActivity.notify.debug('unload')
     if self.hopOnAnim and self.hopOnAnim.isPlaying():
         self.hopOnAnim.finish()
     if self.hopOffAnim and self.hopOffAnim.isPlaying():
         self.hopOffAnim.finish()
     if self.beginRoundInterval and self.beginRoundInterval.isPlaying():
         self.beginRoundInterval.finish()
     if self.flashTextInterval and self.flashTextInterval.isPlaying():
         self.flashTextInterval.finish()
     if self.heightTextInterval and self.heightTextInterval.isPlaying():
         self.heightTextInterval.finish()
     self.timer.stop()
     DistributedPartyActivity.unload(self)
     taskMgr.remove(self.uniqueName('TrampolineActivity.updateTask'))
     taskMgr.remove(self.uniqueName('TrampolineActivity.remoteUpdateTask'))
     self.ignoreAll()
     del self.heightTextInterval
     del self.beginRoundInterval
     del self.hopOnAnim
     del self.hopOffAnim
     del self.flashTextInterval
     if hasattr(self, 'beanAnims'):
         self.cleanupJellyBeans()
     self.quitEarlyButton.destroy()
     del self.quitEarlyButton
     del self.gui
     del self.activityFSM
     del self.animFSM
     return
 def joinRequestDenied(self, reason):
     DistributedPartyActivity.joinRequestDenied(self, reason)
     self.notify.debug('joinRequestDenied')
     if reason == PartyGlobals.DenialReasons.Full:
         self.showMessage(TTLocalizer.PartyTeamActivityTeamFull)
     elif reason == PartyGlobals.DenialReasons.Default:
         self.showMessage(TTLocalizer.PartyTeamActivityJoinDenied % self.getTitle())
 def generate(self):
     DistributedPartyActivity.generate(self)
     self._doneCannons = False
     self._avId2trajectoryInfo = {}
     self._remoteToonFlyTaskName = 'remoteToonFlyTask-%s' % self.doId
     taskMgr.add(self._remoteToonFlyTask, self._remoteToonFlyTaskName, priority=45)
     self.d_cloudsColorRequest()
    def unload(self):
        DistributedPartyActivity.unload(self)
        self.activityFSM.request('Disabled')
        if self.localToonDanceSequence is not None:
            self.localToonDanceSequence.finish()
        if self.localToonDancing:
            self.__localStopDancing()
        self.ignoreAll()
        if self.discoBallSequence is not None:
            self.discoBallSequence.finish()
        if self.danceFloorSequence is not None:
            self.danceFloorSequence.finish()
        del self.danceFloorSequence
        del self.discoBallSequence
        del self.localToonDanceSequence
        if self.danceFloor is not None:
            self.danceFloor.removeNode()
            self.danceFloor = None
        self.__destroyOrthoWalk()
        for toonId in self.dancingToonFSMs.keys():
            self.dancingToonFSMs[toonId].destroy()
            del self.dancingToonFSMs[toonId]

        del self.dancingToonFSMs
        del self.cameraParallel
        del self.currentCameraMode
        if self.keyCodes is not None:
            self.keyCodes.destroy()
            del self.keyCodes
        del self.activityFSM
        del self.gui
        del self.localPatternsMatched
        return
 def __init__(self, cr):
     DistributedPartyActivity.__init__(
         self, cr, PartyGlobals.ActivityIds.PartyCatch, PartyGlobals.ActivityTypes.HostInitiated, wantRewardGui=True
     )
     self.setUsesSmoothing()
     self.setUsesLookAround()
     self._sNumGen = SerialNumGen()
    def unload(self):
        DistributedPartyCatchActivity.notify.debug('unload')
        self.finishAllDropIntervals()
        self.destroyOrthoWalk()
        DistributedPartyActivity.unload(self)
        self.stopDropTask()
        del self.activityFSM
        del self.__textGen
        for avId in self.toonSDs.keys():
            if self.toonSDs.has_key(avId):
                toonSD = self.toonSDs[avId]
                toonSD.unload()

        del self.toonSDs
        self.treesAndFence.removeNode()
        del self.treesAndFence
        self.dropShadow.removeNode()
        del self.dropShadow
        base.cr.parentMgr.unregisterParent(self._avatarNodePathParentToken)
        for model in self.dropObjModels.values():
            model.removeNode()

        del self.dropObjModels
        del self.sndGoodCatch
        del self.sndOof
        del self.sndAnvilLand
        del self.sndPerfect
 def unload(self):
     self.notify.debug('unload')
     DistributedPartyActivity.unload(self)
     if self.shadowNode is not None:
         self.shadowNode.removeNode()
         del self.shadowNode
     if self.splash is not None:
         self.splash.destroy()
         del self.splash
     if self.dustCloud is not None:
         self.dustCloud.destroy()
         del self.dustCloud
     del self.sndHitHouse
     del self.sndHitGround
     del self.sndHitWater
     del self.sndBounce1
     del self.sndBounce2
     del self.sndBounce3
     if self.localFlyingToon:
         self.__resetToon(self.localFlyingToon)
         self.localFlyingToon.loop('neutral')
         self.localFlyingToon.setPlayRate(1.0, 'run')
         self.localFlyingToon = None
     self.ignoreAll()
     return
 def _enableCollisions(self):
     DistributedPartyActivity._enableCollisions(self)
     self._enteredTree = False
     self.accept('enter' + self.catchTreeZoneEvent, self._toonMayHaveEnteredTree)
     self.accept('again' + self.catchTreeZoneEvent, self._toonMayHaveEnteredTree)
     self.accept('exit' + self.catchTreeZoneEvent, self._toonExitedTree)
     self.accept(DistributedPartyCannonActivity.LOCAL_TOON_LANDED_EVENT, self._handleCannonLanded)
 def setToonsPlaying(self, toonIds):
     self.notify.info('setToonsPlaying(%s)' % (toonIds,))
     DistributedPartyActivity.setToonsPlaying(self, toonIds)
     if self.isLocalToonInActivity() and base.localAvatar.doId not in toonIds:
         if self.toonSDs.has_key(base.localAvatar.doId):
             self.takeLocalAvatarOutOfActivity()
             self.toonSDs[base.localAvatar.doId].fsm.request('notPlaying')
 def generateInit(self):
     self.notify.debug('generateInit')
     DistributedPartyActivity.generateInit(self)
     self.keyCodes = KeyCodes(patterns=self.dancePatternToAnims.keys())
     self.gui = KeyCodesGui(self.keyCodes)
     self.__initOrthoWalk()
     self.activityFSM = DanceActivityFSM(self)
 def setState(self, newState, timestamp, data):
     DistributedPartyActivity.setState(self, newState, timestamp)
     if newState == 'WaitToStart':
         self.activityFSM.request(newState, timestamp)
     elif newState == 'Conclusion':
         self.activityFSM.request(newState, data)
     else:
         self.activityFSM.request(newState)
 def exitRequestDenied(self, reason):
     DistributedPartyActivity.exitRequestDenied(self, reason)
     if reason == PartyGlobals.DenialReasons.Default:
         self.showMessage(TTLocalizer.PartyTeamActivityExitDenied % self.getTitle())
     if self.isLocalToonPlaying and (self.isState('WaitToStart') or self.isState('WaitForEnough')):
         self.teamActivityGui.enableExitButton()
         if self._canSwitchTeams:
             self.teamActivityGui.enableSwitchButton()
 def postHopOn(self):
     self.toon.setH(self.toon.getH() + 90.0)
     self.toon.dropShadow.reparentTo(self.surface)
     self.timeLeftToSimulate = 0.0
     self.doSimulateStep = False
     taskMgr.add(self.updateTask, self.uniqueName('TrampolineActivity.updateTask'))
     base.setCellsActive(base.leftCells, False)
     base.setCellsActive(base.bottomCells, False)
     DistributedPartyActivity.startRules(self)
 def unload(self):
     DistributedPartyActivity.unload(self)
     self.gui.unload()
     if self.music is not None:
         self.music.stop()
     self.jukebox.stop()
     self.jukebox.delete()
     self.jukebox = None
     self.ignoreAll()
 def __init__(self, cr, actId, phaseToMusicData):
     DistributedPartyActivity.__init__(self, cr, actId, ActivityTypes.Continuous)
     self.phaseToMusicData = phaseToMusicData
     self.jukebox = None
     self.gui = None
     self.tunes = []
     self.music = None
     self.currentSongData = None
     self.localQueuedSongInfo = None
     self.localQueuedSongListItem = None
 def __init__(self, cr, doJellyBeans = True, doTricks = False, texture = None):
     DistributedPartyTrampolineActivity.notify.debug('__init__')
     DistributedPartyActivity.__init__(self, cr, PartyGlobals.ActivityIds.PartyTrampoline, PartyGlobals.ActivityTypes.GuestInitiated, wantLever=False, wantRewardGui=True)
     self.doJellyBeans = doJellyBeans
     self.doTricks = doTricks
     self.texture = texture
     self.toon = None
     self.trampHeight = 3.6
     self.trampK = 400.0
     self.normalTrampB = 2.5
     self.leavingTrampB = 8.0
     self.trampB = self.normalTrampB
     self.g = -32.0
     self.jumpBoost = 330.0
     self.beginningBoost = 500.0
     self.beginningBoostThreshold = self.trampHeight + 1.5
     self.earlyJumpThreshold = 75.0
     self.boingThreshold = 300.0
     self.turnFactor = 120.0
     self.stepDT = 0.001
     self.targetCameraPos = Point3(0.0, 40.0, 10.0)
     self.cameraSpeed = 2.0
     self.hopOffPos = Point3(16.0, 0.0, 0.0)
     self.indicatorFactor = 0.0095
     self.dropShadowCutoff = 15.0
     self.minHeightForText = 15.0
     self.heightTextOffset = -0.065
     self.beanOffset = 0.5
     self.guiBeanOffset = -0.02
     self.jumpTextShown = False
     self.toonJumped = False
     self.turnLeft = False
     self.turnRight = False
     self.leavingTrampoline = False
     self.toonVelocity = 0.0
     self.topHeight = 0.0
     self.lastPeak = 0.0
     self.beginRoundInterval = None
     self.hopOnAnim = None
     self.hopOffAnim = None
     self.flashTextInterval = None
     self.numJellyBeans = PartyGlobals.TrampolineNumJellyBeans
     self.jellyBeanBonus = PartyGlobals.TrampolineJellyBeanBonus
     self.jellyBeanStartHeight = 20.0
     self.jellyBeanStopHeight = 90.0
     self.jellyBeanColors = [VBase4(1.0, 0.5, 0.5, 1.0),
      VBase4(0.5, 1.0, 0.5, 1.0),
      VBase4(0.5, 1.0, 1.0, 1.0),
      VBase4(1.0, 1.0, 0.4, 1.0),
      VBase4(0.4, 0.4, 1.0, 1.0),
      VBase4(1.0, 0.5, 1.0, 1.0)]
     delta = (self.jellyBeanStopHeight - self.jellyBeanStartHeight) / (self.numJellyBeans - 1)
     self.jellyBeanPositions = [ self.jellyBeanStartHeight + n * delta for n in xrange(self.numJellyBeans) ]
     self.doSimulateStep = False
     return
 def setState(self, newState, timestamp):
     self.notify.info('setState(%s, %s)' % (newState, timestamp))
     DistributedPartyCatchActivity.notify.debug('setState( newState=%s, ... )' % newState)
     DistributedPartyActivity.setState(self, newState, timestamp)
     self.activityFSM.request(newState)
     if newState == 'Active':
         if base.localAvatar.doId != self.party.partyInfo.hostId:
             if globalClock.getFrameCount() > self._generateFrame:
                 if base.localAvatar.getX() > self.x - self.StageHalfWidth and base.localAvatar.getX() < self.x + self.StageHalfWidth and base.localAvatar.getY() > self.y - self.StageHalfHeight and base.localAvatar.getY() < self.y + self.StageHalfHeight:
                     self._toonEnteredTree(None)
     return
 def unload(self):
     DistributedPartyActivity.unload(self)
     del self.activityFSM
     self.teamActivityGui.unload()
     del self.teamActivityGui
     if hasattr(self, 'toonIds'):
         del self.toonIds
     del self.isLocalToonPlaying
     del self.localToonTeam
     del self.advantage
     del self.waitToStartTimestamp
 def load(self):
     DistributedPartyActivity.load(self)
     self.danceFloor = loader.loadModel(self.model)
     self.danceFloor.reparentTo(self.getParentNodePath())
     self.danceFloor.setPos(self.x, self.y, 0.0)
     self.danceFloor.setH(self.h)
     self.danceFloor.wrtReparentTo(render)
     self.sign.setPos(22, -22, 0)
     floor = self.danceFloor.find('**/danceFloor_mesh')
     self.danceFloorSequence = Sequence(Wait(0.3), Func(floor.setH, floor, 36))
     discoBall = self.danceFloor.find('**/discoBall_mesh')
     self.discoBallSequence = Parallel(discoBall.hprInterval(6.0, Vec3(360, 0, 0)), Sequence(discoBall.posInterval(3, Point3(0, 0, 1), blendType='easeInOut'), discoBall.posInterval(3, Point3(0, 0, 0), blendType='easeInOut')))
 def load(self):
     DistributedPartyActivity.load(self)
     self.danceFloor = loader.loadModel(self.model)
     self.danceFloor.reparentTo(self.getParentNodePath())
     self.danceFloor.setPos(self.x, self.y, 0.0)
     self.danceFloor.setH(self.h)
     self.danceFloor.wrtReparentTo(render)
     self.sign.setPos(22, -22, 0)
     floor = self.danceFloor.find('**/danceFloor_mesh')
     self.danceFloorSequence = Sequence(Wait(0.3), Func(floor.setH, floor, 36))
     discoBall = self.danceFloor.find('**/discoBall_mesh')
     self.discoBallSequence = Parallel(discoBall.hprInterval(6.0, Vec3(360, 0, 0)), Sequence(discoBall.posInterval(3, Point3(0, 0, 1), blendType='easeInOut'), discoBall.posInterval(3, Point3(0, 0, 0), blendType='easeInOut')))
 def load(self):
     DistributedPartyActivity.load(self)
     self.jukebox = Actor('phase_13/models/parties/jukebox_model', {'dance': 'phase_13/models/parties/jukebox_dance'})
     self.jukebox.reparentTo(self.root)
     self.collNode = CollisionNode(self.getCollisionName())
     self.collNode.setCollideMask(ToontownGlobals.CameraBitmask | ToontownGlobals.WallBitmask)
     collTube = CollisionTube(0, 0, 0, 0.0, 0.0, 4.25, 2.25)
     collTube.setTangible(1)
     self.collNode.addSolid(collTube)
     self.collNodePath = self.jukebox.attachNewNode(self.collNode)
     self.sign.setPos(-5.0, 0, 0)
     self.activate()
예제 #22
0
 def __init__(self, cr, actId, phaseToMusicData):
     DistributedPartyActivity.__init__(self, cr, actId,
                                       ActivityTypes.Continuous)
     self.phaseToMusicData = phaseToMusicData
     self.jukebox = None
     self.gui = None
     self.tunes = []
     self.music = None
     self.currentSongData = None
     self.localQueuedSongInfo = None
     self.localQueuedSongListItem = None
     return
예제 #23
0
 def generate(self):
     DistributedPartyActivity.generate(self)
     self.notify.info('localAvatar doId: %s' % base.localAvatar.doId)
     self.notify.info('generate()')
     self._generateFrame = globalClock.getFrameCount()
     self._id2gen = {}
     self._orderedGenerations = []
     self._orderedGenerationIndex = None
     rng = RandomNumGen(self.doId)
     self._generationSeedBase = rng.randrange(1000)
     self._lastDropTime = 0.0
     return
예제 #24
0
 def postHopOn(self):
     self.toon.setH(self.toon.getH() +
                    90.0)  # makes camera adjustment less jarring
     self.toon.dropShadow.reparentTo(self.surface)
     self.screenPlaneElements.reparentTo(aspect2d)
     self.timeLeftToSimulate = 0.0
     self.doSimulateStep = False
     taskMgr.add(self.updateTask,
                 self.uniqueName("TrampolineActivity.updateTask"))
     base.setCellsAvailable(base.leftCells, False)
     base.setCellsAvailable(base.bottomCells, False)
     DistributedPartyActivity.startRules(self)
 def load(self):
     DistributedPartyTrampolineActivity.notify.debug('load')
     DistributedPartyActivity.load(self)
     self.loadModels()
     self.loadCollision()
     self.loadGUI()
     self.loadSounds()
     self.loadIntervals()
     self.activityFSM = TrampolineActivityFSM(self)
     self.activityFSM.request('Idle')
     self.animFSM = TrampolineAnimFSM(self)
     self.setBestHeightInfo('', 0)
    def unload(self):
        DistributedPartyActivity.unload(self)
        del self.activityFSM
        self.teamActivityGui.unload()
        del self.teamActivityGui
        if hasattr(self, 'toonIds'):
            del self.toonIds

        del self.isLocalToonPlaying
        del self.localToonTeam
        del self.advantage
        del self.waitToStartTimestamp
 def load(self):
     DistributedPartyTrampolineActivity.notify.debug('load')
     DistributedPartyActivity.load(self)
     self.loadModels()
     self.loadCollision()
     self.loadGUI()
     self.loadSounds()
     self.loadIntervals()
     self.activityFSM = TrampolineActivityFSM(self)
     self.activityFSM.request('Idle')
     self.animFSM = TrampolineAnimFSM(self)
     self.setBestHeightInfo('', 0)
 def load(self):
     DistributedPartyActivity.load(self)
     self.jukebox = Actor('phase_13/models/parties/jukebox_model', {'dance': 'phase_13/models/parties/jukebox_dance'})
     self.jukebox.reparentTo(self.root)
     self.collNode = CollisionNode(self.getCollisionName())
     self.collNode.setCollideMask(ToontownGlobals.CameraBitmask | ToontownGlobals.WallBitmask)
     collTube = CollisionTube(0, 0, 0, 0.0, 0.0, 4.25, 2.25)
     collTube.setTangible(1)
     self.collNode.addSolid(collTube)
     self.collNodePath = self.jukebox.attachNewNode(self.collNode)
     self.sign.setPos(-5.0, 0, 0)
     self.activate()
 def generate(self):
     DistributedPartyActivity.generate(self)
     self.notify.info('localAvatar doId: %s' % base.localAvatar.doId)
     self.notify.info('generate()')
     self._generateFrame = globalClock.getFrameCount()
     self._id2gen = {}
     self._orderedGenerations = []
     self._orderedGenerationIndex = None
     rng = RandomNumGen(self.doId)
     self._generationSeedBase = rng.randrange(1000)
     self._lastDropTime = 0.0
     return
    def unload(self):
        DistributedPartyActivity.unload(self)

        self.gui.unload()

        if self.music is not None:
            self.music.stop()

        self.jukebox.stop()
        self.jukebox.delete()
        self.jukebox = None

        self.ignoreAll()
예제 #31
0
    def finishRules(self):
        """
        The clients have finished reading the rules and we're going to the active state.
        Or one the clients dropped and we're back to WaitToStart
        """
        self.notify.debug("finishRules")

        if self.isLocalToonPlaying:
            DistributedPartyActivity.finishRules(self)  # clean up instructions

        # check for a non-standard transition and do additional cleanup as needed
        if self.activityFSM.getCurrentOrNextState() == "WaitForEnough":
            DistributedPartyActivity.finishRules(self)  # clean up instructions
 def __init__(self, cr, actId, dancePatternToAnims, model = 'phase_13/models/parties/danceFloor'):
     DistributedPartyActivity.__init__(self, cr, actId, ActivityTypes.Continuous)
     self.model = model
     self.danceFloor = None
     self.localToonDancing = False
     self.keyCodes = None
     self.gui = None
     self.currentCameraMode = None
     self.orthoWalk = None
     self.cameraParallel = None
     self.localToonDanceSequence = None
     self.localPatternsMatched = []
     self.dancePatternToAnims = dancePatternToAnims
     self.dancingToonFSMs = { }
 def __init__(self, cr, activityId, startDelay = PartyGlobals.TeamActivityStartDelay, balanceTeams = False):
     DistributedPartyActivity.__init__(self, cr, activityId, PartyGlobals.ActivityTypes.GuestInitiated, wantRewardGui=True)
     self.notify.debug('__init__')
     self.toonIds = ([], [])
     self.isLocalToonPlaying = False
     self.localToonTeam = None
     self.advantage = 1.0
     self.waitToStartTimestamp = None
     self._maxPlayersPerTeam = 0
     self._minPlayersPerTeam = 0
     self._duration = 0
     self._startDelay = config.GetFloat('party-team-activity-start-delay', startDelay)
     self._willBalanceTeams = False  # balanceTeams
     self._currentStatus = ''
 def __init__(self, cr, actId, dancePatternToAnims, model = 'phase_13/models/parties/danceFloor'):
     DistributedPartyActivity.__init__(self, cr, actId, ActivityTypes.Continuous)
     self.model = model
     self.danceFloor = None
     self.localToonDancing = False
     self.keyCodes = None
     self.gui = None
     self.currentCameraMode = None
     self.orthoWalk = None
     self.cameraParallel = None
     self.localToonDanceSequence = None
     self.localPatternsMatched = []
     self.dancePatternToAnims = dancePatternToAnims
     self.dancingToonFSMs = {}
예제 #35
0
    def exitRequestDenied(self, reason):
        """Local Toon was not allowed to exit activity"""
        DistributedPartyActivity.exitRequestDenied(self, reason)

        if reason == PartyGlobals.DenialReasons.Default:
            self.showMessage(TTLocalizer.PartyTeamActivityExitDenied %
                             self.getTitle())

        if  self.isLocalToonPlaying and \
            (self.isState("WaitToStart") or self.isState("WaitForEnough")):
            self.teamActivityGui.enableExitButton()

            if self._canSwitchTeams:
                self.teamActivityGui.enableSwitchButton()
 def setState(self, newState, timestamp):
     self.notify.info('setState(%s, %s)' % (newState, timestamp))
     DistributedPartyCatchActivity.notify.debug(
         'setState( newState=%s, ... )' % newState)
     DistributedPartyActivity.setState(self, newState, timestamp)
     self.activityFSM.request(newState)
     if newState == 'Active':
         if base.localAvatar.doId != self.party.partyInfo.hostId:
             if globalClock.getFrameCount() > self._generateFrame:
                 if base.localAvatar.getX(
                 ) > self.x - self.StageHalfWidth and base.localAvatar.getX(
                 ) < self.x + self.StageHalfWidth and base.localAvatar.getY(
                 ) > self.y - self.StageHalfHeight and base.localAvatar.getY(
                 ) < self.y + self.StageHalfHeight:
                     self._toonEnteredTree(None)
 def load(self, loadModels = 1, arenaModel = 'partyCatchTree'):
     self.notify.info('load()')
     DistributedPartyCatchActivity.notify.debug('PartyCatch: load')
     self.activityFSM = CatchActivityFSM(self)
     self.defineConstants()
     self.treesAndFence = loader.loadModel('phase_13/models/parties/%s' % arenaModel)
     self.treesAndFence.setScale(0.9)
     self.treesAndFence.find('**/fence_floor').setPos(0.0, 0.0, 0.1)
     self.treesAndFence.reparentTo(self.root)
     ground = self.treesAndFence.find('**/groundPlane')
     ground.setBin('ground', 1)
     DistributedPartyActivity.load(self)
     exitText = TextNode('PartyCatchExitText')
     exitText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
     exitText.setCardDecal(True)
     exitText.setCardColor(1.0, 1.0, 1.0, 0.0)
     exitText.setText(TTLocalizer.PartyCatchActivityExit)
     exitText.setTextColor(0.0, 8.0, 0.0, 0.9)
     exitText.setAlign(exitText.ACenter)
     exitText.setFont(ToontownGlobals.getBuildingNametagFont())
     exitText.setShadowColor(0, 0, 0, 1)
     exitText.setBin('fixed')
     if TTLocalizer.BuildingNametagShadow:
         exitText.setShadow(*TTLocalizer.BuildingNametagShadow)
     exitTextLoc = self.treesAndFence.find('**/loc_exitSignText')
     exitTextNp = exitTextLoc.attachNewNode(exitText)
     exitTextNp.setDepthWrite(0)
     exitTextNp.setScale(4)
     exitTextNp.setZ(-.5)
     self.sign.reparentTo(self.treesAndFence.find('**/loc_eventSign'))
     self.sign.wrtReparentTo(self.root)
     self.avatarNodePath = NodePath('PartyCatchAvatarNodePath')
     self.avatarNodePath.reparentTo(self.root)
     self._avatarNodePathParentToken = 3
     base.cr.parentMgr.registerParent(self._avatarNodePathParentToken, self.avatarNodePath)
     self.toonSDs = {}
     self.dropShadow = loader.loadModelOnce('phase_3/models/props/drop_shadow')
     self.dropObjModels = {}
     if loadModels:
         self.__loadDropModels()
     self.sndGoodCatch = base.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
     self.sndOof = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
     self.sndAnvilLand = base.loadSfx('phase_4/audio/sfx/AA_drop_anvil_miss.ogg')
     self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.ogg')
     self.__textGen = TextNode('partyCatchActivity')
     self.__textGen.setFont(ToontownGlobals.getSignFont())
     self.__textGen.setAlign(TextNode.ACenter)
     self.activityFSM.request('Idle')
 def getTitle(self):
     if self.doJellyBeans:
         return TTLocalizer.PartyTrampolineJellyBeanTitle
     elif self.doTricks:
         return TTLocalizer.PartyTrampolineTricksTitle
     else:
         return DistributedPartyActivity.getTitle(self)
예제 #39
0
    def __init__(self, cr, actId, dancePatternToAnims):
        DistributedPartyActivity.__init__(self, cr, actId,
                                          ActivityTypes.Continuous)
        self.danceFloor = None

        self.localToonDancing = False
        self.keyCodes = None
        self.gui = None
        self.currentCameraMode = None
        self.orthoWalk = None
        self.cameraParallel = None
        self.localToonDanceSequence = None
        self.localPatternsMatched = []
        self.dancePatternToAnims = dancePatternToAnims
        # Map of toonIds to PartyDanceActivityToonFSMs
        self.dancingToonFSMs = {}
예제 #40
0
 def getTitle(self):
     if self.doJellyBeans:
         return TTLocalizer.PartyTrampolineJellyBeanTitle
     elif self.doTricks:
         return TTLocalizer.PartyTrampolineTricksTitle
     else:
         return DistributedPartyActivity.getTitle(self)
 def __init__(self, cr):
     DistributedPartyActivity.__init__(self,
                                       cr,
                                       ActivityIds.PartyCannon,
                                       ActivityTypes.Continuous,
                                       wantRewardGui=True)
     self.gui = None
     self.firingCannon = None
     self.shadowNode = None
     self.partyDoId = None
     self.splash = None
     self.dustCloud = None
     self.lastWakeTime = 0
     self.localFlyingDropShadow = None
     self.localFlyingToon = None
     self.localFlyingToonId = 0
     self._lastBroadcastTime = -self.BroadcastPeriod
     self._dirtyNewVel = None
     self.hitBumper = 0
     self.hitCloud = 0
     self.lastPos = Vec3(0, 0, 0)
     self.lastVel = Vec3(0, 0, 0)
     self.vel = Vec3(0, 0, 0)
     self.landingPos = Vec3(0, 0, 0)
     self.t = 0
     self.lastT = 0
     self.deltaT = 0
     self._lastCloudHit = None
     self.cameraPos = Vec3(0, -15.0, -25.0)
     self.cameraSpeed = 5.0
     self.camNode = None
     self.flyingToonOffsetRotation = 0
     self.flyingToonOffsetAngle = 0
     self.flyingToonOffsetX = 0
     self.flyingToonOffsetY = 0
     self.flyingToonCloudsHit = 0
     self.initialFlyVel = 0
     self._localPlayedBefore = False
     self.hitTrack = None
     self.cTrav = None
     self.flyColNode = None
     self.flyColNodePath = None
     self._flyingCollisionTaskName = None
     x = 0
     y = 0
     z = 0
     return
예제 #42
0
    def unload(self):
        """
        Unloads the dance floor.
        """
        DistributedPartyActivity.unload(self)
        self.activityFSM.request("Disabled")

        if self.localToonDanceSequence is not None:
            self.localToonDanceSequence.finish()

        if self.localToonDancing:
            self.__localStopDancing()

        self.ignoreAll()

        if self.discoBallSequence is not None:
            self.discoBallSequence.finish()

        if self.danceFloorSequence is not None:
            self.danceFloorSequence.finish()

        del self.danceFloorSequence
        del self.discoBallSequence
        del self.localToonDanceSequence

        if self.danceFloor is not None:
            self.danceFloor.removeNode()
            self.danceFloor = None

        self.__destroyOrthoWalk()

        for toonId in list(self.dancingToonFSMs.keys()):
            self.dancingToonFSMs[toonId].destroy()
            del self.dancingToonFSMs[toonId]
        del self.dancingToonFSMs

        del self.cameraParallel
        del self.currentCameraMode

        if self.keyCodes is not None:
            self.keyCodes.destroy()
            del self.keyCodes

        del self.activityFSM
        del self.gui

        del self.localPatternsMatched
 def disable(self):
     taskMgr.remove(self._remoteToonFlyTaskName)
     if self._flyingCollisionTaskName:
         taskMgr.remove(self._flyingCollisionTaskName)
     taskMgr.remove(self.taskNameFireCannon)
     taskMgr.remove(self.taskNameShoot)
     taskMgr.remove(self.taskNameFly)
     taskMgr.remove(DistributedPartyCannonActivity.REACTIVATE_CLOUD_TASK)
     self.ignoreAll()
     if self.localFlyingToonId:
         self.__stopCollisionHandler(self.localFlyingToon)
         self.__stopLocalFlyTask(self.localFlyingToonId)
         self.setMovie(PartyGlobals.CANNON_MOVIE_CLEAR, self.localFlyingToonId)
     if self.hitTrack is not None:
         self.hitTrack.finish()
         del self.hitTrack
         self.hitTrack = None
     DistributedPartyActivity.disable(self)
예제 #44
0
 def disable(self):
     if self._flyingCollisionTaskName:
         taskMgr.remove(self._flyingCollisionTaskName)
     taskMgr.remove(self.taskNameFireCannon)
     taskMgr.remove(self.taskNameShoot)
     taskMgr.remove(self.taskNameFly)
     taskMgr.remove(DistributedPartyCannonActivity.REACTIVATE_CLOUD_TASK)
     self.ignoreAll()
     if self.localFlyingToonId:
         self.__stopCollisionHandler(self.localFlyingToon)
         self.__stopLocalFlyTask(self.localFlyingToonId)
         self.setMovie(PartyGlobals.CANNON_MOVIE_CLEAR,
                       self.localFlyingToonId)
     if self.hitTrack is not None:
         self.hitTrack.finish()
         del self.hitTrack
         self.hitTrack = None
     DistributedPartyActivity.disable(self)
예제 #45
0
    def unload(self):
        DistributedPartyTrampolineActivity.notify.debug("unload")
        if self.hopOnAnim and self.hopOnAnim.isPlaying():
            self.hopOnAnim.finish()
        if self.hopOffAnim and self.hopOffAnim.isPlaying():
            self.hopOffAnim.finish()
        if self.beginRoundInterval and self.beginRoundInterval.isPlaying():
            self.beginRoundInterval.finish()
        if self.flashTextInterval and self.flashTextInterval.isPlaying():
            self.flashTextInterval.finish()
        if self.heightTextInterval and self.heightTextInterval.isPlaying():
            self.heightTextInterval.finish()
        self.timer.stop()
        DistributedPartyActivity.unload(self)

        # Unload tasks
        taskMgr.remove(self.uniqueName("TrampolineActivity.updateTask"))
        taskMgr.remove(self.uniqueName("TrampolineActivity.remoteUpdateTask"))

        # Unload events
        self.ignoreAll()

        # Unload intervals
        del self.heightTextInterval
        del self.beginRoundInterval
        del self.hopOnAnim
        del self.hopOffAnim
        del self.flashTextInterval

        if hasattr(self, 'beanAnims'):
            # we need to cleanup the jelly bean interval
            self.cleanupJellyBeans()

        # Unload gui stuff
        self.quitEarlyButton.destroy()
        del self.quitEarlyButton
        if self.screenPlaneElements:
            self.screenPlaneElements.removeNode()
            self.screenPlaneElements = None

        # Unload fsms
        del self.activityFSM
        del self.animFSM
예제 #46
0
    def __init__(self,
                 cr,
                 activityId,
                 startDelay=PartyGlobals.TeamActivityStartDelay,
                 balanceTeams=False):
        """
        Parameters
            cr is the instance of ClientRepository
            activityId is the activity's id (set in PartyGlobals)
        """
        DistributedPartyActivity.__init__(
            self,
            cr,
            activityId,
            PartyGlobals.ActivityTypes.GuestInitiated,
            wantRewardGui=True,
        )
        self.notify.debug("__init__")

        self.toonIds = (
            [],  # left team toon Ids
            [],  # right team toon Ids
        )

        self.isLocalToonPlaying = False
        self.localToonTeam = None  # a PartyGlobals.TeamActivityTeams value

        # used to even out a lopsided game
        self.advantage = 1.0

        self.waitToStartTimestamp = None  # tracks when WaitToStart began for late comers

        # These are required fields set by the ai
        self._maxPlayersPerTeam = 0
        self._minPlayersPerTeam = 0
        self._duration = 0

        self._startDelay = ConfigVariableDouble(
            "party-team-activity-start-delay", startDelay).getValue()
        self._willBalanceTeams = balanceTeams

        self._currentStatus = ""
 def __init__(self, cr):
     DistributedPartyActivity.__init__(
         self, cr, ActivityIds.PartyCannon, ActivityTypes.Continuous, wantRewardGui=True
     )
     self.gui = None
     self.firingCannon = None
     self.shadowNode = None
     self.partyDoId = None
     self.splash = None
     self.dustCloud = None
     self.lastWakeTime = 0
     self.localFlyingDropShadow = None
     self.localFlyingToon = None
     self.localFlyingToonId = 0
     self._lastBroadcastTime = -self.BroadcastPeriod
     self._dirtyNewVel = None
     self.hitBumper = 0
     self.hitCloud = 0
     self.lastPos = Vec3(0, 0, 0)
     self.lastVel = Vec3(0, 0, 0)
     self.vel = Vec3(0, 0, 0)
     self.landingPos = Vec3(0, 0, 0)
     self.t = 0
     self.lastT = 0
     self.deltaT = 0
     self._lastCloudHit = None
     self.cameraPos = Vec3(0, -15.0, -25.0)
     self.cameraSpeed = 5.0
     self.camNode = None
     self.flyingToonOffsetRotation = 0
     self.flyingToonOffsetAngle = 0
     self.flyingToonOffsetX = 0
     self.flyingToonOffsetY = 0
     self.flyingToonCloudsHit = 0
     self.initialFlyVel = 0
     self._localPlayedBefore = False
     self.hitTrack = None
     self.cTrav = None
     self.flyColNode = None
     self.flyColNodePath = None
     self._flyingCollisionTaskName = None
     return
예제 #48
0
    def load(self):
        self.notify.debug("load")
        DistributedPartyActivity.load(self)

        # Show clouds.
        base.cr.playGame.hood.loader.loadClouds()
        base.cr.playGame.hood.loader.setCloudSwitch(1)

        # The shadow is used while the local toon is flying around
        self.shadow = loader.loadModel("phase_3/models/props/drop_shadow")
        self.shadowNode = hidden.attachNewNode("dropShadow")
        self.shadow.copyTo(self.shadowNode)
        self.shadowNode.setColor(0, 0, 0, 0.5)
        # put the shadow in the 'fixed' bin, so that it will be drawn correctly
        # in front of the translucent water.
        # NOTE: if we put trees or other opaque/transparent objects in the scene,
        # put the shadow in the fixed bin only when it's over the water.
        self.shadowNode.setBin('fixed', 0, 1)  # undo with shadow.clearBin()

        # Splash object for when toon hits the water
        self.splash = Splash.Splash(render)
        # Dust cloud object for when toon hits ground
        self.dustCloud = DustCloud.DustCloud(render)
        self.dustCloud.setBillboardPointEye()

        # Collision Sounds
        self.sndHitGround = base.loader.loadSfx(
            "phase_4/audio/sfx/MG_cannon_hit_dirt.mp3")
        self.sndHitWater = base.loader.loadSfx(
            "phase_4/audio/sfx/MG_cannon_splash.mp3")
        self.sndHitHouse = base.loader.loadSfx(
            "phase_5/audio/sfx/AA_drop_sandbag.mp3")
        self.sndBounce1 = base.loader.loadSfx("phase_13/audio/sfx/bounce1.mp3")
        self.sndBounce2 = base.loader.loadSfx("phase_13/audio/sfx/bounce2.mp3")
        self.sndBounce3 = base.loader.loadSfx("phase_13/audio/sfx/bounce3.mp3")

        self.onstage()
        self.sign.reparentTo(hidden)
        self.sign.setPos(-6.0, 10.0, 0.0)

        self.accept(FireworksStartedEvent, self.__handleFireworksStarted)
        self.accept(FireworksFinishedEvent, self.__handleFireworksFinished)
예제 #49
0
 def unload(self):
     DistributedPartyTrampolineActivity.notify.debug('unload')
     if self.hopOnAnim and self.hopOnAnim.isPlaying():
         self.hopOnAnim.finish()
     
     if self.hopOffAnim and self.hopOffAnim.isPlaying():
         self.hopOffAnim.finish()
     
     if self.beginRoundInterval and self.beginRoundInterval.isPlaying():
         self.beginRoundInterval.finish()
     
     if self.flashTextInterval and self.flashTextInterval.isPlaying():
         self.flashTextInterval.finish()
     
     if self.heightTextInterval and self.heightTextInterval.isPlaying():
         self.heightTextInterval.finish()
     
     self.timer.stop()
     DistributedPartyActivity.unload(self)
     taskMgr.remove(self.uniqueName('TrampolineActivity.updateTask'))
     taskMgr.remove(self.uniqueName('TrampolineActivity.remoteUpdateTask'))
     self.ignoreAll()
     del self.heightTextInterval
     del self.beginRoundInterval
     del self.hopOnAnim
     del self.hopOffAnim
     del self.flashTextInterval
     if hasattr(self, 'beanAnims'):
         self.cleanupJellyBeans()
     
     self.quitEarlyButton.destroy()
     del self.quitEarlyButton
     if self.screenPlaneElements:
         self.screenPlaneElements.removeNode()
         self.screenPlaneElements = None
     
     del self.activityFSM
     del self.animFSM
예제 #50
0
    def load(self):
        """
        Loads the dance floor and place it in the right spot.
        """
        DistributedPartyActivity.load(self)

        self.danceFloor = loader.loadModel(
            "phase_13/models/parties/danceFloor")
        self.danceFloor.reparentTo(self.getParentNodePath())
        self.danceFloor.setPos(self.x, self.y, 0.0)
        self.danceFloor.setH(self.h)

        # Reparent to render so that when the fireworks are on, it "glows" in the dark
        self.danceFloor.wrtReparentTo(render)

        self.sign.setPos(22, -22, 0)

        # Initialize programatic animation sequences
        floor = self.danceFloor.find("**/danceFloor_mesh")
        self.danceFloorSequence = Sequence(Wait(0.3),
                                           Func(floor.setH, floor, 36))

        # Spin the ball around while bobbing up and down
        # (since it's being held by balloons!)
        # spinning the disco ball moved to the child classes,
        # to deal with 10 and 20 on the ball
        discoBall = self.danceFloor.find("**/discoBall_mesh")
        self.discoBallSequence = Parallel(
            discoBall.hprInterval(6.0, Vec3(360, 0, 0)),
            Sequence(
                discoBall.posInterval(3,
                                      Point3(0, 0, 1),
                                      blendType="easeInOut"),
                discoBall.posInterval(3,
                                      Point3(0, 0, 0),
                                      blendType="easeInOut")),
        )
예제 #51
0
    def unload(self):
        self.notify.debug("unload")
        DistributedPartyActivity.unload(self)

        # get rid of original dropshadow model
        if self.shadowNode is not None:
            self.shadowNode.removeNode()
            del self.shadowNode

        # get rid of the splash
        if self.splash is not None:
            self.splash.destroy()
            del self.splash

        # get rid of the dust cloud
        if self.dustCloud is not None:
            self.dustCloud.destroy()
            del self.dustCloud

        # Get rid of audio
        del self.sndHitHouse
        del self.sndHitGround
        del self.sndHitWater
        del self.sndBounce1
        del self.sndBounce2
        del self.sndBounce3

        if self.localFlyingToon:
            self.__resetToon(self.localFlyingToon)
            # Reset anim an run play rate
            self.localFlyingToon.loop('neutral')
            self.localFlyingToon.setPlayRate(1.0, 'run')

            self.localFlyingToon = None

        self.ignoreAll()
예제 #52
0
 def unload(self):
     self.notify.debug('unload')
     DistributedPartyActivity.unload(self)
     if self.shadowNode is not None:
         self.shadowNode.removeNode()
         del self.shadowNode
     if self.splash is not None:
         self.splash.destroy()
         del self.splash
     if self.dustCloud is not None:
         self.dustCloud.destroy()
         del self.dustCloud
     del self.sndHitHouse
     del self.sndHitGround
     del self.sndHitWater
     del self.sndBounce1
     del self.sndBounce2
     del self.sndBounce3
     if self.localFlyingToon:
         self.__resetToon(self.localFlyingToon)
         self.localFlyingToon.loop('neutral')
         self.localFlyingToon.setPlayRate(1.0, 'run')
         self.localFlyingToon = None
     self.ignoreAll()
 def load(self):
     self.notify.debug('load')
     DistributedPartyActivity.load(self)
     base.cr.playGame.hood.loader.loadClouds()
     base.cr.playGame.hood.loader.setCloudSwitch(1)
     self.shadow = loader.loadModel('phase_3/models/props/drop_shadow')
     self.shadowNode = hidden.attachNewNode('dropShadow')
     self.shadow.copyTo(self.shadowNode)
     self.shadowNode.setColor(0, 0, 0, 0.5)
     self.shadowNode.setBin('fixed', 0, 1)
     self.splash = Splash.Splash(render)
     self.dustCloud = DustCloud.DustCloud(render)
     self.dustCloud.setBillboardPointEye()
     self.sndHitGround = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
     self.sndHitWater = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_splash.ogg')
     self.sndHitHouse = base.loader.loadSfx('phase_5/audio/sfx/AA_drop_sandbag.ogg')
     self.sndBounce1 = base.loader.loadSfx('phase_13/audio/sfx/bounce1.ogg')
     self.sndBounce2 = base.loader.loadSfx('phase_13/audio/sfx/bounce2.ogg')
     self.sndBounce3 = base.loader.loadSfx('phase_13/audio/sfx/bounce3.ogg')
     self.onstage()
     self.sign.reparentTo(hidden)
     self.sign.setPos(-6.0, 10.0, 0.0)
     self.accept(FireworksStartedEvent, self.__handleFireworksStarted)
     self.accept(FireworksFinishedEvent, self.__handleFireworksFinished)
 def load(self):
     self.notify.debug('load')
     DistributedPartyActivity.load(self)
     base.cr.playGame.hood.loader.loadClouds()
     base.cr.playGame.hood.loader.setCloudSwitch(1)
     self.shadow = loader.loadModel('phase_3/models/props/drop_shadow')
     self.shadowNode = hidden.attachNewNode('dropShadow')
     self.shadow.copyTo(self.shadowNode)
     self.shadowNode.setColor(0, 0, 0, 0.5)
     self.shadowNode.setBin('fixed', 0, 1)
     self.splash = Splash.Splash(render)
     self.dustCloud = DustCloud.DustCloud(render)
     self.dustCloud.setBillboardPointEye()
     self.sndHitGround = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.mp3')
     self.sndHitWater = base.loadSfx('phase_4/audio/sfx/MG_cannon_splash.mp3')
     self.sndHitHouse = base.loadSfx('phase_5/audio/sfx/AA_drop_sandbag.mp3')
     self.sndBounce1 = base.loadSfx('phase_13/audio/sfx/bounce1.mp3')
     self.sndBounce2 = base.loadSfx('phase_13/audio/sfx/bounce2.mp3')
     self.sndBounce3 = base.loadSfx('phase_13/audio/sfx/bounce3.mp3')
     self.onstage()
     self.sign.reparentTo(hidden)
     self.sign.setPos(-6.0, 10.0, 0.0)
     self.accept(FireworksStartedEvent, self.__handleFireworksStarted)
     self.accept(FireworksFinishedEvent, self.__handleFireworksFinished)
예제 #55
0
 def setState(self, newState, timestamp):
     DistributedPartyTrampolineActivity.notify.debug('setState( newState=%s, ... )' % newState)
     DistributedPartyActivity.setState(self, newState, timestamp)
     self.activityFSM.request(newState)
예제 #56
0
 def exitRequestDenied(self, reason):
     DistributedPartyActivity.exitRequestDenied(self, reason)
     self.showMessage(TTLocalizer.PartyActivityDefaultExitDeny)
예제 #57
0
 def joinRequestDenied(self, reason):
     DistributedPartyActivity.joinRequestDenied(self, reason)
     self.showMessage(TTLocalizer.PartyActivityDefaultJoinDeny)
     base.cr.playGame.getPlace().fsm.request('walk')
 def joinRequestDenied(self, reason):
     DistributedPartyActivity.joinRequestDenied(self, reason)
     self.showMessage(TTLocalizer.PartyJukeboxOccupied)
예제 #59
0
 def joinRequestDenied(self, reason):
     DistributedPartyActivity.joinRequestDenied(self, reason)
     self.showMessage(TTLocalizer.PartyJukeboxOccupied)