Ejemplo n.º 1
0
 def commence(self = self):
     NametagGlobals.setMasterArrowsOn(1)
     self.fsm.request(requestStatus['how'], [requestStatus])
     base.playMusic(self.music, looping=1, volume=0.8)
     base.transitions.irisIn()
     mint = bboard.get(DistributedMint.DistributedMint.ReadyPost)
     self.loader.hood.spawnTitleText(mint.mintId, mint.floorNum)
Ejemplo n.º 2
0
 def __unmakeGui(self):
     self.notify.debug('__unmakeGui')
     if not self.madeGui:
         return
     if self.flashingLabel:
         self.flashingLabel.finish()
         self.flashingLabel = None
     NametagGlobals.setMasterArrowsOn(1)
     self.__disableAimInterface()
     self.upButton.unbind(DGG.B1PRESS)
     self.upButton.unbind(DGG.B1RELEASE)
     self.downButton.unbind(DGG.B1PRESS)
     self.downButton.unbind(DGG.B1RELEASE)
     self.leftButton.unbind(DGG.B1PRESS)
     self.leftButton.unbind(DGG.B1RELEASE)
     self.rightButton.unbind(DGG.B1PRESS)
     self.rightButton.unbind(DGG.B1RELEASE)
     self.aimPad.destroy()
     del self.aimPad
     del self.fireButton
     del self.upButton
     del self.downButton
     del self.leftButton
     del self.rightButton
     self.madeGui = 0
     return
Ejemplo n.º 3
0
    def enterControlled(self, avId):
        self.avId = avId
        self.toon = base.cr.doId2do.get(avId, None)
        if self.toon:
            self.toon.stopSmooth()
            self.toon.stopPosHprBroadcast()
            for feet in self.toon.getPieces(('legs', 'feet')):
                feet.hide()

            self.toon.reparentTo(self.toonSeat)
            self.toon.dropShadow.hide()
            self.notify.debug('setting pos of toon%s' % self.toon.doId)
            self.toon.setPosHpr(0, 0, 0, 0, 0, 0)
            self.toon.loop('sit')
            if self.toon.doId == localAvatar.doId:
                self.notify.debug('calling send currentPosition')
                self.toon.sendCurrentPosition()
            self.doHeadScale(self.toon, 1.75)
            self.toon.setShear(0, 0, 0)
        NametagGlobals.setOnscreenChatForced(1)
        if self.localVehicle:
            camera.reparentTo(self.cameraNode)
            camera.setPosHpr(0, -33, 16, 0, -10, 0)
            self.physicsMgr.attachPhysicalNode(self.node())
            self.__enableControlInterface()
            self.__createPieWindshield()
            self.startPosHprBroadcast()
            self.engineSfxTrack = self.generateEngineStartTrack()
            self.engineSfxTrack.start()
        else:
            self.startSmooth()
            taskName = 'updateNonlocalVehicle-%s' % avId
            self.updateNonLocalTask = taskMgr.add(self.__updateNonlocalVehicle, taskName)
        return
Ejemplo n.º 4
0
 def exit(self):
     self.ignoreAll()
     messenger.send('exitToonInterior')
     self._telemLimiter.destroy()
     del self._telemLimiter
     NametagGlobals.setMasterArrowsOn(0)
     self.loader.activityMusic.stop()
 def resetWindowProperties(self, pipe, properties):
     if base.win:
         currentProperties = WindowProperties(base.win.getProperties())
         gsg = base.win.getGsg()
     else:
         currentProperties = WindowProperties.getDefault()
         gsg = None
     newProperties = WindowProperties(currentProperties)
     newProperties.addProperties(properties)
     if base.pipe != pipe:
         gsg = None
     if gsg == None or currentProperties.getFullscreen() != newProperties.getFullscreen() or currentProperties.getParentWindow() != newProperties.getParentWindow():
         self.notify.debug('window properties: %s' % properties)
         self.notify.debug('gsg: %s' % gsg)
         base.pipe = pipe
         if not base.openMainWindow(props=properties, gsg=gsg, keepCamera=True):
             self.notify.warning('OPEN MAIN WINDOW FAILED')
             return 0
         self.notify.info('OPEN MAIN WINDOW PASSED')
         base.graphicsEngine.openWindows()
         if base.win.isClosed():
             self.notify.warning('Window did not open, removing.')
             base.closeWindow(base.win)
             return 0
         base.disableShowbaseMouse()
         if 'libotp' in sys.modules:
             from libotp import NametagGlobals
             NametagGlobals.setCamera(base.cam)
             NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
     else:
         self.notify.debug('Adjusting properties')
         base.win.requestProperties(properties)
         base.graphicsEngine.renderFrame()
     return 1
Ejemplo n.º 6
0
    def exitControlled(self):
        if self.localVehicle:
            self.stopPosHprBroadcast()
            self.__disableControlInterface()
            self.physicsMgr.removePhysicalNode(self.node())
            self.cleanupParticles()
            camera.reparentTo(localAvatar)
            camera.setPos(localAvatar.cameraPositions[0][0])
            camera.setHpr(0, 0, 0)
            self.engineSfxTrack.finish()
            self.engineSfxTrack = self.generateEngineStopTrack()
        else:
            self.stopSmooth()
            taskMgr.remove(self.updateNonLocalTask)
        if self.toon and not self.toon.isDisabled() and not self.toon.isEmpty():
            self.toon.dropShadow.show()
            self.doHeadScale(self.toon, None)
            self.toon.setPosHpr(self.geom[0], 0, 8, 0, 0, 0, 0)
            for feet in self.toon.getPieces(('legs', 'feet')):
                feet.show()

            self.toon.reparentTo(render)
            self.toon.loop('neutral')
            self.toon.startSmooth()
        NametagGlobals.setOnscreenChatForced(0)
        base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
        return
Ejemplo n.º 7
0
 def exitReward(self):
     self.notify.debug('exitReward()')
     self.ignore('resumeAfterReward')
     self.movie.resetReward(finish=1)
     self._removeMembersKeep()
     NametagGlobals.setMasterArrowsOn(1)
     Emote.globalEmote.releaseAll(base.localAvatar, 'dbattle, exitReward')
Ejemplo n.º 8
0
 def exitReward(self):
     self.notify.info('exitReward()')
     self.clearInterval(self.uniqueName('floorReward'))
     self._removeMembersKeep()
     NametagGlobals.setMasterArrowsOn(1)
     for toon in self.toons:
         toon.startSmooth()
 def resetWindowProperties(self, pipe, properties):
     if base.win:
         currentProperties = WindowProperties(base.win.getProperties())
         gsg = base.win.getGsg()
     else:
         currentProperties = WindowProperties.getDefault()
         gsg = None
     newProperties = WindowProperties(currentProperties)
     newProperties.addProperties(properties)
     if base.pipe != pipe:
         gsg = None
     if gsg == None or currentProperties.getFullscreen() != newProperties.getFullscreen() or currentProperties.getParentWindow() != newProperties.getParentWindow():
         self.notify.debug('window properties: %s' % properties)
         self.notify.debug('gsg: %s' % gsg)
         base.pipe = pipe
         if not base.openMainWindow(props=properties, gsg=gsg, keepCamera=True):
             self.notify.warning('OPEN MAIN WINDOW FAILED')
             return 0
         self.notify.info('OPEN MAIN WINDOW PASSED')
         base.graphicsEngine.openWindows()
         if base.win.isClosed():
             self.notify.warning('Window did not open, removing.')
             base.closeWindow(base.win)
             return 0
         base.disableShowbaseMouse()
         if 'libotp' in sys.modules:
             from libotp import NametagGlobals
             NametagGlobals.setCamera(base.cam)
             NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
     else:
         self.notify.debug('Adjusting properties')
         base.win.requestProperties(properties)
         base.graphicsEngine.renderFrame()
     return 1
Ejemplo n.º 10
0
    def exit(self):
        if not self.entered:
            return
        self.entered = 0
        messenger.send('stickerBookExited')
        base.playSfx(self.closeSound)
        self.pages[self.currPageIndex].exit()
        base.render.show()
        setBlackBackground = 0
        for obj in base.cr.doId2do.values():
            if isinstance(obj, DistributedFireworkShow.DistributedFireworkShow) or isinstance(obj, DistributedPartyFireworksActivity.DistributedPartyFireworksActivity):
                setBlackBackground = 1

        if setBlackBackground:
            base.setBackgroundColor(Vec4(0, 0, 0, 1))
        else:
            base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
        gsg = base.win.getGsg()
        if gsg:
            base.render.prepareScene(gsg)
        NametagGlobals.setMin2dAlpha(self.oldMin2dAlpha)
        NametagGlobals.setMax2dAlpha(self.oldMax2dAlpha)
        base.setCellsAvailable([base.rightCells[0]], 1)
        self.__isOpen = 0
        self.hide()
        self.hideButton()
        cleanupDialog('globalDialog')
        self.pageTabFrame.hide()
        self.ignore('shtiker-page-done')
        self.ignore(ToontownGlobals.StickerBookHotkey)
        self.ignore(ToontownGlobals.OptionsPageHotkey)
        self.ignore('arrow_right')
        self.ignore('arrow_left')
        if config.GetBool('want-qa-regression', 0):
            self.notify.info('QA-REGRESSION: SHTICKERBOOK: Close')
Ejemplo n.º 11
0
 def handleAvatarResponseMsg(self, avatarId, di):
     self.localAvatarDoId = avatarId
     self.loadingScreen.endStep('waitForAv')
     self.cleanupWaitingForDatabase()
     dclass = self.dclassesByName['DistributedPlayerPirate']
     NametagGlobals.setMasterArrowsOn(0)
     self.loadingScreen.beginStep('LocalAvatar', 36, 120)
     #self.loadingScreen.show(waitForLocation = True, expectedLoadScale = 4)
     localAvatar = LocalPirate(self)
     localAvatar.dclass = dclass
     base.localAvatar = localAvatar
     __builtins__['localAvatar'] = base.localAvatar
     localAvatar.doId = avatarId
     self.doId2do[avatarId] = localAvatar
     parentId = None
     zoneId = None
     localAvatar.setLocation(parentId, zoneId)
     localAvatar.generate()
     localAvatar.updateAllRequiredFields(dclass, di)
     locUID = localAvatar.getReturnLocation()
     if not locUID:
         locUID = '1150922126.8dzlu'
         localAvatar.setReturnLocation(locUID)
     self.loadingScreen.showTarget(locUID)
     self.loadingScreen.showHint(locUID)
     self.loadingScreen.endStep('LocalAvatar')
     self.loginFSM.request('playingGame')
Ejemplo n.º 12
0
    def resetWindowProperties(self, pipe, properties):
        if base.win:
            currentProperties = WindowProperties(base.win.getProperties())
            gsg = base.win.getGsg()
        else:
            currentProperties = WindowProperties.getDefault()
            gsg = None

        # Check to see if the window properties will change in any
        # important way.
        newProperties = WindowProperties(currentProperties)
        newProperties.addProperties(properties)

        if base.pipe != pipe:
            gsg = None

        if (gsg == None) or \
            (currentProperties.getFullscreen() != newProperties.getFullscreen()) or \
            (currentProperties.getParentWindow() != newProperties.getParentWindow()):
            # For now, assume that if we change fullscreen state, we
            # need to destroy the window and create a new one.

            self.notify.debug("window properties: %s" % properties)
            self.notify.debug("gsg: %s" % gsg)

            base.pipe = pipe
            if not base.openMainWindow(
                    props=properties, gsg=gsg, keepCamera=True):
                self.notify.warning("OPEN MAIN WINDOW FAILED")
                return 0

            self.notify.info("OPEN MAIN WINDOW PASSED")

            base.graphicsEngine.openWindows()
            if base.win.isClosed():
                self.notify.warning("Window did not open, removing.")
                base.closeWindow(base.win)
                return 0

            base.disableShowbaseMouse()

            # If we've already imported (and therefore downloaded)
            # libotp.dll, then we already have a NametagGlobals, and
            # we should keep it up-to-date with the new MouseWatcher
            # etc.
            if 'libotp' in sys.modules:
                from libotp import NametagGlobals
                NametagGlobals.setCamera(base.cam)
                NametagGlobals.setMouseWatcher(base.mouseWatcherNode)

        else:
            # If the properties are changing only slightly
            # (e.g. window size), we can keep the current window and
            # just adjust its properties directly.
            self.notify.debug("Adjusting properties")
            base.win.requestProperties(properties)
            base.graphicsEngine.renderFrame()

        return 1
Ejemplo n.º 13
0
 def exitIntroduction(self):
     self.notify.debug('DistributedBossCog.exitIntroduction:')
     intervalName = 'IntroductionMovie'
     self.clearInterval(intervalName)
     self.unstickToons()
     self.releaseToons()
     NametagGlobals.setMasterArrowsOn(1)
     ElevatorUtils.closeDoors(self.leftDoor, self.rightDoor, self.elevatorType)
Ejemplo n.º 14
0
 def enterBattleFour(self):
     self.cleanupIntervals()
     self.releaseToons(finalBattle=1)
     self.accept('clickedNametag', self.__clickedNameTag)
     self.accept('friendAvatar', self.__handleFriendAvatar)
     self.accept('avatarDetails', self.__handleAvatarDetails)
     NametagGlobals.setMasterArrowsOn(0)
     NametagGlobals.setMasterNametagsActive(1)
Ejemplo n.º 15
0
 def enterStageReward(self, ts):
     self.notify.debug('enterStageReward()')
     self.disableCollision()
     self.delayDeleteMembers()
     if self.hasLocalToon():
         NametagGlobals.setMasterArrowsOn(0)
         if self.bossBattle:
             messenger.send('localToonConfrontedStageBoss')
     self.movie.playReward(ts, self.uniqueName('building-reward'), self.__handleStageRewardDone)
Ejemplo n.º 16
0
 def enterIntroduction(self):
     self.controlToons()
     ElevatorUtils.openDoors(self.leftDoor, self.rightDoor, self.elevatorType)
     NametagGlobals.setMasterArrowsOn(0)
     intervalName = 'IntroductionMovie'
     delayDeletes = []
     seq = Sequence(self.makeIntroductionMovie(delayDeletes), Func(self.__beginBattleOne), name=intervalName)
     seq.delayDeletes = delayDeletes
     seq.start()
     self.storeInterval(seq, intervalName)
Ejemplo n.º 17
0
 def enter(self, requestStatus):
     self.zoneId = requestStatus['zoneId']
     self.fsm.enterInitialState()
     messenger.send('enterToonInterior')
     self.accept('doorDoneEvent', self.handleDoorDoneEvent)
     self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
     volume = requestStatus.get('musicVolume', 0.7)
     base.playMusic(self.loader.activityMusic, looping=1, volume=volume)
     self._telemLimiter = TLGatherAllAvs('ToonInterior', RotationLimitToH)
     NametagGlobals.setMasterArrowsOn(1)
     self.fsm.request(requestStatus['how'], [requestStatus])
Ejemplo n.º 18
0
 def exitPrepareBattleThree(self):
     intervalName = 'PrepareBattleThreeMovie'
     self.clearInterval(intervalName)
     self.unstickToons()
     self.releaseToons()
     if self.newState == 'BattleThree':
         self.movieCrane.request('Free')
         self.movieSafe.request('Initial')
     NametagGlobals.setMasterArrowsOn(1)
     ElevatorUtils.closeDoors(self.leftDoor, self.rightDoor, ElevatorConstants.ELEVATOR_CFO)
     taskMgr.remove(self.uniqueName('physics'))
Ejemplo n.º 19
0
 def enterWaitForToons(self):
     self.cleanupIntervals()
     self.hide()
     if self.gotAllToons:
         self.__doneWaitForToons()
     else:
         self.accept('gotAllToons', self.__doneWaitForToons)
     self.transitions = Transitions.Transitions(loader)
     self.transitions.IrisModelName = 'phase_3/models/misc/iris'
     self.transitions.FadeModelName = 'phase_3/models/misc/fade'
     self.transitions.fadeScreen(alpha=1)
     NametagGlobals.setMasterArrowsOn(0)
Ejemplo n.º 20
0
 def exit(self):
     NametagGlobals.setMasterArrowsOn(0)
     bboard.remove(DistributedMint.DistributedMint.ReadyPost)
     self._telemLimiter.destroy()
     del self._telemLimiter
     base.cr.forbidCheesyEffects(0)
     base.localAvatar.inventory.setRespectInvasions(1)
     self.fsm.requestFinalState()
     self.loader.music.stop()
     self.music.stop()
     self.ignoreAll()
     del self.mintReadyWatcher
Ejemplo n.º 21
0
 def enter(self, requestStatus):
     self.zoneId = requestStatus['zoneId']
     Place.Place.enter(self)
     self.fsm.enterInitialState()
     base.playMusic(self.loader.music, looping=1, volume=0.8)
     self.loader.geom.reparentTo(render)
     self.accept('doorDoneEvent', self.handleDoorDoneEvent)
     self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
     NametagGlobals.setMasterArrowsOn(1)
     how = requestStatus['how']
     self.fsm.request(how, [requestStatus])
     self._telemLimiter = TLGatherAllAvs('CogHQLobby', RotationLimitToH)
Ejemplo n.º 22
0
    def postOpenWindow(self):
        NametagGlobals.setCamera(base.cam)
        if base.wantEnviroDR:
            base.cam.node().setCameraMask(OTPRender.MainCameraBitmask)
        else:
            base.cam.node().setCameraMask(OTPRender.MainCameraBitmask | OTPRender.EnviroCameraBitmask)
        NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
        if base.wantEnviroDR:
            base.setupEnviroCamera()

        if self.config.GetBool('show-tex-mem', False):
            if not (self.texmem) or self.texmem.cleanedUp:
                self.toggleTexMem()
Ejemplo n.º 23
0
    def postOpenWindow(self):
        NametagGlobals.setCamera(base.cam)
        if base.wantEnviroDR:
            base.cam.node().setCameraMask(OTPRender.MainCameraBitmask)
        else:
            base.cam.node().setCameraMask(OTPRender.MainCameraBitmask
                                          | OTPRender.EnviroCameraBitmask)
        NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
        if base.wantEnviroDR:
            base.setupEnviroCamera()

        if self.config.GetBool('show-tex-mem', False):
            if not (self.texmem) or self.texmem.cleanedUp:
                self.toggleTexMem()
Ejemplo n.º 24
0
    def enterReward(self, ts):
        self.notify.debug('enterReward()')
        self.disableCollision()
        self.delayDeleteMembers()
        Emote.globalEmote.disableAll(base.localAvatar, 'dbattle, enterReward')
        if self.hasLocalToon():
            NametagGlobals.setMasterArrowsOn(0)
            if self.localToonActive() == 0:
                self.removeInactiveLocalToon(base.localAvatar)
        for toon in self.toons:
            toon.startSmooth()

        self.accept('resumeAfterReward', self.handleResumeAfterReward)
        if self.interactiveProp:
            self.interactiveProp.gotoVictory()
        self.playReward(ts)
Ejemplo n.º 25
0
 def enterPrepareBattleThree(self):
     self.controlToons()
     NametagGlobals.setMasterArrowsOn(0)
     intervalName = 'PrepareBattleThreeMovie'
     delayDeletes = []
     self.movieCrane = self.cranes[0]
     self.movieSafe = self.safes[1]
     self.movieCrane.request('Movie')
     seq = Sequence(self.makePrepareBattleThreeMovie(delayDeletes, self.movieCrane, self.movieSafe), Func(self.__beginBattleThree), name=intervalName)
     seq.delayDeletes = delayDeletes
     seq.start()
     self.storeInterval(seq, intervalName)
     self.endVault.unstash()
     self.evWalls.stash()
     self.midVault.unstash()
     self.__showResistanceToon(False)
     taskMgr.add(self.__doPhysics, self.uniqueName('physics'), priority=25)
Ejemplo n.º 26
0
 def enter(self):
     if config.GetBool('want-qa-regression', 0):
         self.notify.info('QA-REGRESSION: SHTICKERBOOK: Open')
     if self.entered:
         return
     self.entered = 1
     messenger.send('releaseDirector')
     messenger.send('stickerBookEntered')
     base.playSfx(self.openSound)
     base.disableMouse()
     base.render.hide()
     base.setBackgroundColor(0.05, 0.15, 0.4)
     base.setCellsAvailable([base.rightCells[0]], 0)
     self.oldMin2dAlpha = NametagGlobals.getMin2dAlpha()
     self.oldMax2dAlpha = NametagGlobals.getMax2dAlpha()
     NametagGlobals.setMin2dAlpha(0.8)
     NametagGlobals.setMax2dAlpha(1.0)
     self.__isOpen = 1
     self.__setButtonVisibility()
     self.show()
     self.showPageArrows()
     if not self.safeMode:
         self.accept('shtiker-page-done', self.__pageDone)
         self.accept(ToontownGlobals.StickerBookHotkey, self.__close)
         self.accept(ToontownGlobals.OptionsPageHotkey, self.__close)
         self.pageTabFrame.show()
     self.pages[self.currPageIndex].enter()
     if hasattr(localAvatar, 'newsButtonMgr') and localAvatar.newsButtonMgr:
         localAvatar.newsButtonMgr.hideNewIssueButton()
Ejemplo n.º 27
0
    def __makeGui(self):
        if self.madeGui:
            return
        NametagGlobals.setMasterArrowsOn(0)
        guiModel = 'phase_4/models/gui/cannon_game_gui'
        cannonGui = loader.loadModel(guiModel)
        self.aimPad = DirectFrame(image=cannonGui.find('**/CannonFire_PAD'), relief=None, pos=(0.7, 0, -0.553333), scale=0.8)
        cannonGui.removeNode()
        self.fireButton = DirectButton(parent=self.aimPad, image=((guiModel, '**/Fire_Btn_UP'), (guiModel, '**/Fire_Btn_DN'), (guiModel, '**/Fire_Btn_RLVR')), relief=None, pos=(0.0115741, 0, 0.00505051), scale=1.0, command=self.__firePressed)
        self.upButton = DirectButton(parent=self.aimPad, image=((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief=None, pos=(0.0115741, 0, 0.221717))
        self.downButton = DirectButton(parent=self.aimPad, image=((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief=None, pos=(0.0136112, 0, -0.210101), image_hpr=(0, 0, 180))
        self.leftButton = DirectButton(parent=self.aimPad, image=((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief=None, pos=(-0.199352, 0, -0.000505269), image_hpr=(0, 0, -90))
        self.rightButton = DirectButton(parent=self.aimPad, image=((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief=None, pos=(0.219167, 0, -0.00101024), image_hpr=(0, 0, 90))
        guiClose = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
        cannonBallText = '%d/%d' % (self.cannonBallsLeft, ToontownGlobals.LawbotBossCannonBallMax)
        self.cannonBallLabel = DirectLabel(parent=self.aimPad, text=cannonBallText, text_fg=VBase4(1, 1, 1, 1), text_align=TextNode.ACenter, relief=None, pos=(0.475, 0.0, -0.35), scale=0.25)
        if self.cannonBallsLeft < 5:
            if self.flashingLabel:
                self.flashingLabel.stop()
            flashingTrack = Sequence()
            for i in range(10):
                flashingTrack.append(LerpColorScaleInterval(self.cannonBallLabel, 0.5, VBase4(1, 0, 0, 1)))
                flashingTrack.append(LerpColorScaleInterval(self.cannonBallLabel, 0.5, VBase4(1, 1, 1, 1)))

            self.flashingLabel = flashingTrack
            self.flashingLabel.start()
        self.aimPad.setColor(1, 1, 1, 0.9)

        def bindButton(button, upHandler, downHandler):
            button.bind(DGG.B1PRESS, lambda x, handler = upHandler: handler())
            button.bind(DGG.B1RELEASE, lambda x, handler = downHandler: handler())

        bindButton(self.upButton, self.__upPressed, self.__upReleased)
        bindButton(self.downButton, self.__downPressed, self.__downReleased)
        bindButton(self.leftButton, self.__leftPressed, self.__leftReleased)
        bindButton(self.rightButton, self.__rightPressed, self.__rightReleased)
        self.__enableAimInterface()
        self.madeGui = 1
        return
Ejemplo n.º 28
0
    def onstage(self):
        self.notify.debug('onstage')
        DistributedMinigame.onstage(self)
        self.lt = base.localAvatar
        NametagGlobals.setGlobalNametagScale(1)
        self.arrowKeys = ArrowKeys.ArrowKeys()
        self.room.reparentTo(render)
        self.room.setPosHpr(0.0, 18.39, -ToontownGlobals.FloorOffset, 0.0, 0.0, 0.0)
        self.room.setScale(0.4)
        self.sky.setZ(-5)
        self.sky.reparentTo(render)
        self.dropShadow.setColor(0, 0, 0, 0.5)
        camera.reparentTo(render)
        camera.setPosHpr(-11.4427, 9.03559, 2.80094, -49.104, -0.89, 0)
        self.dropShadow.setBin('fixed', 0, 1)
        self.splash.reparentTo(render)
        self.suitSplash.reparentTo(render)
        base.playMusic(self.music, looping=1, volume=1)
        for x in range(len(self.arrows)):
            self.arrows[x].show()

        for avId in self.avIdList:
            self.pullingDict[avId] = 0
Ejemplo n.º 29
0
 def enter(self, requestStatus):
     if self.dnaFile is not None:
         dna = loader.loadDNA(self.dnaFile)
         visgroups = DNAUtil.getVisGroups(dna)
         visZones = []
         for vg in visgroups:
             if vg.getZone() == dna.zone:
                 visZones = vg.getVisibleZones()
                 break
         self.visInterest = base.cr.addInterest(base.localAvatar.defaultShard, visZones, 'cogHQVis')
     self.zoneId = requestStatus['zoneId']
     BattlePlace.BattlePlace.enter(self)
     self.fsm.enterInitialState()
     base.playMusic(self.loader.music, looping=1, volume=0.8)
     self.loader.geom.reparentTo(render)
     self.nodeList = [self.loader.geom]
     self._telemLimiter = TLGatherAllAvs('CogHQExterior', RotationLimitToH)
     self.accept('doorDoneEvent', self.handleDoorDoneEvent)
     self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
     NametagGlobals.setMasterArrowsOn(1)
     self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.nodeList, self.zoneId)
     how = requestStatus['how']
     self.fsm.request(how, [requestStatus])
Ejemplo n.º 30
0
    def exitReward(self):
        self.ignore('clientCleanup')
        taskMgr.remove('countUpTask')
        taskMgr.remove('countVotesUpTask')
        taskMgr.remove('countDownTask')
        taskMgr.remove('countVotesDownTask')
        taskMgr.remove('celebrate')
        taskMgr.remove('purchase-trans')
        taskMgr.remove('delayAdd')
        taskMgr.remove('delaySubtract')
        for toon in self.toons:
            toon.detachNode()

        del self.toons
        if hasattr(self, 'toonsKeep'):
            for delayDelete in self.toonsKeep:
                delayDelete.destroy()

            del self.toonsKeep
        for counter in self.counters:
            counter.reparentTo(hidden)

        for total in self.totalCounters:
            total.reparentTo(hidden)

        self.foreground.reparentTo(hidden)
        self.backgroundL.reparentTo(hidden)
        self.backgroundR.reparentTo(hidden)
        self.sidewalk.reparentTo(hidden)
        self.sidewalkL.reparentTo(hidden)
        self.sidewalkR.reparentTo(hidden)
        self.door.reparentTo(hidden)
        self.title.reparentTo(self.frame)
        self.convertingVotesToBeansLabel.hide()
        self.rewardDoubledJellybeanLabel.hide()
        base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
        NametagGlobals.setOnscreenChatForced(0)
Ejemplo n.º 31
0
    def __faceOff(self, ts, name, callback):
        if len(self.suits) == 0:
            self.notify.warning('__faceOff(): no suits.')
            return
        if len(self.toons) == 0:
            self.notify.warning('__faceOff(): no toons.')
            return
        toon = self.toons[0]
        point = self.toonPoints[0][0]
        toonPos = point[0]
        toonHpr = VBase3(point[1], 0.0, 0.0)
        p = toon.getPos(self)
        toon.setPos(self, p[0], p[1], 0.0)
        toon.setShadowHeight(0)
        if len(self.suits) == 1:
            leaderIndex = 0
        elif self.bossBattle == 1:
            for suit in self.suits:
                if suit.boss:
                    leaderIndex = self.suits.index(suit)
                    break

        else:
            maxTypeNum = -1
            for suit in self.suits:
                suitTypeNum = SuitDNA.getSuitType(suit.dna.name)
                if maxTypeNum < suitTypeNum:
                    maxTypeNum = suitTypeNum
                    leaderIndex = self.suits.index(suit)

        delay = FACEOFF_TAUNT_T
        suitTrack = Parallel()
        suitLeader = None
        for suit in self.suits:
            suit.setState('Battle')
            suitIsLeader = 0
            oneSuitTrack = Sequence()
            oneSuitTrack.append(Func(suit.loop, 'neutral'))
            oneSuitTrack.append(Func(suit.headsUp, toonPos))
            if self.suits.index(suit) == leaderIndex:
                suitLeader = suit
                suitIsLeader = 1
                if self.bossBattle == 1 and self.levelDoId in base.cr.doId2do:
                    level = base.cr.doId2do[self.levelDoId]
                    if suit.boss:
                        taunt = level.getBossTaunt()
                    else:
                        taunt = level.getBossBattleTaunt()
                else:
                    taunt = SuitBattleGlobals.getFaceoffTaunt(suit.getStyleName(), suit.doId)
                oneSuitTrack.append(Func(suit.setChatAbsolute, taunt, CFSpeech | CFTimeout))
            destPos, destHpr = self.getActorPosHpr(suit, self.suits)
            oneSuitTrack.append(Wait(delay))
            if suitIsLeader == 1:
                oneSuitTrack.append(Func(suit.clearChat))
            oneSuitTrack.append(self.createAdjustInterval(suit, destPos, destHpr))
            suitTrack.append(oneSuitTrack)

        suitHeight = suitLeader.getHeight()
        suitOffsetPnt = Point3(0, 0, suitHeight)
        toonTrack = Parallel()
        for toon in self.toons:
            oneToonTrack = Sequence()
            destPos, destHpr = self.getActorPosHpr(toon, self.toons)
            oneToonTrack.append(Wait(delay))
            oneToonTrack.append(self.createAdjustInterval(toon, destPos, destHpr, toon=1, run=1))
            toonTrack.append(oneToonTrack)

        if self.hasLocalToon():
            MidTauntCamHeight = suitHeight * 0.66
            MidTauntCamHeightLim = suitHeight - 1.8
            if MidTauntCamHeight < MidTauntCamHeightLim:
                MidTauntCamHeight = MidTauntCamHeightLim
            TauntCamY = 18
            TauntCamX = 0
            TauntCamHeight = random.choice((MidTauntCamHeight, 1, 11))
            camTrack = Sequence()
            camTrack.append(Func(camera.reparentTo, suitLeader))
            camTrack.append(Func(base.camLens.setFov, self.camFOFov))
            camTrack.append(Func(camera.setPos, TauntCamX, TauntCamY, TauntCamHeight))
            camTrack.append(Func(camera.lookAt, suitLeader, suitOffsetPnt))
            camTrack.append(Wait(delay))
            camTrack.append(Func(base.camLens.setFov, self.camFov))
            camTrack.append(Func(camera.wrtReparentTo, self))
            camTrack.append(Func(camera.setPos, self.camFOPos))
            camTrack.append(Func(camera.lookAt, suit))
        mtrack = Parallel(suitTrack, toonTrack)
        if self.hasLocalToon():
            NametagGlobals.setMasterArrowsOn(0)
            mtrack = Parallel(mtrack, camTrack)
        done = Func(callback)
        track = Sequence(mtrack, done, name=name)
        track.start(ts)
        self.storeInterval(track, name)
        return
Ejemplo n.º 32
0
 def exitStageReward(self):
     self.notify.debug('exitStageReward()')
     self.movie.resetReward(finish=1)
     self._removeMembersKeep()
     NametagGlobals.setMasterArrowsOn(1)
Ejemplo n.º 33
0
    def initNametagGlobals(self):
        arrow = loader.loadModel('models/gui/arrow')
        card = NodePath('card')
        speech3d = ChatBalloon(loader.loadModel('models/gui/chatbox'))
        thought3d = ChatBalloon(
            loader.loadModel('models/gui/chatbox_thought_cutout'))
        speech2d = ChatBalloon(loader.loadModel('models/gui/chatbox_noarrow'))
        chatButtonGui = loader.loadModel('models/gui/triangle')
        chatButtonGui.setScale(0.10000000000000001)
        chatButtonGui.flattenStrong()
        lookoutButtonGui = loader.loadModel('models/gui/lookout_gui')
        lookoutButtonGui.setScale(0.40000000000000002)
        lookoutButtonGui.flattenStrong()
        NametagGlobals.setCamera(self.cam)
        NametagGlobals.setArrowModel(arrow)
        NametagGlobals.setNametagCard(card, VBase4(-1, 1, -1, 1))
        if self.mouseWatcherNode:
            NametagGlobals.setMouseWatcher(self.mouseWatcherNode)

        NametagGlobals.setSpeechBalloon3d(speech3d)
        NametagGlobals.setThoughtBalloon3d(thought3d)
        NametagGlobals.setSpeechBalloon2d(speech2d)
        NametagGlobals.setThoughtBalloon2d(thought3d)
        NametagGlobals.setPageButton(PGButton.SReady,
                                     chatButtonGui.find('**/triangle'))
        NametagGlobals.setPageButton(PGButton.SDepressed,
                                     chatButtonGui.find('**/triangle_down'))
        NametagGlobals.setPageButton(PGButton.SRollover,
                                     chatButtonGui.find('**/triangle_over'))
        NametagGlobals.setQuitButton(
            PGButton.SReady, lookoutButtonGui.find('**/lookout_close_window'))
        NametagGlobals.setQuitButton(
            PGButton.SDepressed,
            lookoutButtonGui.find('**/lookout_close_window_down'))
        NametagGlobals.setQuitButton(
            PGButton.SRollover,
            lookoutButtonGui.find('**/lookout_close_window_over'))
        rolloverSound = PiratesGuiGlobals.getDefaultRolloverSound()
        clickSound = PiratesGuiGlobals.getDefaultClickSound()
        NametagGlobals.setRolloverSound(rolloverSound)
        NametagGlobals.setClickSound(clickSound)
        NametagGlobals.setToon(self.cam)
        self.marginManager = MarginManager()
        self.margins = self.aspect2d.attachNewNode(
            self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1)
        mm = self.marginManager
        self.leftCells = [
            mm.addGridCell(0, 1.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop),
            mm.addGridCell(0, 2.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop),
            mm.addGridCell(0, 3.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop)
        ]
        self.bottomCells = [
            mm.addGridCell(0.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop),
            mm.addGridCell(1.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop),
            mm.addGridCell(2.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop),
            mm.addGridCell(3.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop),
            mm.addGridCell(4.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop)
        ]
        self.rightCells = [
            mm.addGridCell(5, 2.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop),
            mm.addGridCell(5, 1.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop)
        ]
Ejemplo n.º 34
0
    def offstage(self):
        self.notify.debug('offstage')
        DistributedMinigame.offstage(self)
        self.music.stop()
        if self.introTrack:
            self.introTrack.finish()
            del self.introTrack
            self.introTrack = None
        for track in self.animTracks.values():
            if track:
                track.finish()
                del track
            self.animTracks = {}

        if self.showTrack:
            self.showTrack.finish()
            del self.showTrack
            self.showTrack = None
        if self.setupTrack:
            self.setupTrack.finish()
            del self.setupTrack
            self.setupTrack = None
        base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
        base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar)
        NametagGlobals.setGlobalNametagScale(1.0)
        if self.arrowKeys:
            self.arrowKeys.setPressHandlers(self.arrowKeys.NULL_HANDLERS)
            self.arrowKeys.setReleaseHandlers(self.arrowKeys.NULL_HANDLERS)
            self.arrowKeys.destroy()
            del self.arrowKeys
            self.arrowKeys = None
        self.room.reparentTo(hidden)
        self.sky.reparentTo(hidden)
        self.splash.reparentTo(hidden)
        self.splash.stop()
        self.suitSplash.reparentTo(hidden)
        self.suitSplash.stop()
        self.ripples.reparentTo(hidden)
        self.ripples.stop()
        self.hideControls()
        self.roundText.hide()
        for avId in self.avIdList:
            av = self.getAvatar(avId)
            if av:
                av.loop('neutral')
                av.resetLOD()
                av.dropShadow.show()

        for x in self.tugRopes:
            if x != None:
                x.reparentTo(hidden)

        if self.suit:
            self.suit.reparentTo(hidden)
        for avId in self.avIdList:
            if self.dropShadowDict.has_key(avId):
                self.dropShadowDict[avId].reparentTo(hidden)

        if self.dropShadowDict.has_key(self.suitId):
            self.dropShadowDict[self.suitId].reparentTo(hidden)
        return
Ejemplo n.º 35
0
 def initNametagGlobals(self):
     arrow = loader.loadModel('phase_3/models/props/arrow')
     card = loader.loadModel('phase_3/models/props/panel')
     speech3d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox'))
     thought3d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox_thought_cutout'))
     speech2d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox_noarrow'))
     chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui')
     NametagGlobals.setCamera(self.cam)
     NametagGlobals.setArrowModel(arrow)
     NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5))
     if self.mouseWatcherNode:
         NametagGlobals.setMouseWatcher(self.mouseWatcherNode)
     NametagGlobals.setSpeechBalloon3d(speech3d)
     NametagGlobals.setThoughtBalloon3d(thought3d)
     NametagGlobals.setSpeechBalloon2d(speech2d)
     NametagGlobals.setThoughtBalloon2d(thought3d)
     NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP'))
     NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN'))
     NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr'))
     NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP'))
     NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN'))
     NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr'))
     rolloverSound = DirectGuiGlobals.getDefaultRolloverSound()
     if rolloverSound:
         NametagGlobals.setRolloverSound(rolloverSound)
     clickSound = DirectGuiGlobals.getDefaultClickSound()
     if clickSound:
         NametagGlobals.setClickSound(clickSound)
     NametagGlobals.setToon(self.cam)
     self.marginManager = MarginManager()
     self.margins = self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1)
     mm = self.marginManager
     self.leftCells = [mm.addGridCell(0, 1, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(0, 2, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(0, 3, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]
     self.bottomCells = [mm.addGridCell(0.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
      mm.addGridCell(1.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
      mm.addGridCell(2.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
      mm.addGridCell(3.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
      mm.addGridCell(4.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]
     self.rightCells = [mm.addGridCell(5, 2, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(5, 1, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]