Example #1
0
 def generate(self, gender, head, headtype, color, doId, name):
     gui = loader.loadModel("phase_3/models/gui/pick_a_toon_gui.bam")
     bg = gui.find('**/av-chooser_Square_UP')
     container = DirectFrame(relief=None, scale=0.3, parent=base.a2dTopLeft)
     container['image'] = bg
     container['image_color'] = self.frameColors[len(self.frameList)]
     container.setPos(self.framePositions[len(self.frameList)])
     headframe = container.attachNewNode('head')
     headframe.setPosHprScale(0, 5, -0.1, 180, 0, 0, 0.24, 0.24, 0.24)
     toon = ToonHead(None)
     toon.generateHead(gender, head, headtype)
     r, g, b = color
     color = (r, g, b, 1.0)
     toon.setHeadColor(color)
     toon.setDepthWrite(1)
     toon.setDepthTest(1)
     toon.reparentTo(headframe)
     nameLbl = DirectLabel(text=name,
                           text_wordwrap=7.0,
                           parent=container,
                           text_scale=0.13,
                           text_fg=(1, 1, 1, 1),
                           text_shadow=(0, 0, 0, 1),
                           relief=None,
                           pos=(0, 0, 0.25))
     cardCount = DirectLabel(text="0",
                             parent=container,
                             text_scale=0.15,
                             text_fg=(1, 1, 1, 1),
                             text_shadow=(0, 0, 0, 1),
                             relief=None,
                             pos=(0.26, 0, -0.28))
     self.frameList.append(container)
     self.doId2Frame[doId] = tuple(
         (container, headframe, toon, nameLbl, cardCount))
    def generateOtherPlayerGui(self):
        for avId in self.doId2Frame.keys():
            self.avId2otherPlayerAvIds2otherPlayerHeadsFrame[avId] = {}
            headNumber = -1
            frame = self.doId2Frame[avId][0]
            otherPlayerHeadsFrame = DirectFrame(relief=None,
                                                scale=0.85,
                                                parent=frame)
            otherPlayerHeadsFrame['image'] = frame['image']
            otherPlayerHeadsFrame['image_color'] = frame['image_color']
            otherPlayerHeadsFrame[
                'image_scale'] = self.otherPlayerHeadHolderTransforms['scale']
            otherPlayerHeadsFrame.setPos(
                self.otherPlayerHeadHolderTransforms['pos'])
            otherPlayerHeadsFrame.setBin('gui-popup', 70)
            self.frameList.append(otherPlayerHeadsFrame)
            for otherAvId in self.doId2Frame.keys():
                if otherAvId != avId:
                    headNumber += 1
                    otherAv = base.cr.doId2do.get(otherAvId)
                    gender = otherAv.getGender()
                    head, color = otherAv.getHeadStyle()
                    animal = otherAv.getAnimal()

                    headFrame = otherPlayerHeadsFrame.attachNewNode(
                        'otherPlayerHeadFrame')
                    headFrame.setPosHprScale(
                        self.otherPlayerHeadXValues[headNumber], 5, -0.1, 180,
                        0, 0, 0.2, 0.2, 0.2)
                    headFrame.setColorScale(self.state2Color[0])
                    toon = ToonHead(None)
                    toon.generateHead(gender, animal, head)
                    r, g, b, _ = color
                    color = (r, g, b, 1.0)
                    toon.setHeadColor(color)
                    toon.setDepthWrite(1)
                    toon.setDepthTest(1)
                    toon.reparentTo(headFrame)

                    self.avId2otherPlayerAvIds2otherPlayerHeadsFrame[avId][
                        otherAvId] = headFrame
Example #3
0
 def generate(self, gender, head, headtype, color, doId, name):
     gui = loader.loadModel("phase_3/models/gui/pick_a_toon_gui.bam")
     bg = gui.find("**/av-chooser_Square_UP")
     container = DirectFrame(relief=None, scale=0.3, parent=base.a2dTopLeft)
     container["image"] = bg
     container["image_color"] = self.frameColors[len(self.frameList)]
     container.setPos(self.framePositions[len(self.frameList)])
     headframe = container.attachNewNode("head")
     headframe.setPosHprScale(0, 5, -0.1, 180, 0, 0, 0.24, 0.24, 0.24)
     toon = ToonHead(None)
     toon.generateHead(gender, head, headtype)
     r, g, b = color
     color = (r, g, b, 1.0)
     toon.setHeadColor(color)
     toon.setDepthWrite(1)
     toon.setDepthTest(1)
     toon.reparentTo(headframe)
     nameLbl = DirectLabel(
         text=name,
         text_wordwrap=7.0,
         parent=container,
         text_scale=0.13,
         text_fg=(1, 1, 1, 1),
         text_shadow=(0, 0, 0, 1),
         relief=None,
         pos=(0, 0, 0.25),
     )
     cardCount = DirectLabel(
         text="0",
         parent=container,
         text_scale=0.15,
         text_fg=(1, 1, 1, 1),
         text_shadow=(0, 0, 0, 1),
         relief=None,
         pos=(0.26, 0, -0.28),
     )
     self.frameList.append(container)
     self.doId2Frame[doId] = tuple((container, headframe, toon, nameLbl, cardCount))
     return
Example #4
0
 def generate(self, gender, head, headtype, color, doId, name, valueLabel = 1):
     gui = loader.loadModel('phase_3/models/gui/pick_a_toon_gui.bam')
     bg = gui.find('**/av-chooser_Square_UP')
     container = DirectFrame(relief=None, scale=0.3, parent=base.a2dTopLeft)
     container['image'] = bg
     container['image_color'] = self.frameColors[len(self.frameList)]
     container.setBin('gui-popup', 60)
     container.setPos(self.framePositions[len(self.frameList)])
     headframe = container.attachNewNode('head')
     headframe.setPosHprScale(0, 5, -0.1, 180, 0, 0, 0.24, 0.24, 0.24)
     toon = ToonHead(None)
     toon.generateHead(gender, head, headtype)
     r, g, b = color
     color = (r,
      g,
      b,
      1.0)
     toon.setHeadColor(color)
     toon.setDepthWrite(1)
     toon.setDepthTest(1)
     toon.reparentTo(headframe)
     nameLbl = DirectLabel(text=name, text_wordwrap=7.0, parent=container, text_scale=0.13, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), relief=None, pos=(0, 0, 0.25))
     if valueLabel:
         someValueToBroadcast = DirectLabel(text='0', parent=container, text_scale=0.15, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), relief=None, pos=(0.26, 0, -0.28))
     self.frameList.append(container)
     if valueLabel:
         self.doId2Frame[doId] = tuple((container,
          headframe,
          toon,
          nameLbl,
          someValueToBroadcast))
     else:
         self.doId2Frame[doId] = tuple((container,
          headframe,
          toon,
          nameLbl))
     return
Example #5
0
    def generateOtherPlayerGui(self):
        for avId in self.doId2Frame.keys():
            self.avId2otherPlayerAvIds2otherPlayerHeadsFrame[avId] = {}
            headNumber = -1
            frame = self.doId2Frame[avId][0]
            otherPlayerHeadsFrame = DirectFrame(relief=None, scale=0.85, parent=frame)
            otherPlayerHeadsFrame['image'] = frame['image']
            otherPlayerHeadsFrame['image_color'] = frame['image_color']
            otherPlayerHeadsFrame['image_scale'] = self.otherPlayerHeadHolderTransforms['scale']
            otherPlayerHeadsFrame.setPos(self.otherPlayerHeadHolderTransforms['pos'])
            otherPlayerHeadsFrame.setBin('gui-popup', 70)
            self.frameList.append(otherPlayerHeadsFrame)
            for otherAvId in self.doId2Frame.keys():
                if otherAvId != avId:
                    headNumber += 1
                    otherAv = base.cr.doId2do.get(otherAvId)
                    gender = otherAv.getGender()
                    head, color = otherAv.getHeadStyle()
                    animal = otherAv.getAnimal()
                    headFrame = otherPlayerHeadsFrame.attachNewNode('otherPlayerHeadFrame')
                    headFrame.setPosHprScale(self.otherPlayerHeadXValues[headNumber], 5, -0.1, 180, 0, 0, 0.2, 0.2, 0.2)
                    headFrame.setColorScale(self.state2Color[0])
                    toon = ToonHead(None)
                    toon.generateHead(gender, animal, head)
                    r, g, b, _ = color
                    color = (r,
                     g,
                     b,
                     1.0)
                    toon.setHeadColor(color)
                    toon.setDepthWrite(1)
                    toon.setDepthTest(1)
                    toon.reparentTo(headFrame)
                    self.avId2otherPlayerAvIds2otherPlayerHeadsFrame[avId][otherAvId] = headFrame

        return
 def __init__(self, mg, king, points):
     DirectFrame.__init__(self, parent=aspect2d)
     self.setBin('gui-popup', 60)
     self.mg = mg
     box = DGG.getDefaultDialogGeom()
     self.bg = OnscreenImage(image=box, color=(1, 1, 0.75, 1), scale=(1.9, 1.4,
                                                                      1.4), parent=self)
     toonFont = CIGlobals.getToonFont()
     minnieFont = CIGlobals.getMinnieFont()
     name = 'Nobody'
     if king:
         name = king.getName()
         self.kingId = king.doId
     else:
         king = base.localAvatar
         self.kingId = 0
     self.title = OnscreenText(text='%s is King!' % name, pos=(0, 0.5, 0), font=toonFont, scale=0.12, parent=self, shadow=(0.5,
                                                                                                                           0.5,
                                                                                                                           0.5,
                                                                                                                           0.6))
     headFrame = self.attachNewNode('head')
     headFrame.setPosHprScale(0, 0, -0.1, 180, 0, 0, 0.3, 0.3, 0.3)
     toon = ToonHead(None)
     toon.generateHead(king.getGender(), king.getAnimal(), king.getHead())
     r, g, b, a = king.getHeadColor()
     color = (r, g, b, a)
     toon.setHeadColor(color)
     toon.setDepthWrite(1)
     toon.setDepthTest(1)
     toon.reparentTo(headFrame)
     self.amt_label = OnscreenText(text='Your Points: 0', pos=(-0.012, -0.4, 0), font=toonFont, scale=0.12, parent=self, shadow=(0.5,
                                                                                                                                 0.5,
                                                                                                                                 0.5,
                                                                                                                                 0.6))
     self.amt_label.hide()
     self.motivator = OnscreenText(text='Better luck next time!', pos=(0, -0.6,
                                                                       0), font=minnieFont, scale=0.125, parent=self, fg=(1,
                                                                                                                          0,
                                                                                                                          0,
                                                                                                                          1), shadow=(0.2,
                                                                                                                                      0.2,
                                                                                                                                      0.2,
                                                                                                                                      1))
     self.motivator.hide()
     self.easterEgg = False
     if 50 < points != 100:
         self.motivator['fg'] = (0, 1, 0, 1)
         self.motivator.setText('Great job!')
     else:
         if points == 100:
             self.motivator['fg'] = (0, 1, 0, 1)
             if random.randint(0, 100) <= 10:
                 self.motivator.setText('YOU THE REAL MVP!')
                 self.easterEgg = True
             else:
                 self.motivator.setText('AMAZING!')
     self.zeroPointsSfx = loader.loadSfx('phase_4/audio/sfx/MG_neg_buzzer.ogg')
     self.poorScoreSfx = loader.loadSfx('phase_4/audio/sfx/MG_sfx_travel_game_no_bonus.ogg')
     self.goodScoreSfx = loader.loadSfx('phase_4/audio/sfx/MG_pairing_match_bonus_both.ogg')
     self.stomperSfx = loader.loadSfx('phase_4/audio/sfx/CHQ_FACT_stomper_small.ogg')
     self.fireworkSfx = loader.loadSfx('phase_4/audio/sfx/firework_explosion_02.ogg')
     self.perfectSfx = loader.loadSfx('phase_5/audio/sfx/SZ_MM_fanfare.ogg')
     self.tick_fastSfx = loader.loadSfx('phase_4/audio/sfx/MG_maze_pickup.ogg')
     self.tick_slowSfx = loader.loadSfx('phase_3.5/audio/sfx/tick_counter.ogg')
     self.easterEggSfx = loader.loadSfx('phase_4/audio/sfx/avatar_emotion_very_sad.ogg')
     self.pointsSeq = Sequence(Func(self.amt_label.show), Wait(0.25))
     self.seqLevel = 0
     self.fakeNumber = 0
     self.points = points
     return