Beispiel #1
0
    def __init__(self, maxHandCards):
        DirectFrame.__init__(self, parent=base.a2dBackground, relief=DGG.FLAT)
        self.initialiseoptions(PokerStatusPanel)
        self.arrow = loader.loadModel('models/gui/compass_arrow')
        self.arrow.reparentTo(self)
        self.arrow.setScale(0.25)
        self.arrow.setPosHpr(0, 0, 0.15, 0, 0, 180)
        self.arrow.hide()
        self.hand = []
        self.cardScaler = self.attachNewNode('cardScaler')
        self.cardScaler.setScale(0.5)
        for i in range(maxHandCards):
            left = 0.06 * maxHandCards * 0.5
            card = PlayingCard.PlayingCardNodePath('standard',
                                                   PlayingCardGlobals.Unknown)
            card.reparentTo(self.cardScaler)
            card.setPos(i * 0.06 - left, 0, 0)
            card.hide()
            self.hand.append(card)

        self.actionLabel = DirectLabel(parent=self,
                                       relief=None,
                                       text='',
                                       text_align=TextNode.ACenter,
                                       text_scale=0.04,
                                       pos=(0, 0, 0.15),
                                       text_fg=(1, 1, 1, 1),
                                       text_shadow=(0, 0, 0, 1))
        self.handNameLabel = DirectLabel(parent=self,
                                         relief=None,
                                         text='',
                                         text_align=TextNode.ACenter,
                                         text_scale=0.04,
                                         pos=(0, 0, -0.13),
                                         text_fg=(1, 1, 1, 1),
                                         text_shadow=(0, 0, 0, 1))
        self.dealerButton = loader.loadModel('models/gui/dealer_button')
        self.dealerButton.reparentTo(self)
        self.dealerButton.setPos(-0.12, 0, 0)
        self.dealerButton.setScale(0.08)
        self.dealerButton.hide()
        self.anteLabel = DirectLabel(parent=self.dealerButton,
                                     relief=None,
                                     text='',
                                     text_align=TextNode.ACenter,
                                     text_scale=0.8,
                                     pos=(0, 0, -0.3),
                                     text_fg=(0, 0, 0, 1))
        self.anteLabel.setColor(0, 0, 0, 1, 100)
        self.actionLabel.setTransparency(1)
        self.fadeActionLabel = Sequence(
            Func(self.actionLabel.show),
            LerpColorScaleInterval(self.actionLabel, 0.1, Vec4(1, 1, 1, 1),
                                   Vec4(1, 1, 1, 0)), Wait(2.0),
            LerpColorScaleInterval(self.actionLabel, 1.0, Vec4(1, 1, 1, 0),
                                   Vec4(1, 1, 1, 1)),
            Func(self.actionLabel.hide))
        self.handId = PlayingCardGlobals.Nothing
        self.sortedCards = None
        return
Beispiel #2
0
 def suitImage(self, suit):
     card = PlayingCard.PlayingCardNodePath('standard', PlayingCardGlobals.Unknown)
     card.setScale(0.25)
     card.setValue(suit * 13)
     card.turnUp()
     card.show()
     return card
Beispiel #3
0
    def createSplitDisplay(self, seat, allHands, parent):
        self.deleteSplitDisplay(parent)
        handArray = allHands[seat]
        total_hands = len(handArray)
        if total_hands > 1:
            current_hand_index = self.table.getCurrentHandIndex(seat, allHands)
            x_increment = 0.24
            x_size = (total_hands - 1) * x_increment
            x = -x_size * 0.5
            y = -0.16
            card_y = -0.05
            for h in range(total_hands):
                hand = handArray[h]
                value = PlayingCardGlobals.getBlackjackHandValue(hand)
                scale = 0.375
                length = len(hand)
                card_x_increment = 0.06
                left = card_x_increment * scale * length * -0.5
                for i in range(length):
                    card = PlayingCard.PlayingCardNodePath(
                        'standard', PlayingCardGlobals.Unknown)
                    card.reparentTo(parent)
                    card.setPos(x + left + i * (card_x_increment * scale), 0,
                                card_y)
                    card.setScale(scale)
                    card.setValue(hand[i])
                    card.turnUp()
                    card.show()
                    parent.cardArray.append(card)
                    if h == current_hand_index:
                        color = 1.0
                        card.setColor(color, color, color, 1.0)
                    else:
                        color = 0.6
                        card.setColor(color, color, color, 1.0)

                label = DirectLabel(parent=parent,
                                    relief=None,
                                    text='',
                                    text_align=TextNode.ACenter,
                                    text_scale=0.04,
                                    pos=(x, 0.0, y),
                                    text_fg=(1, 1, 1, 1),
                                    text_shadow=(0, 0, 0, 1))
                label['text'] = str(value)
                label.show()
                parent.labelArray.append(label)
                x += x_increment

        return
 def layerOpen(self):
     if self.currentLayer == self.numLayers:
         self.toolState = LockGlobals.LSTATE_OPEN
         self.timer.stop()
         base.playSfx(self.unlockSound)
         avId = base.localAvatar.getDoId()
         self.table.sendUpdate('d_openLock', [base.localAvatar.name, avId])
     else:
         self.toolState = LockGlobals.LSTATE_RESET
         base.playSfx(self.unlockSound)
         self.lockXPos = LockGlobals.NewXPos
         self.lockZPos = LockGlobals.NewZPos
         self.layerXPos = LockGlobals.LockXPos
         self.layerZPos = LockGlobals.LockZPos
         self.currentLayer += 1
         self.lockImage[
             self.currentLayer] = PlayingCard.PlayingCardNodePath(
                 'standard', 13 + self.lockMech)
         self.lockImage[self.currentLayer].reparentTo(self.mechNode)
         self.lockImage[self.currentLayer].setPos(LockGlobals.NewXPos, 0,
                                                  LockGlobals.NewZPos)
         self.setLockMech(random.randint(0, LockGlobals.MaxTool))
         self.lockImage[self.currentLayer].show()
 def __init__(self, table, avId, difficulty=10):
     DirectFrame.__init__(self, relief=None)
     self.initialiseoptions(LockGUI)
     self.table = table
     self.difficulty = difficulty
     self.numLayers = difficulty / 10
     if self.numLayers < 1:
         self.numLayers = 1
     if self.numLayers > 6:
         self.numLayers = 6
     self.currentLayer = 1
     self.mechVal = 0
     self.lockMech = 0
     self.mechZPos = LockGlobals.StartZPos
     self.mechXPos = LockGlobals.StartXPos
     self.lockZPos = LockGlobals.LockZPos
     self.lockXPos = LockGlobals.LockXPos
     self.layerZPos = LockGlobals.LockZPos
     self.layerXPos = LockGlobals.LockXPos
     self.mechDir = 1
     self.lockSpeed = LockGlobals.StartSpeed
     self.lockSpeed += self.difficulty / 50
     self.toolState = LockGlobals.LSTATE_ACTIVE
     self.unlockSound = loadSfx(SoundGlobals.SFX_LOCKPICK_SUCCESS)
     self.missSound = loadSfx(SoundGlobals.SFX_LOCKPICK_FAIL)
     self.trySound = loadSfx(SoundGlobals.SFX_LOCKPICK_TRY)
     self.layerModel = loader.loadModel('models/props/Keys')
     print 'Found ', self.layerModel
     self.layerImage = self.layerModel.find('**/Lock_L')
     print 'Found ', self.layerImage
     self.layerImage.reparentTo(self)
     self.layerImage.setPos(0, 50, 0)
     self.layerImage.setScale(1.0)
     self.layerImage.show()
     self.mechLabel = DirectLabel(parent=self,
                                  relief=None,
                                  text=PLocalizer.LockMechanism,
                                  text_align=TextNode.ALeft,
                                  text_scale=0.09,
                                  pos=(-0.4, 0, -0.7),
                                  text_fg=(1, 0.9, 0.6, 1),
                                  text_shadow=(0, 0, 0, 1))
     self.mechNode = self.attachNewNode('mechNode')
     self.mechNode.setScale(0.5)
     self.mechNode.setPos(0, 0, 0.2)
     self.mechImage = PlayingCard.PlayingCardNodePath('standard', 13)
     self.mechImage.reparentTo(self.mechNode)
     self.mechImage.setPos(0.6, 0, -1.72)
     self.mechImage.show()
     self.mechTool = PlayingCard.PlayingCardNodePath('standard', 13)
     self.mechTool.reparentTo(self.mechNode)
     self.mechTool.setPos(self.mechXPos, 0, self.mechZPos)
     self.mechTool.show()
     self.lockImage = {}
     self.lockImage[self.currentLayer] = PlayingCard.PlayingCardNodePath(
         'standard', 13)
     self.lockImage[self.currentLayer].reparentTo(self.mechNode)
     self.lockImage[self.currentLayer].setPos(LockGlobals.LockXPos, 0,
                                              LockGlobals.LockZPos)
     self.setLockMech(random.randint(0, LockGlobals.MaxTool))
     self.lockImage[self.currentLayer].show()
     self.mechLeftButton = DirectButton(
         parent=self,
         relief=DGG.RAISED,
         text='<',
         text_align=TextNode.ACenter,
         text_scale=0.05,
         text_pos=(0.02, 0.01),
         text_fg=(0, 0, 0, 1),
         text_shadow=PiratesGuiGlobals.TextShadow,
         textMayChange=0,
         frameColor=PiratesGuiGlobals.ButtonColor2,
         borderWidth=PiratesGuiGlobals.BorderWidthSmall,
         frameSize=(0, 0.05, 0, 0.05),
         pos=(0.13, 0, -0.7),
         command=self.table.guiCallback,
         extraArgs=[LockGlobals.LGUI_MECHLEFT])
     self.mechRightButton = DirectButton(
         parent=self,
         relief=DGG.RAISED,
         text='>',
         text_align=TextNode.ACenter,
         text_scale=0.05,
         text_pos=(0.02, 0.01),
         text_fg=(0, 0, 0, 1),
         text_shadow=PiratesGuiGlobals.TextShadow,
         textMayChange=0,
         frameColor=PiratesGuiGlobals.ButtonColor2,
         borderWidth=PiratesGuiGlobals.BorderWidthSmall,
         frameSize=(0, 0.05, 0, 0.05),
         pos=(0.42, 0, -0.7),
         command=self.table.guiCallback,
         extraArgs=[LockGlobals.LGUI_MECHRIGHT])
     self.timer = PiratesTimer.PiratesTimer()
     self.timer.posInTopRightCorner()
     self.timer.show()
     self.timer.countdown(60, self.gameTimerExpired)
     return
Beispiel #6
0
    def __init__(self, maxHandCards):
        DirectFrame.__init__(self, parent=base.a2dBackground, relief=DGG.FLAT)
        self.initialiseoptions(BlackjackStatusPanel)
        self.arrow = loader.loadModel('models/gui/compass_arrow')
        self.arrow.reparentTo(self)
        self.arrow.setScale(0.25)
        self.arrow.setPosHpr(0, 0, 0.26000000000000001, 0, 0, 180)
        self.arrow.hide()
        self.hand = []
        self.cardScaler = self.attachNewNode('cardScaler')
        self.cardScaler.setScale(0.5)
        for i in range(maxHandCards):
            left = 0.059999999999999998 * maxHandCards * 0.5
            card = PlayingCard.PlayingCardNodePath('standard',
                                                   PlayingCardGlobals.Unknown)
            card.reparentTo(self.cardScaler)
            card.setPos(i * 0.059999999999999998 - left, 0, 0)
            card.hide()
            self.hand.append(card)

        self.actionLabel = DirectLabel(parent=self,
                                       relief=None,
                                       text='',
                                       text_align=TextNode.ACenter,
                                       text_scale=0.040000000000000001,
                                       pos=(0, 0, 0.14999999999999999),
                                       text_fg=(1, 1, 1, 1),
                                       text_shadow=(0, 0, 0, 1))
        self.handNameLabel = DirectLabel(parent=self,
                                         relief=None,
                                         text='',
                                         text_align=TextNode.ACenter,
                                         text_scale=0.040000000000000001,
                                         pos=(0, 0, -0.13),
                                         text_fg=(1, 1, 1, 1),
                                         text_shadow=(0, 0, 0, 1))
        self.splitLabel = DirectLabel(parent=self,
                                      relief=None,
                                      text='',
                                      text_align=TextNode.ACenter,
                                      text_scale=0.040000000000000001,
                                      pos=(0, 0, -0.17000000000000001),
                                      text_fg=(1, 1, 1, 1),
                                      text_shadow=(0, 0, 0, 1))
        self.handsLabel = DirectLabel(parent=self,
                                      relief=None,
                                      text='',
                                      text_align=TextNode.ACenter,
                                      text_scale=0.040000000000000001,
                                      pos=(0, 0, -0.20999999999999999),
                                      text_fg=(1, 1, 1, 1),
                                      text_shadow=(0, 0, 0, 1))
        self.handsLabel.cardArray = []
        self.handsLabel.labelArray = []
        self.actionLabel.setTransparency(1)
        self.fadeActionLabel = Sequence(
            Func(self.actionLabel.show),
            LerpColorScaleInterval(self.actionLabel, 0.10000000000000001,
                                   Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 0)),
            Wait(3.0),
            LerpColorScaleInterval(self.actionLabel, 0.5, Vec4(1, 1, 1, 0),
                                   Vec4(1, 1, 1, 1)),
            Func(self.actionLabel.hide))
Beispiel #7
0
    def __init__(self, table, maxCommunityCards, maxHandCards):
        DirectFrame.__init__(self, parent=base.a2dBackground, relief=None)
        self.initialiseoptions(PokerTableGUI)
        self.maxCommunityCards = maxCommunityCards
        self.maxHandCards = maxHandCards
        self.maxBet = 0
        self.numberOfTimeouts = 0
        self.table = table
        self.destroyed = False
        self.playerActions = []
        width = 1.0
        self.menu = BorderFrame(parent=base.a2dBottomCenter,
                                frameSize=(-width / 2.0, width / 2.0, 0, 0.25),
                                pos=(0, 0, 0))
        self.disableReason = DirectLabel(
            parent=self.menu,
            text='',
            text_align=TextNode.ACenter,
            text_scale=0.04,
            pos=(0, 0, 0.175),
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=1)
        self.disableReason.hide()
        self.initializeTableInterface()
        x = -0.36
        y = 0.1775
        x_increment = 0.24
        helpText = PLocalizer.TableCardsHelp
        helpPos = (0.0, 0.0, 0.24)
        text = PLocalizer.PokerCheat1
        button = GuiButton(parent=self.menu,
                           command=self.cardIndexSelection,
                           helpText=helpText,
                           helpPos=helpPos,
                           pos=(x, 0, y),
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.Cheat1])
        self.cheat1Button = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        text = PLocalizer.PokerCheat2
        button = GuiButton(parent=self.menu,
                           command=self.cardIndexSelection,
                           helpText=helpText,
                           helpPos=helpPos,
                           pos=(x, 0, y),
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.Cheat2])
        self.cheat2Button = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        text = PLocalizer.PokerCheck
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.CheckCall])
        self.passButton = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        text = PLocalizer.PokerBet
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.BetRaise])
        self.betButton = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        x = -0.36
        y = 0.07
        x_increment = 0.24
        x = x + x_increment
        x = x + x_increment
        x = x + x_increment
        text = PLocalizer.PokerFold
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Fold])
        self.foldButton = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        self.potSizeLabel = DirectLabel(parent=self,
                                        relief=None,
                                        text='',
                                        text_align=TextNode.ACenter,
                                        text_scale=0.05,
                                        pos=(-0.15, 0.0, 0.17),
                                        text_fg=(1, 0.9, 0.6, 1),
                                        text_shadow=(0, 0, 0, 1))
        if table.wantMeter == 1:
            cardMaker = CardMaker('tellMeter')
            cardMaker.setFrame(-1, 1, -1, 1)
            self.meterMax = 0.2
            self.meterBorder = NodePath(cardMaker.generate())
            self.meterBorder.setColor(1, 1, 0, 1)
            self.meterBorder.setScale(0.2, 1, 0.02)
            self.meterBorder.reparentTo(aspect2d)
            self.meter = NodePath(cardMaker.generate())
            self.meter.setColor(1, 0, 0, 1)
            self.meter.setScale(0.2, 1, 0.05)
            self.meter.reparentTo(aspect2d)
        if table.wantMeter == 2:
            cardMaker = CardMaker('tellMeter')
            cardMaker.setFrame(-1, 1, -1, 1)
            self.balance = NodePath('Balance')
            self.balance.reparentTo(aspect2d)
            self.balanceL = NodePath(cardMaker.generate())
            self.balanceL.setColor(1, 0, 0, 1)
            self.balanceL.setScale(0.125, 1, 0.01)
            self.balanceL.setPos(-0.125, 0, 0)
            self.balanceL.reparentTo(self.balance)
            self.balanceR = NodePath(cardMaker.generate())
            self.balanceR.setColor(0, 1, 0, 1)
            self.balanceR.setScale(0.125, 1, 0.01)
            self.balanceR.setPos(0.125, 0, 0)
            self.balanceR.reparentTo(self.balance)
            self.fulcrum = loader.loadModel('models/props/winebottle_B')
            self.fulcrum.setScale(0.2)
            self.fulcrum.setZ(-0.21)
            self.fulcrum.reparentTo(aspect2d)
            self.weightR = NodePath(cardMaker.generate())
            self.weightR.setColor(0, 0, 1, 1)
            self.weightR.setScale(0.03, 1, 0.05)
            self.weightR.setPos(0.22, 0, 0.06)
            self.weightR.reparentTo(self.balance)
            self.weightL = NodePath(cardMaker.generate())
            self.weightL.setColor(0, 0, 1, 1)
            self.weightL.setScale(0.03, 1, 0.05)
            self.weightL.setPos(-0.22, 0, 0.06)
            self.weightL.reparentTo(self.balance)
            self.balance.hide()
            self.fulcrum.hide()
        self.communityCardNode = NodePath('communityCards')
        self.communityCardNode.reparentTo(self)
        self.communityCardNode.setScale(0.5)
        self.communityCardNode.setPos(0, 0, 0.04)
        self.communityCards = []
        for i in range(self.maxCommunityCards):
            card = PlayingCard.PlayingCardNodePath('standard',
                                                   PlayingCardGlobals.Unknown)
            card.reparentTo(self.communityCardNode)
            card.setPos(i * 0.3 - 0.6, 0, 0)
            card.hide()
            self.communityCards.append(card)

        self.playerStatusPanels = []
        for i in range(self.table.NumSeats + 1):
            statusPanel = PokerStatusPanel(self.maxHandCards)
            statusPanel.setName('playerHand-%s' % i)
            pos = self.HandPos[i]
            statusPanel.setPos(pos)
            self.playerStatusPanels.append(statusPanel)

        self.localStatusPanel = self.playerStatusPanels[
            self.LocalAvatarGuiIndex]
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32
        currentMoney = self.table.getPlayerChips()
        x_increment = 0.24
        self.moneyDisplay = DirectLabel(
            parent=self.menu,
            relief=None,
            pos=(-0.3 + x_increment, 0, 0.075),
            geom=goldCoin,
            geom_scale=(scale, scale, scale),
            geom_pos=(0, 0, 0),
            text='%s' % currentMoney,
            text_align=TextNode.ALeft,
            text_scale=0.04,
            text_pos=(0.05, -0.01),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=1,
            scale=1.1)
        self.accept(
            InventoryGlobals.getCategoryQuantChangeMsg(
                localAvatar.getInventoryId(), InventoryType.ItemTypeMoney),
            self.setMoney)
        this = self
        identifier = 0
        this.sfxArray = []
        this.shuffleIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_SHUFFLE)
        ]
        identifier += 1
        this.startDealIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_01)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_02)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_03)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_04)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_05)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_06)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_07)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_08)
        ]
        identifier += 1
        this.totalDealIdentifiers = identifier - this.startDealIdentifier
        this.foldIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FOLD)
        ]
        identifier += 1
        this.flipIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FLIP)
        ]
        identifier += 1
        this.pickupIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_PICKUP)
        ]
        identifier += 1
        this.checkIdentifier = identifier
        check = loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHECK)
        check.setVolume(0.5)
        this.sfxArray = this.sfxArray + [check]
        identifier += 1
        this.betIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_BET)
        ]
        identifier += 1
        this.collectIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_COLLECT)
        ]
        identifier += 1
        this.allInIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_ALL)
        ]
        identifier += 1
        return