def createGame(self): self.canCall = False self.tileSeed = None self.typeId = None self.cardId += 1 for spot in self.pond.spots: avId = self.pond.spots[spot].avId request = RequestCard.get(avId) if request: self.typeId, self.tileSeed = request del RequestCard[avId] if self.cardId > 65535: self.cardId = 0 if not self.tileSeed: self.tileSeed = random.randrange(0, 65535) if self.typeId == None: self.typeId = random.randrange(0, 4) if self.typeId == BingoGlobals.NORMAL_CARD: self.bingoCard = NormalBingo() elif self.typeId == BingoGlobals.DIAGONAL_CARD: self.bingoCard = DiagonalBingo() elif self.typeId == BingoGlobals.THREEWAY_CARD: self.bingoCard = ThreewayBingo() elif self.typeId == BingoGlobals.FOURCORNER_CARD: self.bingoCard = FourCornerBingo() else: self.bingoCard = BlockoutBingo() self.bingoCard.generateCard(self.tileSeed, self.pond.getArea()) self.sendCardStateUpdate() self.b_setJackpot(BingoGlobals.getJackpot(self.typeId)) self.state = 'Playing' self.sendStateUpdate() taskMgr.doMethodLater(BingoGlobals.getGameTime(self.typeId), DistributedPondBingoManagerAI.finishGame, 'finishGame%d' % self.getDoId(), [self])
def enterPlaying(self, timeStamp): self.notify.debug('enterPlaying: Enter Playing State') self.lastCatch = None session = BingoGlobals.getGameTime(self.typeId) time = session - globalClockDelta.localElapsedTime(timeStamp[0]) self.card.startGameCountdown(time) self.card.enableCard(self.checkForUpdate) return
def __generateCard(self): self.notify.debug('__generateCard: %s' % self.typeId) if self.card.getGame(): self.card.removeGame() game = self.__cardChoice() game.setGameState(self.initGameState) self.card.addGame(game) self.card.generateCard(self.tileSeed, self.pond.getArea()) color = BingoGlobals.getColor(self.typeId) self.card.setProp('image_color', VBase4(color[0], color[1], color[2], color[3])) color = BingoGlobals.getButtonColor(self.typeId) self.card.bingo.setProp('image_color', VBase4(color[0], color[1], color[2], color[3])) if self.hasEntered: self.card.loadCard() self.card.show() else: self.card.hide()
def setCardState(self, cardId, typeId, tileSeed, gameState): self.cardId = cardId self.typeId = typeId self.tileSeed = tileSeed self.jackpot = BingoGlobals.getJackpot(typeId) self.initGameState = gameState