def __generateCard(self): self.notify.debug("__generateCard: %s" % self.typeId) # A card has already been generated, but we are # moving on to a new card at this point. We must # delete the reference to the old card before generating # a reference to the new card. if self.card.getGame(): self.card.removeGame() # Generate the new game and update the card gui. 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 createGame(self): self.canCall = False self.tileSeed = None self.typeId = None self.cardId += 1 for spot in self.pond.spots.itervalues(): request = RequestCard.get(spot.avId) if request: self.typeId, self.tileSeed = request del RequestCard[spot.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 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)
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 enterPlaying(self): self.notify.debug("enterPlaying: Enter Playing State in zone %s" % (self.zoneId)) self.timeStamp = globalClockDelta.getRealNetworkTime() self.__startTimeout(self.uniqueName('GameTimer-%s'%(self.doId)), self.__handleDefaultTimeout, BingoGlobals.getGameTime(self.typeId), ['GameOver']) # Change the client state for each player # participating in the game. for id in list(self.avId2Fish.keys()): # Reset Fish for each player in the game. self.avId2Fish[id] = (None, None) self.d_setState(id, 'Playing')
def generateCard(self): if self.card: self.card.destroy() del self.card self.tileSeed = RandomNumGen.randHash(globalClock.getRealTime()) # Determine whether the next game should be a super game. If # we are coming out of an intermission, then it will be a # super game. These occur each hour on the hour, and for the # last game of the evening. if self.nextGameSuper: self.notify.info("generateCard: SUPER CARD GENERATION") self.typeId = BingoGlobals.BLOCKOUT_CARD self.jackpot = self.air.bingoMgr.getSuperJackpot(self.zoneId) # If this was an hourly super jackpot, not the final game of the # evening, reset so that we don't go into another intermission # at the end of this game. Otherwise, we want to transition # to the CloseEvent state after the game has ended, either by # a win or "loss." if self.finalGame == BG.INTERMISSION: self.finalGame = BG.NORMAL_GAME self.nextGameSuper = False else: rng = RandomNumGen.RandomNumGen(self.tileSeed) self.typeId = rng.randint(BingoGlobals.NORMAL_CARD, BingoGlobals.THREEWAY_CARD) self.jackpot = BingoGlobals.getJackpot(self.typeId) self.card = self.__cardChoice() self.card.generateCard(self.tileSeed, self.pond.getArea()) self.cardId += 1 self.numMarkedCells= 0 self.maxPlayers = len(self.avId2Fish)
def setCardState(self, cardId, typeId, tileSeed, gameState): self.cardId = cardId self.typeId = typeId self.tileSeed = tileSeed self.jackpot = BingoGlobals.getJackpot(typeId) self.initGameState = gameState