def end(self):
        base.setBackgroundColor(CIGlobals.DefaultBackgroundColor)
        taskMgr.remove("renderFrames")
        render.show()

        if self.mustRestoreHiddenAspect2d:
            base.aspect2d.hide()
            self.mustRestoreHiddenAspect2d = False

        self.progress_bar.finish()
        self.bg_img.reparentTo(hidden)
        self.logoNode.reparentTo(hidden)
        self.barShadow.reparentTo(hidden)
        self.bg.reparentTo(hidden)

        # Let's get rid of the extra texture stage.
        self.bg.setTexture(self.defaultBgTexture, 1)

        self.bgm.reparentTo(hidden)
        self.loading_lbl.reparentTo(hidden)
        self.progress_bar.reparentTo(hidden)
        self.toontipFrame.reparentTo(hidden)
        base.transitions.fadeScreen(1.0)
        NametagGlobals.setWant2dNametags(True)
        self.renderFrames()
 def announceGenerate(self):
     DistributedObject.DistributedObject.announceGenerate(self)
     base.minigame = self
     self.alertText = getAlertText()
     self.popupSound = base.loadSfx(
         'phase_3/audio/sfx/GUI_balloon_popup.ogg')
     NametagGlobals.setWant2dNametags(False)
     if not base.localAvatar.walkControls.getCollisionsActive():
         base.localAvatar.walkControls.setCollisionsActive(1)
    def begin(self, hood, range, wantGui):
        render.hide()
        NametagGlobals.setWant2dNametags(False)

        if base.aspect2d.isHidden():
            base.aspect2d.show()
            self.mustRestoreHiddenAspect2d = True

        self.renderFrames()
        base.setBackgroundColor(0, 0, 0)
        if hood == "localAvatarEnterGame":
            self.loading_lbl['text'] = "Entering..."
        elif hood == "init":
            self.loading_lbl['text'] = "Loading..."
        else:
            self.loading_lbl['text'] = "Heading to %s..." % hood
        self.progress_bar['barColor'] = self.BarColor
        self.progress_bar['range'] = range
        self.bgm.reparentTo(aspect2d)

        ZoneUtil.Hood2ZoneId.keys()

        # We only want to show special loading screens for actual in-game locations.
        if hood in ZoneUtil.Hood2ZoneId.keys():
            abbr = ZoneUtil.ZoneId2HoodAbbr.get(
                ZoneUtil.Hood2ZoneId.get(hood)).lower()
            bgTexture = loader.loadTexture(
                'phase_14/maps/{0}_loading.png'.format(abbr), okMissing=True)

            if bgTexture:
                self.bg.setTexture(bgTexture, 1)

        self.barShadow.reparentTo(aspect2d)
        self.bg.reparentTo(render2d)
        self.bg_img.reparentTo(hidden)
        self.loading_lbl.reparentTo(aspect2d)
        self.logoNode.reparentTo(aspect2d)
        self.progress_bar.reparentTo(aspect2d)
        tip = random.choice(CIGlobals.ToonTips)
        self.toontipLbl.setText("TOON TIP:\n" + tip)
        self.toontipFrame.reparentTo(aspect2d)
        self.__count = 0
        self.__expectedCount = range
        self.progress_bar.update(self.__count)
    def enterRideElevator(self, ts):
        elevator = self.elevators[0]

        NametagGlobals.setWant2dNametags(False)

        tauntSuit = self.suits.get(self.tauntSuitId)
        if tauntSuit:
            tauntSuit.headsUp(self.elevators[0].getElevatorModel())

        base.camLens.setFov(CIGlobals.OriginalCameraFov)
        camera.reparentTo(elevator.getElevatorModel())
        camera.setPos(0, 14, 4)
        camera.setHpr(180, 0, 0)

        base.playMusic(self.rideElevatorMusic, looping=1)
        base.transitions.refreshGraphicsEngine()
        base.transitions.irisIn(t=1.5, blendType='easeOut')

        self.elevatorTrack = getRideElevatorInterval()
        self.elevatorTrack.append(Func(self.__doFloorTextPulse))
        self.elevatorTrack.append(
            getOpenInterval(self, elevator.getLeftDoor(),
                            elevator.getRightDoor(), self.openSfx, None))
        self.elevatorTrack.start(ts)
 def disable(self):
     self.deleteTimer()
     base.localAvatar.getGeomNode().setColorScale(VBase4(1, 1, 1, 1))
     if hasattr(self, 'gameOverLbl') and self.gameOverLbl is not None:
         self.gameOverLbl.destroy()
         self.gameOverLbl = None
     NametagGlobals.setWant2dNametags(True)
     base.localAvatar.setPosHpr(0, 0, 0, 0, 0, 0)
     if hasattr(self, 'fsm'):
         self.fsm.requestFinalState()
         del self.fsm
     self.winSfx = None
     self.loseSfx = None
     self.prizeHigh = None
     self.prizeLow = None
     if self.headPanels is not None:
         self.headPanels.delete()
         self.headPanels = None
     if self.finalScoreUI is not None:
         self.finalScoreUI.unload()
         self.finalScoreUI = None
     self.numPlayers = None
     base.minigame = None
     DistributedObject.DistributedObject.disable(self)
    def enterBattle(self, ts):
        NametagGlobals.setWant2dNametags(True)

        base.localAvatar.walkControls.setCollisionsActive(1)
        self.cr.playGame.getPlace().fsm.request('walk')
        base.localAvatar.hideBookButton()