def _getGameInfo(self, styles, gameType, gameStyle=None, callback=None):
        def gotGameInfo(info):
            requestId = DistributedInventoryBase.getLastInventoryRequestId()
            if requestId in self.myInventoryRequests:
                self.myInventoryRequests.remove(requestId)

            if callback:
                callback(info)

        if styles:
            (inventoryRequestId, styles) = GameTypeGlobals.getGameStyles(gameType, gameStyle, callback=gotGameInfo)
        else:
            (inventoryRequestId, options) = GameTypeGlobals.getGameOptions(gameType, gameStyle, callback=gotGameInfo)
        if inventoryRequestId != None:
            self.myInventoryRequests.append(inventoryRequestId)
Beispiel #2
0
        def optionsReceived(options):
            if options:
                optionKeys = options.keys()
                for currOption in optionKeys:
                    if options[currOption][
                            0] == PiratesGuiGlobals.UIItemType_Hidden or options.get(
                                'execute'):
                        continue

                    availItems.append({
                        'Text':
                        GameTypeGlobals.getGameTypeString(
                            currOption, 'option'),
                        'Option':
                        currOption,
                        'Values':
                        options[currOption][1],
                        'Value':
                        options[currOption][1][0],
                        'ValueType':
                        options[currOption][0]
                    })

            if callback:
                callback(availItems)
Beispiel #3
0
    def _getGameInfo(self, styles, gameType, gameStyle=None, callback=None):
        def gotGameInfo(info):
            requestId = DistributedInventoryBase.getLastInventoryRequestId()
            if requestId in self.myInventoryRequests:
                self.myInventoryRequests.remove(requestId)
            if callback:
                callback(info)

        if styles:
            inventoryRequestId, styles = GameTypeGlobals.getGameStyles(
                gameType, gameStyle, callback=gotGameInfo)
        else:
            inventoryRequestId, options = GameTypeGlobals.getGameOptions(
                gameType, gameStyle, callback=gotGameInfo)
        if inventoryRequestId != None:
            self.myInventoryRequests.append(inventoryRequestId)
        return
Beispiel #4
0
 def itemSelect(self, item):
     if item.value == PiratesGlobals.CREW_STYLE_FIND_A_CREW and item.value == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS or item.value == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
         self.toggleAICrewLookout(item.value)
         return None
     
     for currItem in self.activityListItems.items:
         currItem.setSelected(False)
     
     item.setSelected(True)
     self.selectedItem = item
     categoryName = GameTypeGlobals.getGameTypeString(self.selectedItem.value, 'style')
     invCat = GameTypeGlobals.getGameTypeRanking(self.selectedItem.value)
     inv = base.localAvatar.getInventory()
     if inv:
         playerRank = inv.getStackQuantity(invCat)
         self.rankingDisplay['text'] = '%s : %d' % (categoryName, playerRank)
         self.rankingDisplay.show()
     
     if self.parentPanel.submitButton == None:
         self.parentPanel.submitRequest()
Beispiel #5
0
 def gotOptions(itemList):
     if itemList and len(itemList) > 0:
         self.optionsPanel = LookoutRequestLVL3(PLocalizer.LookoutOptionsTitle, titleTextScale = 0.050000000000000003, itemList = itemList, optionsFor = selectedItem.value)
         self.optionsPanel.reparentTo(self.parentPanel)
         self.optionsPanel.setPos(0, 0, 0)
         self.optionsPanel.setParentPanel(self)
         gameTypeStr = GameTypeGlobals.getGameTypeString(selectedItem.value, 'style')
         self.optionsPanel.show(gameTypeStr, selectedItem)
         if self.optionsButton:
             self.optionsButton.hide()
         
         self.parentPanel.updateMode(PiratesGuiGlobals.REQUEST_OPT_MODE)
Beispiel #6
0
 def __init__(self, name, titleTextScale = None, itemList = None, parentPanel = None):
     self.width = PiratesGuiGlobals.LookoutRequestLVL2Width
     self.height = PiratesGuiGlobals.LookoutRequestLVL2Height
     DirectFrame.__init__(self, relief = None, state = DGG.DISABLED, frameColor = PiratesGuiGlobals.FrameColor, borderWidth = PiratesGuiGlobals.BorderWidth, frameSize = (0, self.width, 0, self.height))
     self.initialiseoptions(LookoutRequestLVL2)
     InventoryRequestGameType.__init__(self)
     self.parentPanel = parentPanel
     self.name = name
     if itemList:
         self.itemList = itemList
     else:
         self.notify.warning('no itemList provied, displaying default parlor game types')
         self.itemList = [
             {
                 'Text': GameTypeGlobals.getGameTypeString(PiratesGlobals.GAME_STYLE_BLACKJACK, 'style'),
                 'Value': PiratesGlobals.GAME_STYLE_BLACKJACK },
             {
                 'Text': GameTypeGlobals.getGameTypeString(PiratesGlobals.GAME_STYLE_POKER, 'style'),
                 'Value': PiratesGlobals.GAME_STYLE_POKER }]
     self.activityListItems = ListFrame(0.80000000000000004, None, 'blah', self, frameColor = (0, 0, 0, 0))
     self.activityListItems.setup()
     if self.parentPanel.UI_VERSION == 0:
         size = (0, 0.81999999999999995, 0, 0.45000000000000001)
         pos = (0.14999999999999999, 0, 0.55000000000000004)
     else:
         size = (0, 0.81999999999999995, 0, 0.75)
         pos = (0.14999999999999999, 0, 0.20000000000000001)
     self.activityList = DirectScrolledFrame(parent = self, frameSize = size, relief = DGG.GROOVE, state = DGG.NORMAL, frameColor = (0, 0, 0, 0), borderWidth = PiratesGuiGlobals.BorderWidth, canvasSize = (0, 0.69999999999999996, 0, self.activityListItems['frameSize'][3]), verticalScroll_frameColor = PiratesGuiGlobals.ScrollbarColor, verticalScroll_borderWidth = (0.0074999999999999997, 0.0074999999999999997), verticalScroll_frameSize = (0, PiratesGuiGlobals.ScrollbarSize, 0, self.height), verticalScroll_thumb_frameColor = PiratesGuiGlobals.ButtonColor2, verticalScroll_incButton_frameColor = PiratesGuiGlobals.ButtonColor2, verticalScroll_decButton_frameColor = PiratesGuiGlobals.ButtonColor2, sortOrder = 5, pos = pos)
     if self.parentPanel.UI_VERSION == 0:
         self.createListFrame(self.activityList)
     
     self.activityListItems.reparentTo(self.activityList.getCanvas())
     self.selectedItem = None
     self.optionsPanel = None
     self.optionsButton = None
     self.rankingDisplay = DirectLabel(parent = self.getParent(), relief = None, text = 'Ranking', text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.28999999999999998, 0, -0.55000000000000004))
     self.rankingDisplay.hide()
     self.setParentPanel(parentPanel)
     self.storedOptions = { }
     self.customOptions = { }
 def optionsReceived(options):
     if options:
         optionKeys = options.keys()
         for currOption in optionKeys:
             if options[currOption][0] == PiratesGuiGlobals.UIItemType_Hidden or options.get('execute'):
                 continue
             
             availItems.append({
                 'Text': GameTypeGlobals.getGameTypeString(currOption, 'option'),
                 'Option': currOption,
                 'Values': options[currOption][1],
                 'Value': options[currOption][1][0],
                 'ValueType': options[currOption][0] })
         
     
     if callback:
         callback(availItems)
        def optionsReceived(options):
            if options:
                optionKeys = options.keys()
                for currOption in optionKeys:
                    if options[currOption][0] == PiratesGuiGlobals.UIItemType_Hidden or options.get("execute"):
                        continue

                    availItems.append(
                        {
                            "Text": GameTypeGlobals.getGameTypeString(currOption, "option"),
                            "Option": currOption,
                            "Values": options[currOption][1],
                            "Value": options[currOption][1][0],
                            "ValueType": options[currOption][0],
                        }
                    )

            if callback:
                callback(availItems)