Ejemplo n.º 1
0
    def enterReward(self):
        numToons = 0
        toonLayouts = ((2, ), (1, 3), (0, 2, 4), (0, 1, 3, 4))
        toonPositions = (5.0, 1.75, -0.25, -1.75, -5.0)
        self.toons = []
        self.toonsKeep = []
        self.counters = []
        self.totalCounters = []
        camera.reparentTo(render)
        base.camLens.setFov(ToontownGlobals.DefaultCameraFov)
        camera.setPos(0, 16.0, 2.0)
        camera.lookAt(0, 0, 0.75)
        base.transitions.irisIn(0.4)
        self.title.reparentTo(aspect2d)
        self.foreground.reparentTo(render)
        self.backgroundL.reparentTo(render)
        self.backgroundR.reparentTo(render)
        self.sidewalk.reparentTo(render)
        self.door.reparentTo(render)
        size = 20
        z = -2.5
        floor = CollisionPolygon(Point3(-size, -size, z),
                                 Point3(size, -size, z), Point3(size, size, z),
                                 Point3(-size, size, z))
        floor.setTangible(1)
        floorNode = CollisionNode('collision_floor')
        floorNode.addSolid(floor)
        self.collisionFloor = render.attachNewNode(floorNode)
        NametagGlobals.setOnscreenChatForced(1)
        for index in range(len(self.ids)):
            avId = self.ids[index]
            if self.states[index] != PURCHASE_NO_CLIENT_STATE and self.states[
                    index] != PURCHASE_DISCONNECTED_STATE and avId in base.cr.doId2do:
                numToons += 1
                toon = base.cr.doId2do[avId]
                toon.stopSmooth()
                self.toons.append(toon)
                self.toonsKeep.append(
                    DelayDelete.DelayDelete(toon, 'Purchase.enterReward'))
                counter = DirectLabel(parent=hidden,
                                      relief=None,
                                      pos=(0.0, 0.0, 0.0),
                                      text=str(0),
                                      text_scale=0.2,
                                      text_fg=(0.95, 0.95, 0, 1),
                                      text_pos=(0, -0.1, 0),
                                      text_font=ToontownGlobals.getSignFont())
                counter['image'] = DGG.getDefaultDialogGeom()
                counter['image_scale'] = (0.33, 1, 0.33)
                counter.setScale(0.5)
                counter.count = 0
                counter.max = self.pointsArray[index]
                self.counters.append(counter)
                money = self.playerMoney[index]
                totalCounter = DirectLabel(
                    parent=hidden,
                    relief=None,
                    pos=(0.0, 0.0, 0.0),
                    text=str(money),
                    text_scale=0.2,
                    text_fg=(0.95, 0.95, 0, 1),
                    text_pos=(0, -0.1, 0),
                    text_font=ToontownGlobals.getSignFont(),
                    image=self.jarImage)
                totalCounter.setScale(0.5)
                totalCounter.count = money
                totalCounter.max = toon.getMaxMoney()
                self.totalCounters.append(totalCounter)

        self.accept('clientCleanup', self._handleClientCleanup)
        pos = 0
        toonLayout = toonLayouts[numToons - 1]
        for toon in self.toons:
            thisPos = toonPositions[toonLayout[pos]]
            toon.setPos(Vec3(thisPos, 1.0, -2.5))
            toon.setHpr(Vec3(0, 0, 0))
            toon.setAnimState('neutral', 1)
            toon.setShadowHeight(0)
            if not toon.isDisabled():
                toon.reparentTo(render)
            self.counters[pos].setPos(thisPos * -0.17, 0,
                                      toon.getHeight() / 10 + 0.25)
            self.counters[pos].reparentTo(aspect2d)
            self.totalCounters[pos].setPos(thisPos * -0.17, 0, -0.825)
            self.totalCounters[pos].reparentTo(aspect2d)
            pos += 1

        self.maxPoints = max(self.pointsArray)
        if self.votesArray:
            self.maxVotes = max(self.votesArray)
            numToons = len(self.toons)
            self.voteMultiplier = TravelGameGlobals.PercentOfVotesConverted[
                numToons] / 100.0
            self.maxBeansFromVotes = int(self.voteMultiplier * self.maxVotes)
        else:
            self.maxVotes = 0
            self.maxBeansFromVotes = 0

        def reqCountUp(state):
            self.countUp()
            return Task.done

        countUpDelay = DELAY_BEFORE_COUNT_UP
        taskMgr.doMethodLater(countUpDelay, reqCountUp, 'countUpTask')

        def reqCountDown(state):
            self.countDown()
            return Task.done

        countDownDelay = countUpDelay + COUNT_UP_DURATION + DELAY_AFTER_COUNT_UP
        taskMgr.doMethodLater(countDownDelay, reqCountDown, 'countDownTask')

        def celebrate(task):
            for counter in task.counters:
                counter.hide()

            winningPoints = max(task.pointsArray)
            for i in range(len(task.ids)):
                if task.pointsArray[i] == winningPoints:
                    avId = task.ids[i]
                    if avId in base.cr.doId2do:
                        toon = base.cr.doId2do[avId]
                        toon.setAnimState('jump', 1.0)

            base.playSfx(task.celebrateSound)
            return Task.done

        celebrateDelay = countDownDelay + COUNT_DOWN_DURATION + DELAY_AFTER_COUNT_DOWN
        celebrateTask = taskMgr.doMethodLater(celebrateDelay, celebrate,
                                              'celebrate')
        celebrateTask.counters = self.counters
        celebrateTask.pointsArray = self.pointsArray
        celebrateTask.ids = self.ids
        celebrateTask.celebrateSound = self.celebrateSound

        def reqCountVotesUp(state):
            self.countVotesUp()
            return Task.done

        def reqCountVotesDown(state):
            self.countVotesDown()
            return Task.done

        if self.metagameRound == TravelGameGlobals.FinalMetagameRoundIndex:
            countVotesUpDelay = celebrateDelay + DELAY_AFTER_CELEBRATE
            taskMgr.doMethodLater(countVotesUpDelay, reqCountVotesUp,
                                  'countVotesUpTask')
            countVotesUpTime = self.maxVotes * COUNT_UP_RATE + DELAY_AFTER_COUNT_UP
            countVotesDownDelay = countVotesUpDelay + countVotesUpTime
            taskMgr.doMethodLater(countVotesDownDelay, reqCountVotesDown,
                                  'countVotesDownTask')
            celebrateDelay += countVotesUpTime + self.maxVotes * COUNT_DOWN_RATE + DELAY_AFTER_COUNT_DOWN

        def reqPurchase(state):
            self.fsm.request('purchase')
            return Task.done

        purchaseDelay = celebrateDelay + DELAY_AFTER_CELEBRATE
        taskMgr.doMethodLater(purchaseDelay, reqPurchase, 'purchase-trans')
        if base.skipMinigameReward:
            self.fsm.request('purchase')
        return
Ejemplo n.º 2
0
 def __init__(self, doneEvent):
     self.doneEvent = doneEvent
     DirectFrame.__init__(self)
     self.reparentTo(aspect2d)
     self.setPos(0.0, 0.0, 0.16)
     self.stash()
     publicPartyGui = loader.loadModel(
         'phase_4/models/parties/publicPartyGUI')
     self.frame = DirectFrame(
         parent=self,
         geom=publicPartyGui.find('**/activities_background'),
         geom_pos=(-0.80000000000000004, 0.0, 0.20000000000000001),
         geom_scale=2.0,
         relief=None)
     self.earnedLabel = DirectLabel(
         parent=self,
         relief=None,
         text=str(0),
         text_align=TextNode.ACenter,
         text_pos=(0.0, -0.070000000000000007),
         text_scale=0.20000000000000001,
         text_fg=(0.94999999999999996, 0.94999999999999996, 0.0, 1.0),
         text_font=ToontownGlobals.getSignFont(),
         textMayChange=True,
         image=DirectGuiGlobals.getDefaultDialogGeom(),
         image_scale=(0.33000000000000002, 1.0, 0.33000000000000002),
         pos=(-0.29999999999999999, 0.0, 0.20000000000000001),
         scale=0.90000000000000002)
     purchaseModels = loader.loadModel('phase_4/models/gui/purchase_gui')
     jarImage = purchaseModels.find('**/Jar')
     self.jarLabel = DirectLabel(
         parent=self,
         relief=None,
         text=str(0),
         text_align=TextNode.ACenter,
         text_pos=(0.0, -0.070000000000000007),
         text_scale=0.20000000000000001,
         text_fg=JellybeanRewardGui.JarLabelTextColor,
         text_font=ToontownGlobals.getSignFont(),
         textMayChange=True,
         image=jarImage,
         scale=0.69999999999999996,
         pos=(0.29999999999999999, 0.0, 0.17000000000000001))
     purchaseModels.removeNode()
     del purchaseModels
     jarImage.removeNode()
     del jarImage
     self.messageLabel = DirectLabel(parent=self,
                                     relief=None,
                                     text='',
                                     text_align=TextNode.ALeft,
                                     text_wordwrap=16.0,
                                     text_scale=0.070000000000000007,
                                     pos=(-0.52000000000000002, 0.0,
                                          -0.10000000000000001),
                                     textMayChange=True)
     self.doubledJellybeanLabel = DirectLabel(
         parent=self,
         relief=None,
         text=TTLocalizer.PartyRewardDoubledJellybean,
         text_align=TextNode.ACenter,
         text_wordwrap=12.0,
         text_scale=0.089999999999999997,
         text_fg=(1.0, 0.125, 0.125, 1.0),
         pos=(0.0, 0.0, -0.46500000000000002),
         textMayChange=False)
     self.doubledJellybeanLabel.hide()
     self.closeButton = DirectButton(
         parent=self,
         relief=None,
         text=TTLocalizer.PartyJellybeanRewardOK,
         text_align=TextNode.ACenter,
         text_scale=0.065000000000000002,
         text_pos=(0.0, -0.625),
         geom=(publicPartyGui.find('**/startButton_up'),
               publicPartyGui.find('**/startButton_down'),
               publicPartyGui.find('**/startButton_rollover'),
               publicPartyGui.find('**/startButton_inactive')),
         geom_pos=(-0.39000000000000001, 0.0, 0.125),
         command=self._close)
     publicPartyGui.removeNode()
     del publicPartyGui
     self.countSound = base.loadSfx(
         'phase_13/audio/sfx/tick_counter_short.mp3')
     self.overMaxSound = base.loadSfx(
         'phase_13/audio/sfx/tick_counter_overflow.mp3')
    def __init__(self, doneEvent):
        self.doneEvent = doneEvent
        DirectFrame.__init__(self)
        self.reparentTo(aspect2d)
        self.setPos(0.0, 0.0, 0.16)
        self.stash()
        # load the public party gui and extract the sub-chunk of the model that
        # we will use as the background for this gui
        publicPartyGui = loader.loadModel(
            "phase_4/models/parties/publicPartyGUI")
        # create a top level DirectFrame to hold everything else
        self.frame = DirectFrame(
            parent=self,
            geom=publicPartyGui.find("**/activities_background"),
            geom_pos=(-0.8, 0.0, 0.2),
            geom_scale=2.0,
            relief=None,
        )

        # counter for beans won in the activity
        self.earnedLabel = DirectLabel(
            parent=self,
            relief=None,
            text=str(0),
            text_align=TextNode.ACenter,
            text_pos=(0.0, -0.07),
            text_scale=0.2,
            text_fg=(0.95, 0.95, 0.0, 1.0),
            text_font=ToontownGlobals.getSignFont(),
            textMayChange=True,
            image=DirectGuiGlobals.getDefaultDialogGeom(),
            image_scale=(0.33, 1.0, 0.33),
            pos=(-0.3, 0.0, 0.2),
            scale=0.9,
        )

        # counter with jellybean jar in the background for beans in the
        # "pocketbook" (the beans you carry around with you that are not in your
        # home bank)
        purchaseModels = loader.loadModel("phase_4/models/gui/purchase_gui")
        jarImage = purchaseModels.find("**/Jar")
        self.jarLabel = DirectLabel(
            parent=self,
            relief=None,
            text=str(0),
            text_align=TextNode.ACenter,
            text_pos=(0.0, -0.07),
            text_scale=0.2,
            text_fg=JellybeanRewardGui.JarLabelTextColor,
            text_font=ToontownGlobals.getSignFont(),
            textMayChange=True,
            image=jarImage,
            scale=0.7,
            pos=(0.3, 0.0, 0.17),
        )
        purchaseModels.removeNode()
        del purchaseModels
        jarImage.removeNode()
        del jarImage

        # message text
        self.messageLabel = DirectLabel(
            parent=self,
            relief=None,
            text="",
            text_align=TextNode.ALeft,
            text_wordwrap=16.0,
            text_scale=0.07,
            pos=(-0.52, 0.0, -0.1),
            textMayChange=True,
        )

        self.doubledJellybeanLabel = DirectLabel(
            parent=self,
            relief=None,
            text=TTLocalizer.PartyRewardDoubledJellybean,
            text_align=TextNode.ACenter,
            text_wordwrap=12.0,
            text_scale=0.09,
            text_fg=(1.0, 0.125, 0.125, 1.0),
            pos=(0.0, 0.0, -0.465),
            textMayChange=False,
        )
        self.doubledJellybeanLabel.hide()

        # button to close the gui when the player is done reading it
        self.closeButton = DirectButton(
            parent=self,
            relief=None,
            text=TTLocalizer.PartyJellybeanRewardOK,
            text_align=TextNode.ACenter,
            text_scale=0.065,
            text_pos=(0.0, -0.625),
            geom=(
                publicPartyGui.find("**/startButton_up"),
                publicPartyGui.find("**/startButton_down"),
                publicPartyGui.find("**/startButton_rollover"),
                publicPartyGui.find("**/startButton_inactive"),
            ),
            geom_pos=(-0.39, 0.0,
                      0.125),  # place the geom to line up with the text
            command=self._close,
        )

        publicPartyGui.removeNode()
        del publicPartyGui

        self.countSound = base.loadSfx(
            "phase_13/audio/sfx/tick_counter_short.mp3")
        self.overMaxSound = base.loadSfx(
            "phase_13/audio/sfx/tick_counter_overflow.mp3")
Ejemplo n.º 4
0
    def enterReward(self):
        numToons = 0
        toonLayouts = ((2,), (1, 3), (0, 2, 4), (0, 1, 3, 4))
        toonPositions = (5.0, 1.75, -0.25, -1.75, -5.0)
        self.toons = []
        self.toonsKeep = []
        self.counters = []
        self.totalCounters = []
        camera.reparentTo(render)
        base.camLens.setFov(ToontownGlobals.DefaultCameraFov)
        camera.setPos(0, 16.0, 2.0)
        camera.lookAt(0, 0, 0.75)
        base.transitions.irisIn(0.40000000000000002)
        self.title.reparentTo(aspect2d)
        self.foreground.reparentTo(render)
        self.backgroundL.reparentTo(render)
        self.backgroundR.reparentTo(render)
        self.sidewalk.reparentTo(render)
        self.door.reparentTo(render)
        size = 20
        z = -2.5
        floor = CollisionPolygon(Point3(-size, -size, z), Point3(size, -size, z), Point3(size, size, z), Point3(-size, size, z))
        floor.setTangible(1)
        floorNode = CollisionNode('collision_floor')
        floorNode.addSolid(floor)
        self.collisionFloor = render.attachNewNode(floorNode)
        NametagGlobals.setOnscreenChatForced(1)
        for index in range(len(self.ids)):
            avId = self.ids[index]
            if self.states[index] != PURCHASE_NO_CLIENT_STATE and self.states[index] != PURCHASE_DISCONNECTED_STATE and avId in base.cr.doId2do:
                numToons += 1
                toon = base.cr.doId2do[avId]
                toon.stopSmooth()
                self.toons.append(toon)
                self.toonsKeep.append(DelayDelete.DelayDelete(toon, 'Purchase.enterReward'))
                counter = DirectLabel(parent = hidden, relief = None, pos = (0.0, 0.0, 0.0), text = str(0), text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_pos = (0, -0.10000000000000001, 0), text_font = ToontownGlobals.getSignFont())
                counter['image'] = DGG.getDefaultDialogGeom()
                counter['image_scale'] = (0.33000000000000002, 1, 0.33000000000000002)
                counter.setScale(0.5)
                counter.count = 0
                counter.max = self.pointsArray[index]
                self.counters.append(counter)
                money = self.playerMoney[index]
                totalCounter = DirectLabel(parent = hidden, relief = None, pos = (0.0, 0.0, 0.0), text = str(money), text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_pos = (0, -0.10000000000000001, 0), text_font = ToontownGlobals.getSignFont(), image = self.jarImage)
                totalCounter.setScale(0.5)
                totalCounter.count = money
                totalCounter.max = toon.getMaxMoney()
                self.totalCounters.append(totalCounter)
                continue
        
        self.accept('clientCleanup', self._handleClientCleanup)
        pos = 0
        toonLayout = toonLayouts[numToons - 1]
        for toon in self.toons:
            thisPos = toonPositions[toonLayout[pos]]
            toon.setPos(Vec3(thisPos, 1.0, -2.5))
            toon.setHpr(Vec3(0, 0, 0))
            toon.setAnimState('neutral', 1)
            toon.setShadowHeight(0)
            if not toon.isDisabled():
                toon.reparentTo(render)
            
            self.counters[pos].setPos(thisPos * -0.17000000000000001, 0, toon.getHeight() / 10 + 0.25)
            self.counters[pos].reparentTo(aspect2d)
            self.totalCounters[pos].setPos(thisPos * -0.17000000000000001, 0, -0.82499999999999996)
            self.totalCounters[pos].reparentTo(aspect2d)
            pos += 1
        
        self.maxPoints = max(self.pointsArray)
        if self.votesArray:
            self.maxVotes = max(self.votesArray)
            numToons = len(self.toons)
            self.voteMultiplier = TravelGameGlobals.PercentOfVotesConverted[numToons] / 100.0
            self.maxBeansFromVotes = int(self.voteMultiplier * self.maxVotes)
        else:
            self.maxVotes = 0
            self.maxBeansFromVotes = 0
        
        def reqCountUp(state):
            self.countUp()
            return Task.done

        countUpDelay = DELAY_BEFORE_COUNT_UP
        taskMgr.doMethodLater(countUpDelay, reqCountUp, 'countUpTask')
        
        def reqCountDown(state):
            self.countDown()
            return Task.done

        countDownDelay = countUpDelay + COUNT_UP_DURATION + DELAY_AFTER_COUNT_UP
        taskMgr.doMethodLater(countDownDelay, reqCountDown, 'countDownTask')
        
        def celebrate(task):
            for counter in task.counters:
                counter.hide()
            
            winningPoints = max(task.pointsArray)
            for i in range(len(task.ids)):
                if task.pointsArray[i] == winningPoints:
                    avId = task.ids[i]
                    if base.cr.doId2do.has_key(avId):
                        toon = base.cr.doId2do[avId]
                        toon.setAnimState('jump', 1.0)
                    
                base.cr.doId2do.has_key(avId)
            
            base.playSfx(task.celebrateSound)
            return Task.done

        celebrateDelay = countDownDelay + COUNT_DOWN_DURATION + DELAY_AFTER_COUNT_DOWN
        celebrateTask = taskMgr.doMethodLater(celebrateDelay, celebrate, 'celebrate')
        celebrateTask.counters = self.counters
        celebrateTask.pointsArray = self.pointsArray
        celebrateTask.ids = self.ids
        celebrateTask.celebrateSound = self.celebrateSound
        
        def reqCountVotesUp(state):
            self.countVotesUp()
            return Task.done

        
        def reqCountVotesDown(state):
            self.countVotesDown()
            return Task.done

        if self.metagameRound == TravelGameGlobals.FinalMetagameRoundIndex:
            countVotesUpDelay = celebrateDelay + DELAY_AFTER_CELEBRATE
            taskMgr.doMethodLater(countVotesUpDelay, reqCountVotesUp, 'countVotesUpTask')
            countVotesUpTime = self.maxVotes * COUNT_UP_RATE + DELAY_AFTER_COUNT_UP
            countVotesDownDelay = countVotesUpDelay + countVotesUpTime
            taskMgr.doMethodLater(countVotesDownDelay, reqCountVotesDown, 'countVotesDownTask')
            celebrateDelay += countVotesUpTime + self.maxVotes * COUNT_DOWN_RATE + DELAY_AFTER_COUNT_DOWN
        
        
        def reqPurchase(state):
            self.fsm.request('purchase')
            return Task.done

        purchaseDelay = celebrateDelay + DELAY_AFTER_CELEBRATE
        taskMgr.doMethodLater(purchaseDelay, reqPurchase, 'purchase-trans')
        if base.skipMinigameReward:
            self.fsm.request('purchase')
 def __init__(self, doneEvent):
     self.doneEvent = doneEvent
     DirectFrame.__init__(self)
     self.reparentTo(aspect2d)
     self.setPos(0.0, 0.0, 0.16)
     self.stash()
     publicPartyGui = loader.loadModel('phase_4/models/parties/publicPartyGUI')
     self.frame = DirectFrame(parent=self, geom=publicPartyGui.find('**/activities_background'), geom_pos=(-0.8, 0.0, 0.2), geom_scale=2.0, relief=None)
     self.earnedLabel = DirectLabel(parent=self, relief=None, text=str(0), text_align=TextNode.ACenter, text_pos=(0.0, -0.07), text_scale=0.2, text_fg=(0.95, 0.95, 0.0, 1.0), text_font=ToontownGlobals.getSignFont(), textMayChange=True, image=DirectGuiGlobals.getDefaultDialogGeom(), image_scale=(0.33, 1.0, 0.33), pos=(-0.3, 0.0, 0.2), scale=0.9)
     purchaseModels = loader.loadModel('phase_4/models/gui/purchase_gui')
     jarImage = purchaseModels.find('**/Jar')
     self.jarLabel = DirectLabel(parent=self, relief=None, text=str(0), text_align=TextNode.ACenter, text_pos=(0.0, -0.07), text_scale=0.2, text_fg=JellybeanRewardGui.JarLabelTextColor, text_font=ToontownGlobals.getSignFont(), textMayChange=True, image=jarImage, scale=0.7, pos=(0.3, 0.0, 0.17))
     purchaseModels.removeNode()
     del purchaseModels
     jarImage.removeNode()
     del jarImage
     self.messageLabel = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_wordwrap=16.0, text_scale=0.07, pos=(-0.52, 0.0, -0.1), textMayChange=True)
     self.doubledJellybeanLabel = DirectLabel(parent=self, relief=None, text=TTLocalizer.PartyRewardDoubledJellybean, text_align=TextNode.ACenter, text_wordwrap=12.0, text_scale=0.09, text_fg=(1.0, 0.125, 0.125, 1.0), pos=(0.0, 0.0, -0.465), textMayChange=False)
     self.doubledJellybeanLabel.hide()
     self.closeButton = DirectButton(parent=self, relief=None, text=TTLocalizer.PartyJellybeanRewardOK, text_align=TextNode.ACenter, text_scale=0.065, text_pos=(0.0, -0.625), geom=(publicPartyGui.find('**/startButton_up'),
      publicPartyGui.find('**/startButton_down'),
      publicPartyGui.find('**/startButton_rollover'),
      publicPartyGui.find('**/startButton_inactive')), geom_pos=(-0.39, 0.0, 0.125), command=self._close)
     publicPartyGui.removeNode()
     del publicPartyGui
     self.countSound = base.loadSfx('phase_13/audio/sfx/tick_counter_short.mp3')
     self.overMaxSound = base.loadSfx('phase_13/audio/sfx/tick_counter_overflow.mp3')
     return
Ejemplo n.º 6
0
    def enterReward(self):
        assert self.notify.debugStateCall(self)
        numToons = 0
        toonLayouts = (
            (2, ),
            (1, 3),
            (0, 2, 4),
            (0, 1, 3, 4),
        )
        toonPositions = (5.0, 1.75, -0.25, -1.75, -5.0)
        self.toons = []
        self.toonsKeep = []
        self.counters = []
        self.totalCounters = []

        # put the camera in a reasonable position
        camera.reparentTo(render)
        base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov)
        camera.setPos(0, 16.0, 2.0)
        camera.lookAt(0, 0, 0.75)
        base.transitions.irisIn(0.4)

        # show background elements
        self.title.reparentTo(aspect2d)
        self.foreground.reparentTo(render)
        self.backgroundL.reparentTo(render)
        self.backgroundR.reparentTo(render)
        self.sidewalk.reparentTo(render)
        self.door.reparentTo(render)

        # The backdrop in this scene is not really under our feet - it is a
        # bit of an optical illusion. So to make the physics behave a bit
        # better, we'll actually put a floor directly under the toons so
        # they stay put and their shadows stay put
        size = 20
        z = -2.5
        floor = CollisionPolygon(Point3(-size, -size, z),
                                 Point3(size, -size, z), Point3(size, size, z),
                                 Point3(-size, size, z))
        floor.setTangible(1)
        floorNode = CollisionNode("collision_floor")
        floorNode.addSolid(floor)
        self.collisionFloor = render.attachNewNode(floorNode)

        # the bean counters take up a lot of real estate: clamp the whisper bubbles
        NametagGlobals.setOnscreenChatForced(1)

        # find out how many toons there are, make point counters for
        # them and get their models
        for index in range(len(self.ids)):
            avId = self.ids[index]
            if ((self.states[index] != PURCHASE_NO_CLIENT_STATE)
                    and (self.states[index] != PURCHASE_DISCONNECTED_STATE)
                    and (avId in base.cr.doId2do)):
                numToons += 1
                toon = base.cr.doId2do[avId]
                toon.stopSmooth()
                self.toons.append(toon)
                self.toonsKeep.append(
                    DelayDelete.DelayDelete(toon, 'Purchase.enterReward'))
                # counter for beans won
                counter = DirectLabel(
                    parent=hidden,
                    relief=None,
                    pos=(0.0, 0.0, 0.0),
                    text=str(0),
                    text_scale=0.2,
                    text_fg=(0.95, 0.95, 0, 1),
                    text_pos=(0, -0.1, 0),
                    text_font=ToontownGlobals.getSignFont(),
                )
                counter['image'] = DGG.getDefaultDialogGeom()
                counter['image_scale'] = (0.33, 1, 0.33)
                counter.setScale(0.5)
                counter.count = 0
                counter.max = self.pointsArray[index]
                self.counters.append(counter)

                # counter for total beans carried
                money = self.playerMoney[index]
                totalCounter = DirectLabel(
                    parent=hidden,
                    relief=None,
                    pos=(0.0, 0.0, 0.0),
                    text=str(money),
                    text_scale=0.2,
                    text_fg=(0.95, 0.95, 0, 1),
                    text_pos=(0, -0.1, 0),
                    text_font=ToontownGlobals.getSignFont(),
                    image=self.jarImage,
                )
                totalCounter.setScale(0.5)
                totalCounter.count = money
                totalCounter.max = toon.getMaxMoney()
                self.totalCounters.append(totalCounter)

        # add a hook when user unexpectedly closes toontown window
        self.accept('clientCleanup', self._handleClientCleanup)

        # display the toons and jars
        pos = 0
        toonLayout = toonLayouts[numToons - 1]
        for toon in self.toons:
            thisPos = toonPositions[toonLayout[pos]]
            toon.setPos(Vec3(thisPos, 1.0, -2.5))
            toon.setHpr(Vec3(0, 0, 0))
            toon.setAnimState("neutral", 1)
            toon.setShadowHeight(0)
            if not toon.isDisabled():
                toon.reparentTo(render)
            self.counters[pos].setPos(thisPos * -0.17, 0,
                                      toon.getHeight() / 10 + 0.25)
            self.counters[pos].reparentTo(aspect2d)
            self.totalCounters[pos].setPos(thisPos * -0.17, 0, -0.825)
            self.totalCounters[pos].reparentTo(aspect2d)
            pos += 1

        # find the max points won
        self.maxPoints = max(self.pointsArray)

        #find the maxVotes left
        if self.votesArray:
            self.maxVotes = max(self.votesArray)
            numToons = len(self.toons)
            self.voteMultiplier = TravelGameGlobals.PercentOfVotesConverted[
                numToons] / 100.0
            self.maxBeansFromVotes = int(self.voteMultiplier * self.maxVotes)
        else:
            self.maxVotes = 0
            self.maxBeansFromVotes = 0

        def reqCountUp(state):
            self.countUp()
            return Task.done

        countUpDelay = DELAY_BEFORE_COUNT_UP
        taskMgr.doMethodLater(countUpDelay, reqCountUp, "countUpTask")

        def reqCountDown(state):
            self.countDown()
            return Task.done

        countDownDelay = (countUpDelay + self.maxPoints * COUNT_UP_RATE +
                          DELAY_AFTER_COUNT_UP)
        taskMgr.doMethodLater(countDownDelay, reqCountDown, "countDownTask")

        # play the jump animation for the winner(s)
        def celebrate(task):
            # hide the counters before we jump!
            for counter in task.counters:
                counter.hide()
            winningPoints = max(task.pointsArray)
            for i in range(len(task.ids)):
                if task.pointsArray[i] == winningPoints:
                    avId = task.ids[i]
                    if avId in base.cr.doId2do:
                        toon = base.cr.doId2do[avId]
                        toon.setAnimState("jump", 1.0)

            base.playSfx(task.celebrateSound)
            return Task.done

        celebrateDelay = (countDownDelay + self.maxPoints * COUNT_DOWN_RATE +
                          DELAY_AFTER_COUNT_DOWN)
        celebrateTask = taskMgr.doMethodLater(celebrateDelay, celebrate,
                                              "celebrate")
        celebrateTask.counters = self.counters
        celebrateTask.pointsArray = self.pointsArray
        celebrateTask.ids = self.ids
        celebrateTask.celebrateSound = self.celebrateSound

        def reqCountVotesUp(state):
            self.countVotesUp()
            return Task.done

        def reqCountVotesDown(state):
            self.countVotesDown()
            return Task.done

        # show the player the votes left being converted to beans
        if self.metagameRound == TravelGameGlobals.FinalMetagameRoundIndex:
            countVotesUpDelay = celebrateDelay + DELAY_AFTER_CELEBRATE
            taskMgr.doMethodLater(countVotesUpDelay, reqCountVotesUp,
                                  "countVotesUpTask")

            countVotesUpTime = (self.maxVotes *
                                COUNT_UP_RATE) + DELAY_AFTER_COUNT_UP
            countVotesDownDelay = countVotesUpDelay + countVotesUpTime
            taskMgr.doMethodLater(countVotesDownDelay, reqCountVotesDown,
                                  "countVotesDownTask")
            celebrateDelay += countVotesUpTime + \
                              (self.maxVotes * COUNT_DOWN_RATE) + DELAY_AFTER_COUNT_DOWN

        # transition to the purchase after the countup is finished
        def reqPurchase(state):
            self.fsm.request("purchase")
            return Task.done

        purchaseDelay = (celebrateDelay + DELAY_AFTER_CELEBRATE)
        taskMgr.doMethodLater(purchaseDelay, reqPurchase, "purchase-trans")

        if base.skipMinigameReward:
            self.fsm.request('purchase')