コード例 #1
0
    def setStacks(self, stackTypesAndQuantities):
        old = self.stacks
        self.stacks = dict(stackTypesAndQuantities)
        stacksInCategory = {}
        for t, q in stackTypesAndQuantities:
            if old.get(t, 0) != q:
                messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, t), [q])
            categoryId = InventoryId.getCategory(t)
            categoryList = stacksInCategory.setdefault(categoryId, {})
            categoryList[t] = self.stacks[t]

        self.stacksInCategory = stacksInCategory
    def setStacks(self, stackTypesAndQuantities):
        old = self.stacks
        self.stacks = dict(stackTypesAndQuantities)
        stacksInCategory = { }
        for (t, q) in stackTypesAndQuantities:
            if old.get(t, 0) != q:
                messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, t), [
                    q])

            categoryId = InventoryId.getCategory(t)
            categoryList = stacksInCategory.setdefault(categoryId, { })
            categoryList[t] = self.stacks[t]

        self.stacksInCategory = stacksInCategory
コード例 #3
0
 def stack(self, stackType, quantity):
     self.stacks[stackType] = quantity
     categoryId = InventoryId.getCategory(stackType)
     category = self.stacksInCategory.setdefault(categoryId, { })
     if quantity:
         category[stackType] = quantity
     else:
         category.pop(stackType, None)
     messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, stackType), [
         quantity])
     messenger.send(InventoryGlobals.getAnyChangeMsg(self.doId))
     if stackType == InventoryType.Vitae_Level and stackType == InventoryType.Vitae_Cost or stackType == InventoryType.Vitae_Left:
         localAvatar.guiMgr.gameGui.updateVitae(self.getStackQuantity(InventoryType.Vitae_Level), self.getStackQuantity(InventoryType.Vitae_Cost), self.getStackQuantity(InventoryType.Vitae_Left))
     
     if self.ownerId == localAvatar.getDoId():
         localAvatar.gotSpecialReward(stackType)
コード例 #4
0
 def stack(self, stackType, quantity):
     self.stacks[stackType] = quantity
     categoryId = InventoryId.getCategory(stackType)
     category = self.stacksInCategory.setdefault(categoryId, { })
     if quantity:
         category[stackType] = quantity
     else:
         category.pop(stackType, None)
     messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, stackType), [
         quantity])
     messenger.send(InventoryGlobals.getAnyChangeMsg(self.doId))
     if stackType == InventoryType.Vitae_Level and stackType == InventoryType.Vitae_Cost or stackType == InventoryType.Vitae_Left:
         localAvatar.guiMgr.gameGui.updateVitae(self.getStackQuantity(InventoryType.Vitae_Level), self.getStackQuantity(InventoryType.Vitae_Cost), self.getStackQuantity(InventoryType.Vitae_Left))
     
     if self.ownerId == localAvatar.getDoId():
         localAvatar.gotSpecialReward(stackType)
コード例 #5
0
    def __init__(self, table):
        DirectFrame.__init__(self, relief=None)
        self.initialiseoptions(BlackjackTableGUI)
        self.table = table
        self.destroyed = False
        self.maxHandCards = 14
        self.playerStatusPanels = []
        for i in range(self.table.NumSeats + 1):
            statusPanel = BlackjackStatusPanel(self.maxHandCards)
            statusPanel.setName('playerHand-%s' % i)
            pos = self.HandPos[i]
            statusPanel.setPos(pos)
            self.playerStatusPanels.append(statusPanel)

        self.localStatusPanel = self.playerStatusPanels[
            self.LocalAvatarGuiIndex]
        width = 1.0
        height = 0.25
        self.menu = BorderFrame(parent=base.a2dBottomCenter,
                                frameSize=(-width / 2.0, width / 2.0, 0,
                                           height),
                                pos=(0, 0, 0))
        self.width = width
        self.height = height
        self.initializeTableInterface()
        x = -0.36
        y = 0.1775
        x_increment = 0.24
        helpText = PLocalizer.TableCardsHelp
        helpPos = (0.0, 0.0, 0.24)
        text = PLocalizer.BlackjackCardSwap
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           helpText=helpText,
                           helpPos=helpPos,
                           pos=(x, 0, y),
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.CardSwap])
        button.show()
        self.cardSwapButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        text = PLocalizer.BlackjackDoubleDown
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.DoubleDown])
        button.show()
        self.doubleDownButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        text = PLocalizer.BlackjackStay
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Stay])
        button.show()
        self.stayButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        text = PLocalizer.BlackjackHit
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Hit])
        button.show()
        self.hitButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        x = -0.36
        y = 0.07
        x_increment = 0.24
        x += x_increment
        x += x_increment
        text = PLocalizer.BlackjackSplit
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Split])
        button.show()
        self.splitButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        bid = self.table.getTableBidAmount()
        text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Bid])
        button.show()
        self.bidButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment

        def bid_update_function(value):
            bid = self.sliderValueToBid(value)
            text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
            self.bidButton['text'] = text
            self.bidAmount = bid

        self.bidAmount = 2
        default_value = 0.0
        x = 0.0
        y = -0.25
        label = PLocalizer.BlackjackBid
        resolution = 1.0
        self.bidSlider = self.create_slider(bid_update_function, default_value,
                                            x, y, resolution, label, self.menu)
        x = -0.36
        y = 0.1775
        x_increment = 0.24
        text = PLocalizer.PokerCheat1
        button = GuiButton(parent=self.menu,
                           command=self.cardSwapButtonSelection,
                           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.cardSwapButtonSelection,
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.Cheat2])
        self.cheat2Button = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        self.hideCheatButtons()
        self.disableAllPlayButtons()
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32
        currentMoney = localAvatar.getInventory().getGoldInPocket()
        self.moneyDisplay = DirectLabel(
            parent=self.menu,
            relief=None,
            pos=(-0.3 + x_increment / 2.0, 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.035,
            text_pos=(0.045, -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.hitIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_HIT)
        ]
        identifier = identifier + 1
        self.hands = []
        self.splitCardsArray = []
        self.canSplit = False
        self.canDoubleDown = False
        self.bid = False
        return
コード例 #6
0
    def __init__(self, table):
        DirectFrame.__init__(self, relief = None)
        self.initialiseoptions(BlackjackTableGUI)
        self.table = table
        self.destroyed = False
        self.maxHandCards = 14
        self.playerStatusPanels = []
        for i in range(self.table.NumSeats + 1):
            statusPanel = BlackjackStatusPanel(self.maxHandCards)
            statusPanel.setName('playerHand-%s' % i)
            pos = self.HandPos[i]
            statusPanel.setPos(pos)
            self.playerStatusPanels.append(statusPanel)
        
        self.localStatusPanel = self.playerStatusPanels[self.LocalAvatarGuiIndex]
        width = 1.0
        height = 0.25
        self.menu = BorderFrame(parent = base.a2dBottomCenter, frameSize = (-width / 2.0, width / 2.0, 0, height), pos = (0, 0, 0))
        self.width = width
        self.height = height
        self.initializeTableInterface()
        x = -0.35999999999999999
        y = 0.17749999999999999
        x_increment = 0.23999999999999999
        helpText = PLocalizer.TableCardsHelp
        helpPos = (0.0, 0.0, 0.23999999999999999)
        text = PLocalizer.BlackjackCardSwap
        button = GuiButton(parent = self.menu, command = self.playerAction, helpText = helpText, helpPos = helpPos, pos = (x, 0, y), canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.CardSwap])
        button.show()
        self.cardSwapButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackDoubleDown
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.DoubleDown])
        button.show()
        self.doubleDownButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackStay
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Stay])
        button.show()
        self.stayButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackHit
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Hit])
        button.show()
        self.hitButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        x = -0.35999999999999999
        y = 0.070000000000000007
        x_increment = 0.23999999999999999
        x += x_increment
        x += x_increment
        text = PLocalizer.BlackjackSplit
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Split])
        button.show()
        self.splitButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        bid = self.table.getTableBidAmount()
        text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Bid])
        button.show()
        self.bidButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        
        def bid_update_function(value):
            bid = self.sliderValueToBid(value)
            text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
            self.bidButton['text'] = text
            self.bidAmount = bid

        self.bidAmount = 2
        default_value = 0.0
        x = 0.0
        y = -0.25
        label = PLocalizer.BlackjackBid
        resolution = 1.0
        self.bidSlider = self.create_slider(bid_update_function, default_value, x, y, resolution, label, self.menu)
        x = -0.35999999999999999
        y = 0.17749999999999999
        x_increment = 0.23999999999999999
        text = PLocalizer.PokerCheat1
        button = GuiButton(parent = self.menu, command = self.cardSwapButtonSelection, 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.cardSwapButtonSelection, canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.Cheat2])
        self.cheat2Button = button
        self.buttonArray = self.buttonArray + [
            button]
        x = x + x_increment
        self.hideCheatButtons()
        self.disableAllPlayButtons()
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32000000000000001
        currentMoney = localAvatar.getInventory().getGoldInPocket()
        self.moneyDisplay = DirectLabel(parent = self.menu, relief = None, pos = (-0.29999999999999999 + x_increment / 2.0, 0, 0.074999999999999997), geom = goldCoin, geom_scale = (scale, scale, scale), geom_pos = (0, 0, 0), text = '%s' % currentMoney, text_align = TextNode.ALeft, text_scale = 0.035000000000000003, text_pos = (0.044999999999999998, -0.01), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, scale = 1.1000000000000001)
        self.accept(InventoryGlobals.getCategoryQuantChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.setMoney)
        this = self
        identifier = 0
        this.sfxArray = []
        this.hitIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_HIT)]
        identifier = identifier + 1
        self.hands = []
        self.splitCardsArray = []
        self.canSplit = False
        self.canDoubleDown = False
        self.bid = False
コード例 #7
0
 def rePanel(self, inventory):
     if not self.showing:
         self.needRefresh = 1
         return None
     
     skillTokens = {
         InventoryType.CutlassToken: (ItemGlobals.RUSTY_CUTLASS,),
         InventoryType.PistolToken: (ItemGlobals.FLINTLOCK_PISTOL,),
         InventoryType.DollToken: (ItemGlobals.VOODOO_DOLL,),
         InventoryType.DaggerToken: (ItemGlobals.BASIC_DAGGER,),
         InventoryType.GrenadeToken: (ItemGlobals.GRENADE_POUCH,),
         InventoryType.WandToken: (ItemGlobals.CURSED_STAFF,) }
     zIndex = 1
     for skillTokenKey in TOKEN_LIST:
         quantity = 0
         if localAvatar.getInventory().stacks.get(skillTokenKey):
             quantity = 1
         
         skillData = skillTokens[skillTokenKey]
         weaponId = skillData[0]
         key = None
         panel = WeaponPanel.WeaponPanel((weaponId, quantity), key)
         panel.reparentTo(self)
         panel.setZ(PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999 - zIndex * panel.height)
         zIndex += 1
         repCat = WeaponGlobals.getRepId(weaponId)
         self.weaponPanels[repCat] = panel
         self.ignore('inventoryQuantity-%s' % inventory.getDoId())
         self.acceptOnce('inventoryQuantity-%s-%s' % (inventory.getDoId(), skillTokenKey), self.refreshList)
     
     repIcon_gui = loader.loadModel('models/textureCards/skillIcons')
     repIcon = repIcon_gui.find('**/box_base')
     if config.GetBool('want-fishing-game', 0):
         self.fishingIcon = GuiButton(pos = (0.16600000000000001, 0, 0.044999999999999998 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height), helpText = PLocalizer.FishingRepDescription, helpOpaque = True, image = (repIcon, repIcon, repIcon, repIcon), image_scale = (0.14399999999999999, 0.14399999999999999, 0.14399999999999999))
         fishIconCard = loader.loadModel('models/textureCards/fishing_icons')
         inv = localAvatar.getInventory()
         fishingChangeMsg = InventoryGlobals.getCategoryQuantChangeMsg(inv.doId, InventoryType.FishingRod)
         if self.fishingChangeMsg:
             self.ignore(fishingChangeMsg)
         
         self.fishingChangeMsg = fishingChangeMsg
         self.acceptOnce(fishingChangeMsg, self.refreshList)
         rodIcons = [
             'pir_t_gui_fsh_smRodIcon',
             'pir_t_gui_fsh_mdRodIcon',
             'pir_t_gui_fsh_lgRodIcon']
         rodLvl = inv.getStackQuantity(InventoryType.FishingRod)
         rodIcon = rodIcons[rodLvl - 1]
         rodText = PLocalizer.FishingRodNames[rodLvl]
         if rodLvl >= 1:
             self.fishingIcon['geom'] = fishIconCard.find('**/' + rodIcon)
         
         self.fishingIcon['geom_scale'] = 0.10000000000000001
         self.fishingIcon['geom_pos'] = (0, 0, 0)
         self.fishingIcon.reparentTo(self)
         fishingRepValue = localAvatar.getInventory().getReputation(InventoryType.FishingRep)
         self.fishingRepMeter = ReputationMeter(InventoryType.FishingRep, width = 0.66000000000000003)
         self.fishingRepMeter.setPos(0.62, 0, 0.041000000000000002 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height)
         self.fishingRepMeter.update(fishingRepValue)
         self.fishingRepMeter.reparentTo(self)
         self.fishingRepMeter.flattenLight()
         self.fishingPoleName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = rodText, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, -0.0050000000000000001 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - 7 * panel.height), text_font = PiratesGlobals.getInterfaceFont())
         self.fishingPoleName.reparentTo(self)
         zIndex += 1
     
     iconCard = loader.loadModel('models/textureCards/skillIcons')
     if config.GetBool('want-potion-game', 0):
         self.potionIcon = GuiButton(pos = (0.16600000000000001, 0, 0.044999999999999998 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height), helpText = PLocalizer.PotionRepDescription, helpOpaque = True, image = (repIcon, repIcon, repIcon, repIcon), image_scale = (0.14399999999999999, 0.14399999999999999, 0.14399999999999999))
         self.potionIcon['geom'] = iconCard.find('**/pir_t_gui_pot_base')
         self.potionIcon['geom_scale'] = 0.10000000000000001
         self.potionIcon['geom_pos'] = (0, 0, 0)
         self.potionIcon.reparentTo(self)
         potionRepValue = localAvatar.getInventory().getReputation(InventoryType.PotionsRep)
         self.potionRepMeter = ReputationMeter(InventoryType.PotionsRep, width = 0.66000000000000003)
         self.potionRepMeter.setPos(0.62, 0, 0.041000000000000002 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height)
         self.potionRepMeter.update(potionRepValue)
         self.potionRepMeter.reparentTo(self)
         self.potionRepMeter.flattenLight()
         zIndex += 1
     
     items = dict(map(lambda x: (x.getType(), x.getCount()), inventory.getConsumables().values()))
     possibleItems = ItemGlobals.getAllHealthIds()
     havePorky = items.get(ItemGlobals.ROAST_PORK)
     if not havePorky and ItemGlobals.ROAST_PORK in possibleItems:
         possibleItems.remove(ItemGlobals.ROAST_PORK)
     
     offset = 0
     if base.config.GetBool('want-potion-game', 0):
         items = inventory.getConsumables()
         listLength = len(InventoryType.PotionMinigamePotions)
         count = 0
         for i in range(listLength):
             tonicId = InventoryType.PotionMinigamePotions[i]
             if items.get(tonicId):
                 button = SkillButton(tonicId, self.tonicCallback, items.get(tonicId), showQuantity = True, showHelp = True, showRing = True)
                 button.skillButton['geom_scale'] = 0.080000000000000002
                 x = 0.16 * (count % 6) + -1.2
                 z = 1.0 - int(count / 6) * 0.16
                 button.setPos(x, 0, z)
                 button.reparentTo(self)
                 self.tonicButtons[tonicId] = button
                 count += 1
                 continue
コード例 #8
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
コード例 #9
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.040000000000000001, pos = (0, 0, 0.17499999999999999), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1)
     self.disableReason.hide()
     self.initializeTableInterface()
     x = -0.35999999999999999
     y = 0.17749999999999999
     x_increment = 0.23999999999999999
     helpText = PLocalizer.TableCardsHelp
     helpPos = (0.0, 0.0, 0.23999999999999999)
     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.35999999999999999
     y = 0.070000000000000007
     x_increment = 0.23999999999999999
     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.050000000000000003, pos = (-0.14999999999999999, 0.0, 0.17000000000000001), text_fg = (1, 0.90000000000000002, 0.59999999999999998, 1), text_shadow = (0, 0, 0, 1))
     if table.wantMeter == 1:
         cardMaker = CardMaker('tellMeter')
         cardMaker.setFrame(-1, 1, -1, 1)
         self.meterMax = 0.20000000000000001
         self.meterBorder = NodePath(cardMaker.generate())
         self.meterBorder.setColor(1, 1, 0, 1)
         self.meterBorder.setScale(0.20000000000000001, 1, 0.02)
         self.meterBorder.reparentTo(aspect2d)
         self.meter = NodePath(cardMaker.generate())
         self.meter.setColor(1, 0, 0, 1)
         self.meter.setScale(0.20000000000000001, 1, 0.050000000000000003)
         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.20000000000000001)
         self.fulcrum.setZ(-0.20999999999999999)
         self.fulcrum.reparentTo(aspect2d)
         self.weightR = NodePath(cardMaker.generate())
         self.weightR.setColor(0, 0, 1, 1)
         self.weightR.setScale(0.029999999999999999, 1, 0.050000000000000003)
         self.weightR.setPos(0.22, 0, 0.059999999999999998)
         self.weightR.reparentTo(self.balance)
         self.weightL = NodePath(cardMaker.generate())
         self.weightL.setColor(0, 0, 1, 1)
         self.weightL.setScale(0.029999999999999999, 1, 0.050000000000000003)
         self.weightL.setPos(-0.22, 0, 0.059999999999999998)
         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.040000000000000001)
     self.communityCards = []
     for i in range(self.maxCommunityCards):
         card = PlayingCard.PlayingCardNodePath('standard', PlayingCardGlobals.Unknown)
         card.reparentTo(self.communityCardNode)
         card.setPos(i * 0.29999999999999999 - 0.59999999999999998, 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.32000000000000001
     currentMoney = self.table.getPlayerChips()
     x_increment = 0.23999999999999999
     self.moneyDisplay = DirectLabel(parent = self.menu, relief = None, pos = (-0.29999999999999999 + x_increment, 0, 0.074999999999999997), geom = goldCoin, geom_scale = (scale, scale, scale), geom_pos = (0, 0, 0), text = '%s' % currentMoney, text_align = TextNode.ALeft, text_scale = 0.040000000000000001, text_pos = (0.050000000000000003, -0.01), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, scale = 1.1000000000000001)
     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