def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.gameDuration = PairingGameGlobals.calcGameDuration(self.getDifficulty())
     self.gameBoard = loader.loadModel('phase_4/models/minigames/memory_room')
     self.gameBoard.setPosHpr(0.5, 0, 0, 0, 0, 0)
     self.gameBoard.setScale(1.0)
     self.deck = PairingGameGlobals.createDeck(self.deckSeed, self.numPlayers)
     self.notify.debug('%s' % self.deck.cards)
     testCard = self.getDeckOrderIndex(self.cardsPerCol - 1, 0)
     if not testCard > -1:
         self.yCardInc *= 1.25
     
     self.cards = []
     for index in xrange(len(self.deck.cards)):
         cardValue = self.deck.cards[index]
         oneCard = PairingGameCard.PairingGameCard(cardValue)
         oneCard.load()
         (xPos, yPos) = self.getCardPos(index)
         oneCard.setPos(xPos, yPos, 0)
         oneCard.reparentTo(render)
         self.notify.debug('%s' % oneCard.getPos())
         self.notify.debug('suit %s rank %s value %s' % (oneCard.suit, oneCard.rank, oneCard.value))
         self.accept('entercardCollision-%d' % oneCard.value, self.enterCard)
         self.accept('exitcardCollision-%d' % oneCard.value, self.exitCard)
         oneCard.turnDown(doInterval = False)
         self.cards.append(oneCard)
     
     self.bonusTraversal = range(len(self.cards))
     self.bonusGlow = render.attachNewNode('bonusGlow')
     sign = loader.loadModel('phase_4/models/minigames/garden_sign_memory')
     sign.find('**/sign1').removeNode()
     sign.find('**/sign2').removeNode()
     sign.find('**/collision').removeNode()
     sign.setPos(0, 0, 0.050000000000000003)
     sign.reparentTo(self.bonusGlow)
     self.bonusGlow.setScale(2.5)
     self.pointsFrame = DirectFrame(relief = None, geom = DGG.getDefaultDialogGeom(), geom_color = GlobalDialogColor, geom_scale = (4, 1, 1), pos = (-0.33000000000000002, 0, 0.90000000000000002), scale = 0.10000000000000001, text = TTLocalizer.PairingGamePoints, text_align = TextNode.ALeft, text_scale = TTLocalizer.DPGpointsFrame, text_pos = (-1.9399999999999999, -0.10000000000000001, 0.0))
     self.pointsLabel = DirectLabel(parent = self.pointsFrame, relief = None, text = '0', text_fg = VBase4(0, 0.5, 0, 1), text_align = TextNode.ARight, text_scale = 0.69999999999999996, pos = (1.8200000000000001, 0, -0.14999999999999999))
     self.flipsFrame = DirectFrame(relief = None, geom = DGG.getDefaultDialogGeom(), geom_color = GlobalDialogColor, geom_scale = (4, 1, 1), pos = (0.33000000000000002, 0, 0.90000000000000002), scale = 0.10000000000000001, text = TTLocalizer.PairingGameFlips, text_align = TextNode.ALeft, text_scale = TTLocalizer.DPGflipsFrame, text_pos = (-1.9399999999999999, -0.10000000000000001, 0.0))
     self.flipsLabel = DirectLabel(parent = self.flipsFrame, relief = None, text = '0', text_fg = VBase4(0, 1.0, 0, 1), text_align = TextNode.ARight, text_scale = 0.69999999999999996, pos = (1.8200000000000001, 0, -0.14999999999999999))
     self._DistributedPairingGame__textGen = TextNode('ringGame')
     self._DistributedPairingGame__textGen.setFont(ToontownGlobals.getSignFont())
     self._DistributedPairingGame__textGen.setAlign(TextNode.ACenter)
     self.sndPerfect = base.loadSfx('phase_4/audio/sfx/MG_pairing_all_matched.mp3')
     self.calcBonusTraversal()
     self.music = base.loadMusic('phase_4/audio/bgm/MG_Pairing.mid')
     self.matchSfx = base.loadSfx('phase_4/audio/sfx/MG_pairing_match.mp3')
     self.matchWithBonusSfx = base.loadSfx('phase_4/audio/sfx/MG_pairing_match_bonus_both.mp3')
     self.signalSfx = []
     for i in range(4):
         self.signalSfx.append(base.loadSfx('phase_4/audio/sfx/MG_pairing_jumping_signal.mp3'))
     
     self.bonusMovesSfx = base.loadSfx('phase_4/audio/sfx/MG_pairing_bonus_moves.mp3')
Пример #2
0
    def load(self):
        # load resources and create objects here
        self.notify.debug("load")
        DistributedMinigame.load(self)

        self.gameDuration = PairingGameGlobals.calcGameDuration(
            self.getDifficulty())

        #self.gameBoard = loader.loadModel("phase_4/models/minigames/toon_cannon_gameground")
        self.gameBoard = loader.loadModel(
            "phase_4/models/minigames/memory_room")
        self.gameBoard.setPosHpr(0.5, 0, 0, 0, 0, 0)
        self.gameBoard.setScale(1.0)
        #self.gameBoard.find('**/tree_ring').removeNode()

        #self.debugAxis = loader.loadModel('models/misc/xyzAxis')
        #self.debugAxis.reparentTo(self.gameBoard)
        self.deck = PairingGameGlobals.createDeck(self.deckSeed,
                                                  self.numPlayers)
        self.notify.debug('%s' % self.deck.cards)

        testCard = self.getDeckOrderIndex(self.cardsPerCol - 1, 0)
        if not testCard > -1:
            self.yCardInc *= 1.25

        self.cards = []

        for index in xrange(len(self.deck.cards)):
            cardValue = self.deck.cards[index]
            oneCard = PairingGameCard.PairingGameCard(cardValue)
            oneCard.load()
            xPos, yPos = self.getCardPos(index)
            oneCard.setPos(xPos, yPos, 0)
            oneCard.reparentTo(render)
            self.notify.debug('%s' % oneCard.getPos())
            self.notify.debug('suit %s rank %s value %s' %
                              (oneCard.suit, oneCard.rank, oneCard.value))
            self.accept('entercardCollision-%d' % oneCard.value,
                        self.enterCard)
            self.accept('exitcardCollision-%d' % oneCard.value, self.exitCard)
            oneCard.turnDown(doInterval=False)
            self.cards.append(oneCard)

        self.bonusTraversal = range(len(self.cards))

        self.bonusGlow = render.attachNewNode('bonusGlow')

        sign = loader.loadModel("phase_4/models/minigames/garden_sign_memory")
        # remove the bits we don't want
        sign.find('**/sign1').removeNode()
        sign.find('**/sign2').removeNode()
        sign.find('**/collision').removeNode()
        #sign.setTransparency(1)
        #sign.setColorScale(1,1,0,0.5)
        sign.setPos(0, 0, 0.05)
        sign.reparentTo(self.bonusGlow)

        self.bonusGlow.setScale(2.5)

        self.pointsFrame = DirectFrame(
            #parent = self.gui,
            relief=None,
            geom=DGG.getDefaultDialogGeom(),
            geom_color=GlobalDialogColor,
            geom_scale=(4, 1, 1),
            pos=(-0.33, 0, 0.9),
            scale=0.1,
            text=TTLocalizer.PairingGamePoints,
            text_align=TextNode.ALeft,
            text_scale=TTLocalizer.DPGpointsFrame,
            text_pos=(-1.94, -0.1, 0.0))
        self.pointsLabel = DirectLabel(
            parent=self.pointsFrame,
            relief=None,
            text='0',
            text_fg=VBase4(0, 0.5, 0, 1),
            text_align=TextNode.ARight,
            text_scale=0.7,
            pos=(1.82, 0, -0.15),
        )

        self.flipsFrame = DirectFrame(
            #parent = self.gui,
            relief=None,
            geom=DGG.getDefaultDialogGeom(),
            geom_color=GlobalDialogColor,
            geom_scale=(4, 1, 1),
            pos=(0.33, 0, 0.9),
            scale=0.1,
            text=TTLocalizer.PairingGameFlips,
            text_align=TextNode.ALeft,
            text_scale=TTLocalizer.DPGflipsFrame,
            text_pos=(-1.94, -0.1, 0.0))
        self.flipsLabel = DirectLabel(
            parent=self.flipsFrame,
            relief=None,
            text='0',
            text_fg=VBase4(0, 1.0, 0, 1),
            text_align=TextNode.ARight,
            text_scale=0.7,
            pos=(1.82, 0, -0.15),
        )

        # this will be used to generate textnodes
        self.__textGen = TextNode("ringGame")
        self.__textGen.setFont(ToontownGlobals.getSignFont())
        self.__textGen.setAlign(TextNode.ACenter)

        self.sndPerfect = base.loadSfx(
            "phase_4/audio/sfx/MG_pairing_all_matched.mp3")

        self.calcBonusTraversal()

        self.music = base.loadMusic("phase_4/audio/bgm/MG_Pairing.mid")
        self.matchSfx = base.loadSfx("phase_4/audio/sfx/MG_pairing_match.mp3")
        self.matchWithBonusSfx = base.loadSfx(
            "phase_4/audio/sfx/MG_pairing_match_bonus_both.mp3")
        self.signalSfx = []
        for i in range(4):
            self.signalSfx.append(
                base.loadSfx(
                    "phase_4/audio/sfx/MG_pairing_jumping_signal.mp3"))
        self.bonusMovesSfx = base.loadSfx(
            "phase_4/audio/sfx/MG_pairing_bonus_moves.mp3")