Exemplo n.º 1
0
 def setup(self):
     self.setBin('gui-fixed', 1)
     self.itemLabel = DirectLabel(parent = self, relief = None, text = '%s' % self.fromCell.inventoryItem.getName(), text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, image = self.fromCell.inventoryItem['image'], image_scale = self.fromCell.inventoryItem['image_scale'], text_pos = (0.0, 0.066000000000000003), pos = (self.sizeX * 0.5, 0.0, self.sizeZ * 0.59999999999999998))
     self.amountEntry = DirectEntry(parent = self, relief = DGG.GROOVE, scale = PiratesGuiGlobals.TextScaleExtraLarge, initialText = '%s' % self.amount, width = 1.5, numLines = 1, focus = 1, cursorKeys = 1, frameColor = (1.0, 1.0, 1.0, 0.20000000000000001), entryFont = PiratesGlobals.getPirateBoldOutlineFont(), text_fg = (1.0, 1.0, 1.0, 1.0), pos = (self.sizeX * 0.32500000000000001, 0.0, self.sizeZ * 0.35499999999999998), suppressKeys = 1, suppressMouse = 1, autoCapitalize = 0, command = self.selectStackAmount)
     self.amountLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.InventorySellAmount % self.amount, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleExtraLarge, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_pos = (0.0, 0.066000000000000003), pos = (self.sizeX * 0.55000000000000004, 0.0, self.sizeZ * 0.25))
     self.confirmButton = GuiButton.GuiButton(parent = self, text = PLocalizer.lOk, text_fg = PiratesGuiGlobals.TextFG2, text_pos = (0.0, -0.014), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_shadow = PiratesGuiGlobals.TextShadow, image = GuiButton.GuiButton.blueGenericButton, image_scale = (0.59999999999999998, 0.59999999999999998, 0.59999999999999998), pos = (self.sizeX * 0.25, 0, 0.10000000000000001), relief = None, command = self.selectStackAmount)
     self.cancelButton = GuiButton.GuiButton(parent = self, text = PLocalizer.lCancel, text_fg = PiratesGuiGlobals.TextFG2, text_pos = (0.0, -0.014), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_shadow = PiratesGuiGlobals.TextShadow, image = GuiButton.GuiButton.blueGenericButton, image_scale = (0.59999999999999998, 0.59999999999999998, 0.59999999999999998), pos = (self.sizeX * 0.75, 0, 0.10000000000000001), relief = None, command = self.cancelItem)
Exemplo n.º 2
0
    def __init__(self, title, nameLists, showClose=False, allowEscape=True):
        GuiPanel.GuiPanel.__init__(self, title, self.width, self.height, showClose)
        self.initialiseoptions(NamePanelGui)
        self.nameLists = nameLists
        self.tumblerList = []
        self.name = ''
        self.nameIndices = [0, 0]
        self.isTypedName = 0
        charGui = loader.loadModel('models/gui/char_gui')
        if PICK_A_NAME_ENABLED:
            self.nameModeButton = GuiButton.GuiButton(helpText=PLocalizer.TypeANameHelp, command=self.toggleNameMode, borderWidth=PiratesGuiGlobals.BorderWidth, text=PLocalizer.TypeAName, frameColor=PiratesGuiGlobals.ButtonColor1, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -0.01), frameSize=(-0.09, 0.09, -0.015, 0.065), text_scale=PiratesGuiGlobals.TextScaleLarge, pad=(0.01,
                                                                                                                                                                                                                                                                                                                                                                                         0.01), parent=self, pos=(0.12,
                                                                                                                                                                                                                                                                                                                                                                                                                  0,
                                                                                                                                                                                                                                                                                                                                                                                                                  0.06))
        self.commitButton = DialogButton.DialogButton(command=self.handleCommit, text=PLocalizer.Submit, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -0.01), frameSize=(-0.09, 0.09, -0.015, 0.065), text_scale=PiratesGuiGlobals.TextScaleLarge, parent=self, pos=(self.width - 0.15, 0, 0.07))
        if showClose:
            self.cancelButton = DialogButton.DialogButton(command=self.closePanel, text=PLocalizer.lClose, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -0.01), frameSize=(-0.09, 0.09, -0.015, 0.065), text_scale=PiratesGuiGlobals.TextScaleLarge, parent=self, pos=(0.15,
                                                                                                                                                                                                                                                                          0,
                                                                                                                                                                                                                                                                          0.07))
        if allowEscape:
            self.acceptOnce('escape', self.closePanel)
        self.accept('updateNameResult', self.__updateNameResult)
        self.pickAName = DirectFrame(parent=self, relief=None)
        self.nameResult = DirectFrame(parent=self.pickAName, relief=DGG.FLAT, text='', text_align=TextNode.ACenter, text_scale=PiratesGuiGlobals.TextScaleTitleMed, text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, frameColor=(0,
                                                                                                                                                                                                                                                             0,
                                                                                                                                                                                                                                                             0,
                                                                                                                                                                                                                                                             0.5), text_pos=(0,
                                                                                                                                                                                                                                                                             0.007), frameSize=(-0.3, 0.3, -0.015, 0.065), text_font=PiratesGlobals.getPirateOutlineFont(), textMayChange=1)
        self.nameResult.setPos(self.width / 2, 0, self.height - 0.14)
        for i in range(len(self.nameLists)):
            tPos = (i + 1) * (self.width / (len(self.nameLists) + 1))
            tumbler = PNameTumbler.PNameTumbler(self.nameLists[i], '')
            tumbler.reparentTo(self.pickAName)
            tumbler.setPos(tPos, 0, self.height * 0.55)
            tumbler.setScale(0.7)
            self.tumblerList.append(tumbler)

        self.randomButton = GuiButton.GuiButton(command=self.randomName, text=PLocalizer.Random, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -0.01), frameSize=(-0.09, 0.09, -0.015, 0.065), text_scale=PiratesGuiGlobals.TextScaleLarge, parent=self.pickAName, pos=(self.width / 2.0, 0, 0.12))
        self.randomName()
        self.typeAName = DirectFrame(parent=self, relief=None)
        self.typeAName.hide()
        self.nameEntry = DirectEntry(parent=self.typeAName, relief=DGG.FLAT, text='', entryFont=PiratesGlobals.getPirateOutlineFont(), text_scale=PiratesGuiGlobals.TextScaleLarge, text_shadow=PiratesGuiGlobals.TextShadow, text_fg=PiratesGuiGlobals.TextFG1, width=MAX_NAME_WIDTH, frameColor=(0,
                                                                                                                                                                                                                                                                                                   0,
                                                                                                                                                                                                                                                                                                   0,
                                                                                                                                                                                                                                                                                                   0.5), text_pos=(0,
                                                                                                                                                                                                                                                                                                                   0.007), frameSize=(-0.3, 0.3, -0.015, 0.065), numLines=1, focus=1, cursorKeys=1, text_align=TextNode.ACenter, command=self.handleCommit)
        self.nameEntry.setPos(self.width / 2, 0, self.height - 0.25)
        self.instructions = DirectFrame(parent=self.typeAName, relief=None, text=PLocalizer.TypeANameInstructions, text_align=TextNode.ACenter, text_scale=PiratesGuiGlobals.TextScaleLarge, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, frameColor=(0,
                                                                                                                                                                                                                                                                                      0,
                                                                                                                                                                                                                                                                                      0,
                                                                                                                                                                                                                                                                                      0.5), text_pos=(0,
                                                                                                                                                                                                                                                                                                      0.007), frameSize=(-0.3, 0.3, -0.015, 0.065), textMayChange=1, text_wordwrap=15)
        self.instructions.setPos(self.width / 2, 0, self.height - 0.35)
        charGui.removeNode()
        return
Exemplo n.º 3
0
 def _initGUI(self):
     base.loadingScreen.beginStep('init Gui', 4, 55)
     cm = CardMaker('PotionBackground')
     cm.setFrame(-10, 10, -10, 10)
     cm.setColor(0, 0, 0, 1)
     self.background = NodePath(cm.generate())
     self.background.reparentTo(aspect2d)
     self.background.setBin('background', -100)
     self.xpBackground = NodePath('PotionXPBackground')
     self.xpBackground.reparentTo(aspect2d)
     self.xpBackground.setBin('background', -95)
     base.loadingScreen.tick()
     self.dialogs = NodePath('DialogBackground')
     self.dialogs.reparentTo(aspect2d)
     self.dialogs.setBin('background', -70)
     self.buttonsBackground = NodePath('PotionButtonBackground')
     self.buttonsBackground.reparentTo(base.a2dBottomRight)
     self.buttonsBackground.setBin('background', -90)
     textureCard = loader.loadModel('models/minigames/pir_m_gui_pot_textureCard')
     self.stretchedBackgroundTextureCard = textureCard.find('**/pir_t_gui_pot_background')
     self.stretchedBackgroundTextureCard.reparentTo(self.background)
     self.stretchedBackgroundTextureCard.setScale(3.3999999999999999, 1.0, 3.3999999999999999)
     self.stretchedBackgroundTextureCard.setPos(0.0, 20.0, 0.0)
     fadecm = CardMaker('card')
     fadecm.setFrameFullscreenQuad()
     self.fadeIn = render2d.attachNewNode(fadecm.generate())
     self.fadeIn.setBin('background', -50)
     self.fadeIn.setPos(0.0, -30.0, 0.0)
     self.fadeIn.setColor(0, 0, 0, 1.0)
     self.fadeIn.setTransparency(True)
     base.loadingScreen.tick()
     cm = CardMaker('card')
     cm.setFrame(0, 1, 0.01, 0.01)
     self.foregroundLayer = aspect2d.attachNewNode(cm.generate())
     self.foregroundTextureCard = textureCard.find('**/pir_t_gui_pot_foreground')
     self.foregroundTextureCard.setScale(0.80000000000000004, 1.0, 0.40000000000000002)
     self.foregroundTextureCard.setPos(-0.69999999999999996, -20.0, 0.80000000000000004)
     self.foregroundTextureCard.setBin('background', -80)
     self.foregroundTextureCard.copyTo(self.foregroundLayer)
     self.repMeter = ReputationMeter.ReputationMeter(InventoryType.PotionsRep, width = 0.56000000000000005)
     inv = localAvatar.getInventory()
     self.repMeter.reparentTo(self.xpBackground)
     self.repMeter.setPos(0, 0, -0.94999999999999996)
     self.repMeter.update(inv.getAccumulator(InventoryType.PotionsRep))
     localAvatar.guiMgr.registerReputationHandler(self.updateRepMeter)
     base.loadingScreen.tick()
     self.closeButton = GuiButton.GuiButton(image = (textureCard.find('**/pir_t_gui_pot_escape'), textureCard.find('**/pir_t_gui_pot_escapeOn'), textureCard.find('**/pir_t_gui_pot_escapeOn'), textureCard.find('**/pir_t_gui_pot_escape')), image_scale = (0.10000000000000001, 0.10000000000000001, 0.10000000000000001), image_pos = (0.074999999999999997, 0, 0.080000000000000002), hotkeys = [
         'Escape'], hotkeyLabel = PLocalizer.PotionGui['ExitButton'], pos = (-0.40000000000000002, 0.0, 0.01), text0_fg = PotionGlobals.TextColor, text1_fg = PiratesGuiGlobals.TextFG0, text2_fg = PiratesGuiGlobals.TextFG15, text3_fg = PotionGlobals.TextColorDisabled, parent = self.buttonsBackground, command = self.confirmQuit)
     self.returnButton = GuiButton.GuiButton(text = (PLocalizer.PotionGui['SwitchRecipe'], PLocalizer.PotionGui['SwitchRecipe'], PLocalizer.PotionGui['SwitchRecipe'], PLocalizer.PotionGui['SwitchRecipe']), pos = (-0.57999999999999996, 0.0, -0.62), text_scale = PiratesGuiGlobals.TextScaleExtraLarge, text_shadow = None, image = (None, None, None, None), text0_fg = PotionGlobals.TextColor, text1_fg = PiratesGuiGlobals.TextFG0, text2_fg = PiratesGuiGlobals.TextFG15, text3_fg = PotionGlobals.TextColorDisabled, parent = self.background, command = self.confirmReturn)
     self.returnButton.stash()
     self.hintsButton = GuiButton.GuiButton(text = (PLocalizer.PotionGui['ShowTutorial'], PLocalizer.PotionGui['ShowTutorial'], PLocalizer.PotionGui['ShowTutorial'], PLocalizer.PotionGui['ShowTutorial']), text_scale = PiratesGuiGlobals.TextScaleSmall, image_scale = (0.25, 0.10000000000000001, 0.17999999999999999), image_pos = (0, 0, 0), pos = (-0.53000000000000003, 0.0, 0.074999999999999997), parent = self.buttonsBackground, command = self.showLastHint)
     self.InfoButton = GuiButton.GuiButton(text = (PLocalizer.PotionGui['IngredientList'], PLocalizer.PotionGui['IngredientList'], PLocalizer.PotionGui['IngredientList'], PLocalizer.PotionGui['IngredientList']), text_scale = PiratesGuiGlobals.TextScaleSmall, image_scale = (0.29999999999999999, 0.10000000000000001, 0.17999999999999999), image_pos = (0, 0, 0), pos = (-0.83999999999999997, 0.0, 0.074999999999999997), parent = self.buttonsBackground, command = self.showInfo)
     textureCard.removeNode()
     base.loadingScreen.endStep('init Gui')
Exemplo n.º 4
0
 def __init__(self, callback):
     topGui = loader.loadModel('models/gui/toplevel_gui')
     lookoutGui = loader.loadModel('models/gui/lookout_gui')
     DirectFrame.__init__(self, relief = None, image = topGui.find('**/pir_t_gui_gen_parchment'), image_scale = (0.33000000000000002, 0, 0.44))
     self.initialiseoptions(SkipTutorialFrame)
     self.title = DirectLabel(parent = self, relief = None, text = PLocalizer.SkipTutorialTitle, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_fg = (0.59999999999999998, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateOutlineFont(), text_align = TextNode.ACenter, pos = (0.02, 0, 0.13))
     self.message = DirectLabel(parent = self, relief = None, text = PLocalizer.SkipTutorialOffer, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG0, text_align = TextNode.ACenter, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 14, pos = (0.02, 0, 0.050000000000000003))
     self.callback = callback
     self.checkButton = GuiButton.GuiButton(parent = self, relief = None, text = PLocalizer.SkipTutorialNo, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.11, -0.01), text0_fg = PiratesGuiGlobals.TextFG0, text_shadow = PiratesGuiGlobals.TextShadow, image = (lookoutGui.find('**/lookout_submit'), lookoutGui.find('**/lookout_submit_down'), lookoutGui.find('**/lookout_submit_over'), lookoutGui.find('**/lookout_submit')), image_scale = 0.17000000000000001, image_color = (0.5, 0.0, 0.0, 1.0), pos = (-0.17000000000000001, 0, -0.10000000000000001), command = self._SkipTutorialFrame__handleNo)
     self.cancelButton = GuiButton.GuiButton(parent = self, relief = None, text = PLocalizer.SkipTutorialYes, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.089999999999999997, -0.01), text0_fg = PiratesGuiGlobals.TextFG0, text_shadow = PiratesGuiGlobals.TextShadow, image = (lookoutGui.find('**/lookout_close_window'), lookoutGui.find('**/lookout_close_window_down'), lookoutGui.find('**/lookout_close_window_over'), lookoutGui.find('**/lookout_close_window')), image_scale = 0.17000000000000001, image_color = (0.5, 0.0, 0.0, 1.0), pos = (0.070000000000000007, 0, -0.10000000000000001), command = self._SkipTutorialFrame__handleYes)
     topGui.removeNode()
     lookoutGui.removeNode()
Exemplo n.º 5
0
 def displayStepChoices(self):
     DialogDict = DialogDict
     import pirates.quest.DialogTree
     self.choiceLabels = []
     self.choiceButtons = []
     gui = loader.loadModel('models/gui/compass_main')
     choiceIcon = gui.find('**/icon_sphere')
     for i in range(len(self.choices)):
         index = 0
         process = DialogDict.get(self.npc.getUniqueId()).get(self.dialogId).get(self.choices[i])[index]
         while not isinstance(process, PlayerDialog):
             index += 1
             process = DialogDict.get(self.npc.getUniqueId()).get(self.dialogId).get(self.choices[i])[index]
         while not process.avCanParticipate(localAvatar):
             index += 1
             process = DialogDict.get(self.npc.getUniqueId()).get(self.dialogId).get(self.choices[i])[index]
         if process.avCanParticipate(localAvatar) and isinstance(process, PlayerDialog):
             choiceButton = GuiButton.GuiButton(parent = aspect2d, relief = None, text = self._StepChoice__getDialogChoiceText(self.choices[i], index), text_font = PiratesGlobals.getPirateFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = None, text_align = TextNode.ALeft, text_scale = 0.055, text0_fg = PiratesGuiGlobals.TextFG2, text1_fg = PiratesGuiGlobals.TextFG8, text2_fg = PiratesGuiGlobals.TextFG8, text3_fg = PiratesGuiGlobals.TextFG9, image = choiceIcon, image_scale = 0.29999999999999999, image_pos = (-0.050000000000000003, 0, 0.0070000000000000001), geom = None, pos = (-1.1499999999999999, 0, -0.47999999999999998 - i * 0.074999999999999997), command = self.buttonClicked, extraArgs = [
                 self.choices[i]])
             choiceButton.setBin('gui-fixed', 1)
             choiceButton.bind(DGG.ENTER, self.highlightIcon, extraArgs = [
                 i])
             choiceButton.bind(DGG.EXIT, self.unhighlightIcon, extraArgs = [
                 i])
             self.choiceButtons.append(choiceButton)
             continue
Exemplo n.º 6
0
 def createGui(self):
     self.destroyGui()
     box = loader.loadModel('models/gui/gui_title_box').find('**/gui_title_box_top')
     box.setPos(0.54000000000000004, 0, 1.3600000000000001)
     box.setScale(0.25)
     box.reparentTo(self)
     box.flattenStrong()
     if not self.charGui:
         self.charGui = loader.loadModel('models/gui/char_gui')
     
     self.title = DirectLabel(parent = self, relief = None, text = self.titleText, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getPirateFont(), text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_shadow = PiratesGuiGlobals.TextShadow, pos = (self.width * 0.5, 0, 1.343))
     self.tabBackParent = self.attachNewNode('tabBackParent')
     self.tabBackParent.setZ(1.1100000000000001)
     self.scrollFrame = DirectScrolledFrame(parent = self, relief = None, state = DGG.NORMAL, manageScrollBars = 0, autoHideScrollBars = 1, frameSize = (0.050000000000000003, self.width - 0.10000000000000001, 0.14000000000000001, self.height - 0.25), canvasSize = (0.050000000000000003, self.width - 0.10000000000000001, 0.14000000000000001, self.height - 0.25), verticalScroll_relief = None, verticalScroll_image = self.charGui.find('**/chargui_slider_small'), verticalScroll_frameSize = (0.0, PiratesGuiGlobals.ScrollbarSize, 0.14199999999999999, self.height - 0.26000000000000001), verticalScroll_image_scale = (self.height - 0.29999999999999999, 1, 0.75), verticalScroll_image_hpr = (0, 0, 90), verticalScroll_image_pos = (self.width - PiratesGuiGlobals.ScrollbarSize * 0.5 - 0.059999999999999998, 0, self.height * 0.46000000000000002), verticalScroll_image_color = (0.60999999999999999, 0.59999999999999998, 0.59999999999999998, 1), verticalScroll_thumb_image = (self.charGui.find('**/chargui_slider_node'), self.charGui.find('**/chargui_slider_node_down'), self.charGui.find('**/chargui_slider_node_over')), verticalScroll_thumb_relief = None, verticalScroll_thumb_image_scale = 0.40000000000000002, verticalScroll_thumb_image_pos = (-0.0050000000000000001, 0, 0), verticalScroll_resizeThumb = 0, horizontalScroll_relief = None)
     self.scrollFrame.verticalScroll.incButton.destroy()
     self.scrollFrame.verticalScroll.decButton.destroy()
     self.scrollFrame.horizontalScroll.incButton.destroy()
     self.scrollFrame.horizontalScroll.decButton.destroy()
     self.scrollFrame.horizontalScroll.hide()
     self.accept('press-wheel_up-%s' % self.scrollFrame.guiId, self.mouseWheelUp)
     self.accept('press-wheel_down-%s' % self.scrollFrame.guiId, self.mouseWheelDown)
     self.tabFrontParent = self.attachNewNode('tabFrontParent')
     self.tabFrontParent.setZ(1.1100000000000001)
     frameSize = (self.scrollFrame['frameSize'][0] + 0.01, self.scrollFrame['frameSize'][1] + 0.040000000000000001, self.scrollFrame['frameSize'][2] - 0.01, self.scrollFrame['frameSize'][3])
     self.repackScrollFrame()
     self.border = BorderFrame(parent = self.scrollFrame, state = DGG.DISABLED, modelName = 'general_frame_f', frameSize = frameSize, borderScale = 0.14999999999999999, showBackground = True, bgColorScale = VBase4(0, 0, 0, 1), sortOrder = -1)
     gui = loader.loadModel('models/gui/toplevel_gui')
     geomX = gui.find('**/generic_x')
     self.closeButton = GuiButton.GuiButton(parent = self, pos = (self.width / 2.0, 0, 0.070000000000000007), text = PLocalizer.TableLeave, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.035000000000000003, -0.014), textMayChange = 0, geom = (geomX,) * 4, geom_pos = (-0.059999999999999998, 0, 0), geom_scale = 0.5, geom0_color = PiratesGuiGlobals.ButtonColor3[0], geom1_color = PiratesGuiGlobals.ButtonColor3[1], geom2_color = PiratesGuiGlobals.ButtonColor3[2], geom3_color = PiratesGuiGlobals.ButtonColor3[3], image3_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), command = self.closePanel)
     self.shipBar = ShipTabBar(self.tabBackParent, self.tabFrontParent, parent = self)
     for t in self.pages:
         self.addTab(t)
     
     self.refreshTabStates()
Exemplo n.º 7
0
 def __init__(self, parent = None, type = PiratesGuiGlobals.REWARD_PANEL_BLACK_PEARL, doneCallback = None, **kw):
     optiondefs = (('pad', (0.55000000000000004, 0.47499999999999998), self.resetFrameSize), ('pos', (0.40000000000000002, 0, 0), None))
     self.defineoptions(kw, optiondefs)
     PDialog.__init__(self, parent)
     self.type = type
     if doneCallback:
         self.doneCallback = doneCallback
     else:
         self.doneCallback = self.cleanup
     self.showWeaponsTrack = None
     skillIcons = loader.loadModel('models/textureCards/skillIcons')
     weaponIcons = loader.loadModel('models/gui/gui_icons_weapon')
     isWeapon = TextDict[type]['isWeapon']
     if isWeapon:
         background = skillIcons.find('**/box_base_over')
         background.setTransparency(0.5)
         icon = weaponIcons.find('**/' + TextDict[type]['icon'])
         icon.setScale(0.75)
     else:
         background = skillIcons.find('**/base_over')
         icon = skillIcons.find('**/' + TextDict[type]['icon'])
     icon.reparentTo(background)
     self.congratsText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, textMayChange = 1, text = PLocalizer.RewardCongratulations, text_font = PiratesGlobals.getInterfaceOutlineFont(), text_align = TextNode.ACenter, text_scale = 0.12, text_fg = PiratesGuiGlobals.TextFG1, pos = (0.0, 0, 0.34000000000000002))
     self.completeText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, textMayChange = 1, text = TextDict[type]['title'], text_font = PiratesGlobals.getInterfaceOutlineFont(), text_align = TextNode.ACenter, text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG2, pos = (0, 0, 0.26000000000000001))
     self.iconLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = background, geom_scale = 0.29999999999999999, text = TextDict[type]['summary'], text_font = PiratesGlobals.getInterfaceFont(), text_align = TextNode.ACenter, text_scale = 0.040000000000000001, text_fg = PiratesGuiGlobals.TextFG1, text_pos = (0, 0.20000000000000001), pos = (0, 0, -0.029999999999999999))
     self.descriptionText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, textMayChange = 1, text = TextDict[type]['description'], text_font = PiratesGlobals.getInterfaceFont(), text_align = TextNode.ACenter, text_scale = 0.037999999999999999, text_fg = PiratesGuiGlobals.TextFG1, pos = (0, 0, -0.26000000000000001))
     self.nextButton = GuiButton.GuiButton(parent = self, state = DGG.NORMAL, text = PLocalizer.lOk, textMayChange = 1, text_scale = PiratesGuiGlobals.TextScaleMed, text_pos = (0, -0.01), pos = (0, 0, -0.5), command = self.doneCallback)
     self.borderFrame['borderScale'] = 1
     self.setupCustomReward()
     self.initialiseoptions(RewardPanel)
     self.setScale(1.25)
Exemplo n.º 8
0
    def _initGUI(self):
        self.panel = loader.loadModel('models/gui/pir_m_gui_can_ammoShelf')
        self.panel.reparentTo(self)
        self.panel.setScale(3.0)
        self.panel.setPos(-0.26, 0.0, 0.0)
        self.tabHandle = GuiButton.GuiButton(
            parent=self.panel,
            command=self.onTabClick,
            image=None,
            geom=(self.panel.find('**/ammoButton/idle'),
                  self.panel.find('**/ammoButton/idle'),
                  self.panel.find('**/ammoButton/over')),
            hotkeys=['shift'],
            helpText='Help Text',
            helpDelay=0)
        self.tabHandle.reparentTo(self.panel)
        for i in range(12):
            skillId = 12931 + i
            button = AmmoPanelButton.AmmoPanelButton(self.onAmmoClick, skillId,
                                                     0)
            button.reparentTo(self.panel)
            button.setScale(button.getScale() / 3.0)
            button.setPos(0.0, 0.0, 0.125 - 0.05 * (i % 6))
            if i >= 6:
                button.setX(button.getX() + 0.05)
            self.buttons[skillId] = button
            if i == 0:
                button.disablePurchase()

        self.oldAmmoSkillId = self.cannon.getAmmoSkillId()
        self.setBin('gui-cannonDefense', 2)
        return
Exemplo n.º 9
0
 def setupPermissionUI(self):
     if not self.permissionButton:
         if self['ownShip']:
             text = PLocalizer.PermIconHelpOwn
         else:
             text = PLocalizer.PermIconHelp
         circlecard = loader.loadModel('models/textureCards/skillIcons')
         base1 = circlecard.find('**/base')
         base2 = circlecard.find('**/base_over')
         base3 = circlecard.find('**/base_down')
         self.permissionButton = GuiButton.GuiButton(
             parent=self,
             relief=None,
             state=DGG.NORMAL,
             frameSize=(-0.045312499999999999, 0.045312499999999999,
                        -0.045312499999999999, 0.045312499999999999),
             pos=(0.58999999999999997, 0, 0.20999999999999999),
             helpText=text,
             helpPos=(-0.17999999999999999, 0, -0.10000000000000001),
             helpOpaque=1,
             image=(base1, base3, base2),
             image_scale=0.10000000000000001,
             command=self.handlePermissionButton,
             scale=0.90000000000000002)
         tex = loader.loadModel('models/gui/toplevel_gui').find(
             '**/gui_boarding')
         self.permissionLabel = DirectLabel(
             parent=self.permissionButton,
             relief=None,
             state=DGG.DISABLED,
             image=tex,
             image_scale=0.14999999999999999,
             image_color=(1, 1, 1, 0.80000000000000004))
         self.permissionLabel.setTransparency(1, 1)
Exemplo n.º 10
0
 def setup(self):
     self.isSetup = 1
     self.setBin('gui-fixed', 0)
     self.messageLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.BodyChangeText, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 18, text_shadow = PiratesGuiGlobals.TextShadow, pos = (self.sizeX * 0.050000000000000003, 0.0, self.sizeZ * 0.80000000000000004))
     Gui = loader.loadModel('models/gui/toplevel_gui')
     buttonImage = (Gui.find('**/generic_button'), Gui.find('**/generic_button_down'), Gui.find('**/generic_button_over'), Gui.find('**/generic_button_disabled'))
     self.confirmButton = DirectButton(parent = self, relief = None, image = buttonImage, image_scale = (0.41999999999999998, 1.0, 0.22), image0_color = VBase4(0.65000000000000002, 0.65000000000000002, 0.65000000000000002, 1), image1_color = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1), image2_color = VBase4(0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1), image3_color = VBase4(0.40999999999999998, 0.40000000000000002, 0.40000000000000002, 1), text = PLocalizer.BodyTypeCommit, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_pos = (0, -0.01), text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (self.sizeX * 0.5, 0, 0.17000000000000001), command = self.confirmBody)
     self.cancelButton = DirectButton(parent = self, relief = None, image = buttonImage, image_scale = (0.41999999999999998, 1.0, 0.22), image0_color = VBase4(0.65000000000000002, 0.65000000000000002, 0.65000000000000002, 1), image1_color = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1), image2_color = VBase4(0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1), image3_color = VBase4(0.40999999999999998, 0.40000000000000002, 0.40000000000000002, 1), text = PLocalizer.BodyTypeLater, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_pos = (0, -0.01), text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (self.sizeX * 0.5, 0, 0.070000000000000007), command = self.cancelBody)
     self.confirmButton['state'] = DGG.DISABLED
     main_gui = loader.loadModel('models/gui/gui_main')
     generic_x = main_gui.find('**/x2')
     generic_box = main_gui.find('**/exit_button')
     generic_box_over = main_gui.find('**/exit_button_over')
     main_gui.removeNode()
     closeButton = GuiButton.GuiButton(parent = self, relief = None, pos = (1.0, 0, 0.059999999999999998), image = (generic_box, generic_box, generic_box_over, generic_box), image_scale = 0.40000000000000002, command = self.cancelBody)
     xButton = OnscreenImage(parent = closeButton, image = generic_x, scale = 0.20000000000000001, pos = (-0.25600000000000001, 0, 0.76600000000000001))
     choices = None
     self.originalBody = localAvatar.getStyle().getBodyShape()
     self.bodyChoice = None
     gender = localAvatar.getStyle().gender
     if gender == 'f':
         choices = BodyDefs.BodyChoicesFemale
     elif gender == 'm':
         choices = BodyDefs.BodyChoicesMale
     
     xCount = 0
     for choice in choices:
         choiceButton = DirectButton(parent = self, relief = None, image = buttonImage, image_scale = (0.12, 1.0, 0.22), image0_color = VBase4(0.65000000000000002, 0.65000000000000002, 0.65000000000000002, 1), image1_color = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1), image2_color = VBase4(0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1), image3_color = VBase4(0.40999999999999998, 0.40000000000000002, 0.40000000000000002, 1), text = '%s' % (xCount + 1), text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_pos = (0, -0.01), text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.10000000000000001 + 0.14000000000000001 * xCount, 0, 0.27000000000000002), command = self.chooseType, extraArgs = [
             choice])
         xCount += 1
     
     self.accept('localAV-exitHalt', self.cancelBody)
     self.accept('localAv-regenerate', self.cancelBody)
Exemplo n.º 11
0
 def createCancelButton(self, cancelCallback, cancelText):
     if self.mode != PiratesGlobals.HIGHSEAS_ADV_WAIT:
         return None
     
     if not base.localAvatar.isCrewCaptain():
         return None
     
     self.cancelButton = GuiButton.GuiButton(helpText = cancelText, command = cancelCallback, borderWidth = PiratesGuiGlobals.BorderWidth, text = PLocalizer.Cancel, frameColor = PiratesGuiGlobals.ButtonColor3, text_fg = PiratesGuiGlobals.TextFG2, text_pos = (0, 0.014999999999999999), frameSize = (-0.089999999999999997, 0.089999999999999997, -0.014999999999999999, 0.065000000000000002), text_scale = PiratesGuiGlobals.TextScaleLarge, pad = (0.01, 0.01), parent = self, pos = (0, 0, -1.55), scale = 2.2999999999999998)
Exemplo n.º 12
0
 def __init__(self, inventory, name, **kw):
     optiondefs = (
      ('relief', None, None), ('framSize', (0, self.width, 0, self.height), None), ('sortOrder', 20, None))
     self.defineoptions(kw, optiondefs)
     DirectFrame.__init__(self, None, **kw)
     self.initialiseoptions(StoreGUI)
     if not StoreGUI.CoinImage:
         StoreGUI.CoinImage = loader.loadModel('models/gui/toplevel_gui').find('**/treasure_w_coin*')
     if not StoreGUI.WeaponIcons:
         StoreGUI.WeaponIcons = loader.loadModel('models/gui/gui_icons_weapon')
     if not StoreGUI.SkillIcons:
         StoreGUI.SkillIcons = loader.loadModel('models/textureCards/skillIcons')
     if not StoreGUI.FishingIcons:
         StoreGUI.FishingIcons = loader.loadModel('models/textureCards/fishing_icons')
     self.backTabParent = self.attachNewNode('backTabs', sort=0)
     self.panel = GuiPanel.GuiPanel(name, self.width, self.height, parent=self)
     self.panel.closeButton['command'] = self.closePanel
     self.setPos(-1.1, 0, -0.66)
     self.balance = 0
     self.inventory = inventory
     self.storeInventory = InventoryItemList.InventoryItemList(self.inventory, self.height - 0.15, buy=PiratesGuiGlobals.InventoryAdd)
     self.storeInventory.reparentTo(self.panel)
     self.storeInventory.setPos(0.03, 0, 0.04)
     self.storeInventory.sortByTypeAndLevel()
     self.cartWidth = self.columnWidth - 0.1
     self.cartHeight = self.height - 0.25
     self.cartFrame = DirectFrame(parent=self.panel, relief=None, frameSize=(0, self.cartWidth, 0, self.cartHeight))
     self.cartFrame.setPos(self.columnWidth + 0.025, 0, 0.08)
     self.purchaseTitle = DirectFrame(parent=self.cartFrame, relief=None, text=PLocalizer.PurchaseCart, text_fg=PiratesGuiGlobals.TextFG1, text_align=TextNode.ACenter, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.0, -0.03), textMayChange=0, pos=(self.cartWidth / 2, 0, self.cartHeight))
     self.purchaseInventory = PurchaseList.PurchaseList([], self.cartHeight - 0.25, buy=PiratesGuiGlobals.InventoryRemove)
     self.purchaseInventory.reparentTo(self.cartFrame)
     self.purchaseInventory.setPos(0, 0, 0.2)
     self.frontTabParent = self.panel.attachNewNode('frontTab', sort=2)
     self.balanceTitle = DirectFrame(parent=self.cartFrame, relief=None, text=PLocalizer.Total, text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.0,
                                                                                                                                                                                                                     0.0), pos=(0.01,
                                                                                                                                                                                                                                0,
                                                                                                                                                                                                                                0.225))
     self.balanceValue = DirectFrame(parent=self.cartFrame, relief=None, text=str(self.balance), text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ARight, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(-0.055, 0.0), textMayChange=1, image=StoreGUI.CoinImage, image_scale=0.15, image_pos=(-0.025,
                                                                                                                                                                                                                                                                                                             0,
                                                                                                                                                                                                                                                                                                             0.025), pos=(self.cartWidth, 0, 0.225))
     self.myGoldTitle = DirectFrame(parent=self.cartFrame, relief=None, text=PLocalizer.YourMoney, text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.0,
                                                                                                                                                                                                                        0.0), pos=(0.01,
                                                                                                                                                                                                                                   0,
                                                                                                                                                                                                                                   0.155))
     self.myGold = DirectFrame(parent=self.cartFrame, relief=None, text=str(localAvatar.getMoney()), text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ARight, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(-0.055, 0.0), textMayChange=1, image=StoreGUI.CoinImage, image_scale=0.15, image_pos=(-0.025,
                                                                                                                                                                                                                                                                                                                 0,
                                                                                                                                                                                                                                                                                                                 0.025), pos=(self.cartWidth, 0, 0.155))
     self.commitButton = GuiButton.GuiButton(command=self.handleCommitPurchase, parent=self.cartFrame, text=PLocalizer.PurchaseCommit, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -PiratesGuiGlobals.TextScaleLarge * 0.25), text_scale=PiratesGuiGlobals.TextScaleLarge, pos=(self.width - 0.2, 0, 0.075))
     self.commitButton.setPos(self.cartWidth / 2, 0, 0.05)
     self.initTabs()
     self.updateBalance()
     self.accept(getCategoryChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.updateBalance)
     self.accept(PiratesGuiGlobals.InventoryBuyEvent, self.handleBuyItem)
     base.localAvatar.guiMgr.setIgnoreEscapeHotKey(True)
     self.acceptOnce('escape', self.closePanel)
     return
Exemplo n.º 13
0
 def __init__(self, parent, **kw):
     optiondefs = (('relief', None, None),)
     self.defineoptions(kw, optiondefs)
     DirectFrame.__init__(self, parent)
     self.initialiseoptions(RedeemCodeGUI)
     gui_main = loader.loadModel('models/gui/gui_main')
     topImage = gui_main.find('**/game_options_panel/top')
     topImage.setPos(0.52000000000000002, 0, -0.14999999999999999)
     gui_main.removeNode()
     self.artFrame = DirectFrame(parent = aspect2dp, relief = None, image = topImage, image_scale = (0.23999999999999999, 0.23999999999999999, 0.23999999999999999), pos = (0.10000000000000001, 0.0, -0.20000000000000001))
     self.artFrame.setBin('gui-fixed', 2)
     self.blackout = DirectFrame(parent = aspect2dp, state = DGG.NORMAL, frameSize = (-5, 5, -5, 5), frameColor = (0.0, 0.0, 0.0, 0.40000000000000002), pos = (0.0, 0.0, 0.0))
     self.enterCode = GuiButton.GuiButton(parent = self.artFrame, text = PLocalizer.lConfirm, pos = (0.38500000000000001, 0.0, -0.025000000000000001), command = self.confirmCode)
     self.cancelCode = GuiButton.GuiButton(parent = self.artFrame, text = PLocalizer.lCancel, pos = (0.65000000000000002, 0.0, -0.025000000000000001), command = self.hideCode)
     DirectLabel(parent = self.artFrame, relief = None, text = PLocalizer.ShopEnterCode, text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleTitleSmall * 0.90000000000000002, text_pos = (0.51000000000000001, 0.33500000000000002), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceOutlineFont(), textMayChange = 0)
     DirectLabel(parent = self.artFrame, relief = None, text = PLocalizer.ShopCodeInst, text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge * 1.1000000000000001, text_pos = (0.51000000000000001, 0.25), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceOutlineFont(), textMayChange = 0, text_wordwrap = 12)
     self.codeInput = DirectEntry(parent = self.artFrame, relief = DGG.GROOVE, scale = PiratesGuiGlobals.TextScaleExtraLarge, pos = (0.52000000000000002, 0, 0.059999999999999998), borderWidth = PiratesGuiGlobals.BorderWidth, frameColor = (0.0, 0.0, 0.0, 1.0), text_align = TextNode.ACenter, width = 15, numLines = 1, focus = 1, cursorKeys = 1, text_fg = (1, 1, 1, 1), suppressKeys = 1, suppressMouse = 1, autoCapitalize = 0, command = self.confirmCode)
     self.alertDialog = None
     self.accept('codeRedeemed', self._RedeemCodeGUI__handleCodeRedeem)
Exemplo n.º 14
0
 def createButtons(self):
     if not base.config.GetBool('want-momentary-minimap', 1):
         guiMain = loader.loadModel('models/gui/gui_main')
         btImages = (guiMain.find('**/minimap_button'), guiMain.find('**/minimap_button'), guiMain.find('**/minimap_button_over'), guiMain.find('**/minimap_button'))
         self.minimapButton = GuiButton.GuiButton(parent = self, image = btImages, selectedImage = btImages, pos = (0.90000000000000002, 0, 1.1599999999999999), scale = 1.5, hotkeys = [
             'f8'], hotkeyLabel = 'F8', command = self.handleMinimapButton)
         self.minimapButton.hotkeyLabel.setPos(-0.050000000000000003, 0.0, -0.050000000000000003)
         self.minimapButton.hotkeyLabel.setScale(0.75)
     else:
         self.minimapButton = None
Exemplo n.º 15
0
 def loadGUI(self):
     shipcard = loader.loadModel('models/gui/ship_battle')
     self.nameBox = DirectFrame(parent = self, relief = None, pos = (0.058000000000000003, 0, -0.0064999999999999997), text = 'Ship Name', text_align = TextNode.ALeft, text_scale = 0.044999999999999998, text_pos = (0, -0.01), text_fg = PiratesGuiGlobals.TextFG1, text_wordwrap = 15, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceFont())
     tex = shipcard.find('**/ship_battle_speed_bar*')
     self.hpFrame = DirectFrame(parent = self, pos = (0.46500000000000002, 0, 0.14000000000000001), relief = None, image = tex, image_scale = (0.29999999999999999, 1, 0.59999999999999998))
     self.hpMeter = DirectWaitBar(parent = self.hpFrame, relief = DGG.RAISED, range = 100, value = 100, borderWidth = (0.002, 0.002), frameColor = (0, 0, 0, 1), barColor = (0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (-0.27000000000000002, 0.13100000000000001, -0.01, 0.01), pos = (0.069000000000000006, 0, 0.0), text = PLocalizer.Hull, text_scale = PiratesGuiGlobals.TextScaleLarge * 0.75, text_align = TextNode.ALeft, text_pos = (0.16, -0.012), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont())
     self.hpMeterChange = DirectFrame(parent = self.hpFrame, relief = DGG.FLAT, borderWidth = (0.0040000000000000001, 0.0040000000000000001), frameColor = (1.0, 0.0, 0.0, 1.0), sortOrder = 0)
     self.hpMeterChange.setBin('gui-fixed', 0)
     self.hpMeterChange.hide()
     self.hpMeterDownIval = Sequence(Func(self.hpMeterChange.show), Wait(0.10000000000000001), LerpColorInterval(self.hpMeterChange, 0.5, color = VBase4(0.69999999999999996, 0.10000000000000001, 0.10000000000000001, 1.0), blendType = 'easeOut'), LerpColorInterval(self.hpMeterChange, 0.25, color = VBase4(0.0, 0.0, 0.0, 1.0), blendType = 'easeOut'), Func(self.hpMeterChange.hide))
     self.hpMeterUpGreenIval = Sequence(Func(self.hpMeterChange.show), Wait(0.10000000000000001), LerpColorInterval(self.hpMeterChange, 0.75, color = VBase4(0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1.0)), Func(self.hpMeterChange.hide))
     self.hpMeterUpRedIval = Sequence(Func(self.hpMeterChange.show), Wait(0.10000000000000001), LerpColorInterval(self.hpMeterChange, 0.75, color = VBase4(1.0, 0.0, 0.0, 1.0)), Func(self.hpMeterChange.hide))
     self.hpMeterUpYellowIval = Sequence(Func(self.hpMeterChange.show), Wait(0.10000000000000001), LerpColorInterval(self.hpMeterChange, 0.75, color = VBase4(1.0, 1.0, 0.10000000000000001, 1.0)), Func(self.hpMeterChange.hide))
     self.spFrame = DirectFrame(parent = self, pos = (0.45500000000000002, 0, 0.115), relief = None, image = tex, image_scale = (0.29999999999999999, 1, 0.52000000000000002))
     speedArrow = loader.loadModel('models/gui/toplevel_gui').find('**/generic_arrow')
     self.speedMeter = DirectWaitBar(parent = self.spFrame, relief = DGG.RAISED, range = 100, value = 100, borderWidth = (0.002, 0.002), frameColor = (0, 0, 0, 1), barColor = (0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (-0.27000000000000002, 0.13200000000000001, -0.0080000000000000002, 0.0080000000000000002), pos = (0.069000000000000006, 0, 0.0), text = PLocalizer.Speed, text_scale = PiratesGuiGlobals.TextScaleLarge * 0.75, text_align = TextNode.ALeft, text_pos = (0.16, -0.0080000000000000002), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont(), geom = speedArrow, geom_pos = (-0.25, 0, -0.01), geom_hpr = (0, 0, 90), geom_scale = (0.40000000000000002, 0.40000000000000002, 0.25))
     self.knotSpeed = DirectFrame(parent = self.spFrame, relief = None, state = DGG.DISABLED, pos = (-0.095000000000000001, 0, -0.055), text = PLocalizer.Knots % 0, text_align = TextNode.ACenter, text_scale = 0.040000000000000001, text_pos = (0.10000000000000001, -0.01), text_fg = PiratesGuiGlobals.TextFG1, text_wordwrap = 15, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceFont())
     circlecard = loader.loadModel('models/textureCards/skillIcons')
     base1 = circlecard.find('**/base')
     base2 = circlecard.find('**/base_over')
     base3 = circlecard.find('**/base_down')
     self.cargoMeter = GuiButton.GuiButton(parent = self, frameSize = (-0.045312499999999999, 0.045312499999999999, -0.045312499999999999, 0.045312499999999999), pos = (0.33000000000000002, 0, 0.20999999999999999), helpText = PLocalizer.CargoIconHelp, helpPos = (0.053999999999999999, 0, -0.10000000000000001), helpOpaque = 1, command = self.toggleCargo, image = (base1, base3, base2), image_scale = 0.10000000000000001, scale = 0.90000000000000002, relief = None)
     tex = loader.loadModel('models/gui/toplevel_gui').find('**/icon_crate')
     self.cargoLabel = DirectLabel(parent = self.cargoMeter, relief = None, state = DGG.DISABLED, image = tex, image_scale = 0.050000000000000003, image_color = (1, 1, 1, 0.80000000000000004), text = '0/0', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = (0.0044999999999999997, -0.025000000000000001), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont())
     self.crewMeter = GuiButton.GuiButton(parent = self, relief = None, frameSize = (-0.045312499999999999, 0.045312499999999999, -0.045312499999999999, 0.045312499999999999), pos = (0.46000000000000002, 0, 0.20999999999999999), helpText = PLocalizer.CrewIconHelp, helpPos = (-0.050000000000000003, 0, -0.10000000000000001), helpOpaque = 1, image = base1, image_scale = 0.10000000000000001, scale = 0.90000000000000002)
     icons = loader.loadModel('models/textureCards/icons')
     tex = icons.find('**/icon_stickman')
     self.crewLabel = DirectLabel(parent = self.crewMeter, relief = None, state = DGG.DISABLED, image = tex, image_scale = 0.080000000000000002, image_color = (1, 1, 1, 0.80000000000000004), text = '0/0', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = (0.0044999999999999997, -0.025000000000000001), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont())
     self.crewLabel.setTransparency(1, 1)
     gui = loader.loadModel('models/gui/avatar_chooser_rope')
     self.openPortLabel = DirectLabel(parent = base.a2dTopRight, relief = None, image = gui.find('**/avatar_c_A_middle'), image_scale = 0.29999999999999999, pos = (-0.23000000000000001, 0, -0.5), state = DGG.DISABLED, text = '', text_scale = 0.040000000000000001, text_align = TextNode.ACenter, text_pos = (0.0, -0.01), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getPirateBoldOutlineFont())
     self.openPortLabel.hide()
     self.setupPermissionUI()
     self.statusEffectsPanel = StatusEffectsPanel.StatusEffectsPanel(parent = self, pos = (0.29999999999999999, 0, 0.29999999999999999))
     self.statusEffectsPanel.iconScale = 0.65000000000000002
     self.armorGui = ShipArmorGui(self, pos = (0.14999999999999999, 0.14999999999999999, 0.14999999999999999))
     self.threatFrame = DirectFrame(parent = self, pos = (0.14999999999999999, 0, 0.155), relief = None, image = None, image_scale = 0.13500000000000001)
     self.accept('LocalAvatar_Ship_ThreatLevel_Update', self.setThreatLevel)
     self.accept('LocalAvatar_Ship_OpenPort_Update', self.setOpenPort)
     self.accept('settingLocalShip', self.handleLocalShipSet)
     self.accept('settingLocalShipId', self.handleLocalShipSet)
     self.handleLocalShipSet(quiet = 1)
Exemplo n.º 16
0
 def __init__(self, name, stats, playerStats, ship):
     GuiPanel.GuiPanel.__init__(self, '', self.width, self.height, showClose = False)
     self.ship = ship
     self.stats = stats
     self.playerStats = playerStats
     self.plunderHeight = 1.6499999999999999
     self.initialiseoptions(HighSeasScoreboard)
     self.leftPanel = None
     self.rightPanel = None
     self.addedLootInfoText = 0
     self.autoPlundered = 0
     self.preAutoPlundered = 0
     self.displayedGold = 0
     titleTxt = PLocalizer.ScoreboardTitle
     if self.ship.shipClass == ShipGlobals.BLACK_PEARL:
         titleTxt = PLocalizer.BlackPearlScoreboard
     else:
         titleTxt = PLocalizer.LootScoreboard
     self.title = DirectLabel(parent = self, relief = None, text = titleTxt, text_align = TextNode.ALeft, text_scale = self.titleHeight, text_fg = PiratesGuiGlobals.TextFG10, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.029999999999999999, 0, self.height - self.titleHeight - 0.029999999999999999), text_font = PiratesGlobals.getPirateOutlineFont(), textMayChange = 1)
     self.closeButton = DialogButton.DialogButton(parent = self, buttonStyle = DialogButton.DialogButton.NO, text = PLocalizer.lClose, pos = (1.05, 0, 0.074999999999999997), command = self.closePanel)
     self.labels = []
     self.grids = { }
     self.manager = base.localAvatar.guiMgr.inventoryUIManager
     self.buttonSize = self.manager.standardButtonSize
     main_gui = loader.loadModel('models/gui/gui_main')
     generic_x = main_gui.find('**/x2')
     generic_box = main_gui.find('**/exit_button')
     generic_box_over = main_gui.find('**/exit_button_over')
     main_gui.removeNode()
     self.newCloseButton = GuiButton.GuiButton(parent = self, relief = None, pos = (2.2999999999999998, 0, 1.0800000000000001), image = (generic_box, generic_box, generic_box_over, generic_box), image_scale = 0.40000000000000002, command = self.closePanel)
     xButton = OnscreenImage(parent = self.newCloseButton, image = generic_x, scale = 0.20000000000000001, pos = (-0.25600000000000001, 0, 0.76600000000000001))
     gui = loader.loadModel('models/gui/toplevel_gui')
     buttonImage = (gui.find('**/generic_button'), gui.find('**/generic_button_down'), gui.find('**/generic_button_over'), gui.find('**/generic_button_disabled'))
     gui.removeNode()
     self.takeAllButton = DirectButton(parent = self, relief = None, image = buttonImage, image_scale = (0.34999999999999998, 1.0, 0.22), image0_color = VBase4(0.65000000000000002, 0.65000000000000002, 0.65000000000000002, 1), image1_color = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1), image2_color = VBase4(0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1), image3_color = VBase4(0.40999999999999998, 0.40000000000000002, 0.40000000000000002, 1), text = PLocalizer.InventoryPlunderTakeAll, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_pos = (0, -0.01), text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (1.3, 0, 0.074999999999999997), command = self.takeAllLoot)
     self.takeAllIncidentalsButton = DirectButton(parent = self, relief = None, image = buttonImage, image_scale = (0.34999999999999998, 1.0, 0.22), image0_color = VBase4(0.65000000000000002, 0.65000000000000002, 0.65000000000000002, 1), image1_color = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1), image2_color = VBase4(0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1), image3_color = VBase4(0.40999999999999998, 0.40000000000000002, 0.40000000000000002, 1), text = PLocalizer.InventoryPlunderTakeAllSundries, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_pos = (0, -0.01), text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.80000000000000004, 0, 0.074999999999999997), command = self.requestAllIncidentals)
     self.setBin('gui-fixed', -1)
     self.autoLootList = [
         InventoryType.ItemTypeMoney,
         InventoryCategory.MONEY]
     self.incidentalsList = [
         InventoryType.ItemTypeMoney,
         InventoryType.ItemTypeConsumable,
         InventoryType.TreasureCollection,
         InventoryCategory.CARDS,
         InventoryCategory.MONEY,
         InventoryCategory.WEAPON_PISTOL_AMMO,
         InventoryCategory.WEAPON_GRENADE_AMMO,
         InventoryCategory.WEAPON_CANNON_AMMO,
         InventoryCategory.WEAPON_DAGGER_AMMO]
     self.incidentalsDict = { }
     base.hss = self
     self.initFlag = 0
     self.initPlunder()
Exemplo n.º 17
0
 def setup(self):
     self.setBin('gui-fixed', 0)
     self.buttonSize = self.manager.standardButtonSize
     self.inventoryPanelSell = InventoryUISellContainer.InventoryUISellContainer(self.manager, self.sellItem, sizeX = self.buttonSize * 3, sizeZ = self.buttonSize * 2, countX = 3, countZ = 2)
     self.inventoryPanelSell.setup()
     self.inventoryPanelSell.setPos(self.sizeX / 4.0 - 0.01, 0.0, self.sizeZ / 4.0 + 0.089999999999999997)
     self.inventoryPanelSell.reparentTo(self)
     self.messageLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.InventorySellMessage, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 16, text_shadow = PiratesGuiGlobals.TextShadow, pos = (self.sizeX * 0.5, 0.0, self.sizeZ * 0.84999999999999998))
     self.goldCostLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.InventorySellGoldCost % 0, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (self.sizeX * 0.5, 0.0, self.sizeZ * 0.25))
     Gui = loader.loadModel('models/gui/toplevel_gui')
     buttonImage = (Gui.find('**/generic_button'), Gui.find('**/generic_button_down'), Gui.find('**/generic_button_over'), Gui.find('**/generic_button_disabled'))
     self.confirmButton = GuiButton.GuiButton(parent = self, text = PLocalizer.InventorySell, text_fg = PiratesGuiGlobals.TextFG2, text_pos = (0.0, -0.014), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_shadow = PiratesGuiGlobals.TextShadow, image = GuiButton.GuiButton.blueGenericButton, image_scale = (0.59999999999999998, 0.59999999999999998, 0.59999999999999998), pos = (self.sizeX * 0.5, 0, 0.12), relief = None, command = self.confirmSale)
     self.confirmButton['state'] = DGG.DISABLED
     self.stackSeller = None
     main_gui = loader.loadModel('models/gui/gui_main')
     generic_x = main_gui.find('**/x2')
     generic_box = main_gui.find('**/exit_button')
     generic_box_over = main_gui.find('**/exit_button_over')
     main_gui.removeNode()
     closeButton = GuiButton.GuiButton(parent = self, relief = None, pos = (1.0, 0, -0.01), image = (generic_box, generic_box, generic_box_over, generic_box), image_scale = 0.40000000000000002, command = self.callback)
     xButton = OnscreenImage(parent = closeButton, image = generic_x, scale = 0.20000000000000001, pos = (-0.25600000000000001, 0, 0.76600000000000001))
     localAvatar.disableLootUI()
Exemplo n.º 18
0
 def createPortOfCall(self):
     if self.portOfCallLabel:
         self.portOfCallLabel.destroy()
     
     if self.portOfCallButton:
         self.portOfCallButton.destroy()
     
     compassGui = loader.loadModel('models/gui/compass_gui')
     topGui = loader.loadModel('models/gui/toplevel_gui')
     teleportIcon = topGui.find('**/treasure_w_b_slot_empty').copyTo(NodePath(''))
     compassGui.find('**/compass_icon_objective_green').copyTo(teleportIcon)
     teleportIcon.flattenStrong()
     self.portOfCallLabel = DirectLabel(parent = self, text = '', text_align = TextNode.ALeft, text_font = PiratesGlobals.getPirateOutlineFont(), text_scale = 0.044999999999999998, text_fg = PiratesGuiGlobals.TextFG2, textMayChange = 1, pos = (0.48999999999999999, 0, 0.072999999999999995))
     self.portOfCallButton = GuiButton.GuiButton(parent = self, pos = (0.38, 0, 0.085000000000000006), scale = 0.84999999999999998, text = PLocalizer.Return, text_pos = (0.033000000000000002, -0.014), text_scale = 0.044999999999999998, textMayChange = 1, image3_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), geom = teleportIcon, geom_pos = (-0.065000000000000002, 0, 0), geom_scale = 0.20000000000000001, command = self.handlePortOfCall)
Exemplo n.º 19
0
 def setPage(self, pageName, startIndex = 0):
     self.tabBar.unstash()
     self.titleLabel['text'] = '\x1smallCaps\x1' + self.rootTitle + ' - ' + PLocalizer.barberNames.get(pageName) + '\x2'
     if localAvatar.style.getGender() == 'm':
         GENDER = 'MALE'
     else:
         GENDER = 'FEMALE'
     self.currentPage = pageName
     startPos = Vec3(0.63, 0.0, 1.1000000000000001)
     buttonScale = Vec3(0.80000000000000004, 0.80000000000000004, 0.80000000000000004)
     for item in self.buttons:
         item.destroy()
     
     self.buttons = []
     choices = []
     regionData = []
     self.buttonIndex = startIndex
     self.itemAmount = 0
     self.reloadPirateDNA(self.pirate)
     startRange = 0
     if GENDER == 'MALE':
         if pageName == BarberGlobals.HAIR:
             startRange = BarberGlobals.MALE_HAIR
         elif pageName == BarberGlobals.BEARD:
             startRange = BarberGlobals.MALE_BEARD
         elif pageName == BarberGlobals.MUSTACHE:
             startRange = BarberGlobals.MALE_MUSTACHE
         
     elif GENDER == 'FEMALE':
         if pageName == BarberGlobals.HAIR:
             startRange = BarberGlobals.FEMALE_HAIR
         elif pageName == BarberGlobals.BEARD:
             startRange = BarberGlobals.FEMALE_BEARD
         elif pageName == BarberGlobals.MUSTACHE:
             startRange = BarberGlobals.FEMALE_MUSTACHE
         
     
     currentHair = localAvatar.style.getHairHair()
     currentBeard = localAvatar.style.getHairBeard()
     currentMustache = localAvatar.style.getHairMustache()
     currentHairColor = localAvatar.style.getHairColor()
     store = self.shopId
     set = BarberGlobals.stores.get(store)
     if set is None:
         return None
     
     for index in range(startRange, startRange + 9999):
         if index in set:
             item = BarberGlobals.barber_id.get(index)
             if item:
                 type = item[1]
                 cost = item[4]
                 itemId = item[0]
                 owned = False
                 holiday = item[5]
                 if type == BarberGlobals.HAIR:
                     if itemId == currentHair:
                         owned = True
                     
                 elif type == BarberGlobals.BEARD:
                     if itemId == currentBeard:
                         owned = True
                     
                 elif type == BarberGlobals.MUSTACHE:
                     if itemId == currentMustache:
                         owned = True
                     
                 
                 if holiday is not None:
                     if holiday in AccessoriesStoreGUI.holidayIdList:
                         choices.append([
                             index,
                             owned,
                             cost,
                             holiday])
                     
                 else:
                     choices.append([
                         index,
                         owned,
                         cost,
                         holiday])
             
     
     choices.sort(self.sortItems)
     for choice in choices:
         uid = choice[0]
         item = BarberGlobals.barber_id.get(uid)
         itemId = item[0]
         cost = item[4]
         owned = choice[1]
         text = item[2]
         type = item[1]
         shortDesc = item[2]
         longDesc = item[3]
         helpText = longDesc
         if type == BarberGlobals.MUSTACHE:
             if currentBeard in [
                 1,
                 2,
                 3]:
                 itemButton = GuiButton.GuiButton(parent = self.panel, state = DGG.DISABLED, text = PLocalizer.BarberNoMustache, text_fg = PiratesGuiGlobals.TextFG2, text_pos = (0.0, 0.050000000000000003), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_shadow = PiratesGuiGlobals.TextShadow, pos = startPos, image_scale = buttonScale)
                 self.buttons.append(itemButton)
                 self.pageNumber['text'] = '%s %s / %s' % (PLocalizer.TailorPage, 1, 1)
                 self.numPages = 1
                 for item in self.clothRenders:
                     item.hide()
                 
                 return None
             
         
         if self.itemAmount - startIndex < self.buttonsPerPage and self.itemAmount >= startIndex:
             itemButton = GuiButton.GuiButton(command = self.applyItem, parent = self.panel, state = DGG.NORMAL, text = text, text_fg = PiratesGuiGlobals.TextFG2, text_pos = (-0.040000000000000001, 0.070000000000000007), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_shadow = PiratesGuiGlobals.TextShadow, pos = startPos, image_scale = buttonScale, helpText = helpText, helpDelay = 0, helpPos = (0.0, 0.0, -0.12), helpLeftAlign = True, sortOrder = 1)
             itemButton['extraArgs'] = [
                 self.pirate,
                 type,
                 itemId,
                 itemButton]
             itemButton.cost = DirectFrame(parent = itemButton, relief = None, text = '%s%s' % (PLocalizer.Cost, str(cost)), text_fg = PiratesGuiGlobals.TextFG2, text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (-0.055, 0.0), text_shadow = PiratesGuiGlobals.TextShadow, image = self.CoinImage, image_scale = 0.14999999999999999, image_pos = (-0.025000000000000001, 0, 0.014999999999999999), pos = (0.29999999999999999, 0, -0.080000000000000002))
             itemButton.previewText = DirectFrame(parent = itemButton, relief = None, text = PLocalizer.TailorPreview, text_fg = PiratesGuiGlobals.TextFG1, text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleSmall, text_shadow = PiratesGuiGlobals.TextShadow, pos = (-0.089999999999999997, 0, -0.115))
             itemButton.buy = GuiButton.GuiButton(command = self.buyItem, parent = itemButton, text = PLocalizer.PurchaseCommit, text_fg = PiratesGuiGlobals.TextFG2, text_pos = (0.0, -0.01), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.25, 0.0, 0.089999999999999997), extraArgs = [
                 uid,
                 itemButton])
             startPos -= Vec3(0.0, 0.0, itemButton.getHeight() - 0.029999999999999999)
             itemButton.helpWatcher.setPos(itemButton.getPos())
             self.buttons.append(itemButton)
             regionData.append([
                 type,
                 uid])
             if cost > localAvatar.getMoney():
                 itemButton.buy['state'] = DGG.DISABLED
                 itemButton.cost['text_fg'] = PiratesGuiGlobals.TextFG6
             
             if owned:
                 if itemId == 0:
                     itemButton.buy['state'] = DGG.DISABLED
                     itemButton['state'] = DGG.DISABLED
                 
                 itemButton.previewText['text'] = PLocalizer.TattooShopOwned
             
             if itemId != 0 or GENDER == 'FEMALE':
                 xOffset = -0.050000000000000003
                 yOffset = 0.0
                 choices = list(availableHairColors)
                 holiday = HolidayGlobals.SAINTPATRICKSDAY
                 if holiday in BarberStoreGUI.holidayIdList:
                     choices.insert(0, 8)
                 
                 for i in choices:
                     hairColor = hairColors[i]
                     hairTone = (hairColor[0], hairColor[1], hairColor[2], 1.0)
                     button = DirectButton(parent = itemButton, relief = DGG.RAISED, pos = (xOffset, 0, yOffset), frameSize = (-0.024, 0.024, -0.025000000000000001, 0.025000000000000001), borderWidth = (0.0040000000000000001, 0.0040000000000000001), frameColor = hairTone, command = self.handleSetBaseColor, extraArgs = [
                         self.itemAmount,
                         type,
                         i,
                         itemButton], sortOrder = 2)
                     xOffset += 0.048000000000000001
                 
             
             if not self.paid:
                 itemButton.buy['geom'] = self.LockIcon
                 itemButton.buy['geom_scale'] = 0.20000000000000001
                 itemButton.buy['geom_pos'] = Vec3(-0.10000000000000001, 0.0, 0.0)
                 itemButton.buy['command'] = localAvatar.guiMgr.showNonPayer
                 itemButton.buy['extraArgs'] = [
                     'BARBER_CANNOT_BUY',
                     10]
             
             itemButton.color = currentHairColor
             itemButton.uid = uid
             itemButton.type = type
             itemButton.itemId = itemId
         
         self.itemAmount += 1
     
     if self.itemAmount > self.buttonsPerPage:
         numPages = float(self.itemAmount) / float(self.buttonsPerPage)
         remainder = numPages - int(numPages)
         if remainder > 0:
             numPages += 1.0 - remainder
         
         page = startIndex / self.buttonsPerPage + 1
     else:
         numPages = 1
         page = 1
     if len(choices):
         self.setupDisplayRegions(regionData, pageName)
     else:
         for item in self.clothRenders:
             item.hide()
         
     if self.itemAmount <= self.buttonsPerPage:
         self.nextPageButton['state'] = DGG.DISABLED
         self.prevPageButton['state'] = DGG.DISABLED
     
     if startIndex:
         self.prevPageButton['state'] = DGG.NORMAL
     
     if startIndex + self.buttonsPerPage < self.itemAmount:
         self.nextPageButton['state'] = DGG.NORMAL
         self.prevPageButton['state'] = DGG.NORMAL
     
     self.pageNumber['text'] = '%s %s / %s' % (PLocalizer.TailorPage, page, int(numPages))
     self.numPages = numPages
Exemplo n.º 20
0
    def updateList(self):
        self.recipeList.removeAndDestroyAllItems()
        self.buttons = []
        self.inactiveButtons = []
        playerLevel = self.potionGame.dist.getPlayerPotionLevel()
        notNew_list = self.potionGame.dist.getPlayerNotNewFlags()
        for recipe in self.potionGame.recipes:
            if playerLevel >= recipe.level:
                recipe.enabled = True
            else:
                recipe.enabled = False
            if recipe.enabled:
                recipe.haveMade = recipe.potionID not in notNew_list and False
            else:
                recipe.haveMade = True

        self.potionGame.recipes.sort()
        for recipe in self.potionGame.recipes:
            if recipe.questOnly:
                if localAvatar.getInventory():

                    class brewable(Exception):
                        __module__ = __name__

                    try:
                        for currQuest in localAvatar.getInventory(
                        ).getQuestList():
                            bonusComplete = currQuest.isComplete(bonus=True)
                            primaryComplete = currQuest.isComplete()
                            if not bonusComplete or not primaryComplete:
                                tasks = currQuest.getQuestDNA().getTaskDNAs()
                                for currTask in tasks:
                                    if isinstance(currTask, PotionsTaskDNA):
                                        raise (PotionGlobals.getPotionItemID(
                                            recipe.potionID)
                                               == currTask.potionType
                                               and not primaryComplete or
                                               PotionGlobals.getPotionItemID(
                                                   recipe.potionID)
                                               == currTask.potionTypeBonus and
                                               not bonusComplete) and brewable

                    except brewable:
                        pass
                    else:
                        continue
                if recipe.level - playerLevel > 3:
                    if not recipe.questOnly:
                        continue
                    buttonImage = None
                    recipe.loadIngredients()
                    buttonImageScale = 0.0
                    text = recipe.name
                    helptext = recipe.desc
                    if not recipe.haveMade:
                        if len(recipe.ingredients) > 0:
                            iconText = recipe.questOnly and PLocalizer.PotionGui[
                                'QuestLabel']
                            iconTextColor = PiratesGuiGlobals.TextFG13
                        else:
                            iconText = PLocalizer.PotionGui['NewLabel']
                            iconTextColor = PiratesGuiGlobals.TextFG1
                        guiAssets = loader.loadModel(
                            'models/minigames/pir_m_gui_pot_textureCard')
                        buttonImage = guiAssets.find(
                            '**/pir_t_gui_pot_seal').copyTo(NodePath())
                        buttonImageScale = 0.08
                        buttonText = DirectLabel(
                            parent=buttonImage,
                            relief=None,
                            text=iconText,
                            text_scale=PiratesGuiGlobals.TextScaleLarge /
                            buttonImageScale,
                            text_font=PiratesGlobals.getPirateOutlineFont(),
                            text_align=TextNode.ACenter,
                            text_fg=iconTextColor,
                            text_shadow=PiratesGuiGlobals.TextFG14,
                            hpr=(0, 0, 20),
                            pos=(-0.25, 0, 0),
                            textMayChange=0)
                        guiAssets.removeNode()
                    cmd = ((Freebooter.getPaidStatus(localAvatar.doId)
                            or recipe.isFree) and self).potionGame.selectRecipe
                    buttonGeom = None
                    buttonGeomScale = 1
                    buttonGeomPos = (0, 0, 0)
                    args = None
                else:
                    gui = loader.loadModel('models/gui/toplevel_gui')
                    buttonGeom = gui.find('**/pir_t_gui_gen_key_subscriber')
                    buttonGeomScale = 0.16
                    buttonGeomPos = (-0.05, 0, 0.01)
                    cmd = base.localAvatar.guiMgr.showNonPayer
                    args = ['Restricted_Potion_Crafting_Recipe', 9]
                    gui.removeNode()
                button = recipe.enabled and recipe.available and GuiButton.GuiButton(
                    text=(text, text, text, text),
                    canReposition=True,
                    text_wordwrap=0,
                    image_scale=buttonImageScale,
                    image_pos=(-0.04, 0.0, 0.01),
                    image=(buttonImage, buttonImage, buttonImage, buttonImage),
                    geom=buttonGeom,
                    geom_scale=buttonGeomScale,
                    geom_pos=buttonGeomPos,
                    text0_fg=PotionGlobals.TextColor,
                    text1_fg=PiratesGuiGlobals.TextFG0,
                    text2_fg=PiratesGuiGlobals.TextFG15,
                    text3_fg=PotionGlobals.TextColorDisabled,
                    text_align=TextNode.ALeft,
                    text_shadow=None,
                    text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
                    command=cmd,
                    state=DGG.NORMAL,
                    extraArgs=[recipe])
                button.bind(DGG.ENTER, recipe.showDetails)
                button.bind(DGG.EXIT, recipe.hideDetails)
                if button['image'][0]:
                    button['image_pos'] = (button.getBounds()[1] + 0.075, 0,
                                           0.01)
                self.buttons.append(button)
            else:
                button = GuiButton.GuiButton(
                    text=(text, text, text, text),
                    canReposition=True,
                    text_wordwrap=0,
                    image_scale=buttonImageScale,
                    image_pos=(-0.04, 0.0, 0.01),
                    image=(buttonImage, buttonImage, buttonImage, buttonImage),
                    geom=buttonGeom,
                    geom_scale=buttonGeomScale,
                    geom_pos=buttonGeomPos,
                    text0_fg=PotionGlobals.TextColorDisabled,
                    text1_fg=PotionGlobals.TextColorDisabled,
                    text2_fg=PotionGlobals.TextColorDisabled,
                    text3_fg=PotionGlobals.TextColorDisabled,
                    text_shadow=None,
                    text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
                    text_align=TextNode.ALeft,
                    state=DGG.NORMAL,
                    extraArgs=[recipe])
                button.bind(DGG.ENTER, recipe.showDetails)
                button.bind(DGG.EXIT, recipe.hideDetails)
                if button['image'][0]:
                    button['image_pos'] = (button.getBounds()[1] + 0.075, 0,
                                           0.01)
                self.inactiveButtons.append(button)
            self.recipeList.addItem(button)

        self.recipeList.refresh()
        self.lastIncButtonState = self.recipeList.incButton['state']
        self.lastDecButtonState = self.recipeList.decButton['state']
        self.recipeList.incButton['command'] = self.recipeList.scrollBy
        self.recipeList.incButton['extraArgs'] = [1]
        self.recipeList.decButton['command'] = self.recipeList.scrollBy
        self.recipeList.decButton['extraArgs'] = [-1]
        return
    def setup(self):
        self.buttonSize = self.manager.standardButtonSize
        self.grid = InventoryUIPlunderGridContainer.InventoryUIPlunderGridContainer(
            self.manager, self.buttonSize * 7, self.buttonSize * 3.0, 2, 3)
        self.grid.reparentTo(self)
        self.grid.setPos(self.sizeX * 0.5 - self.grid.sizeX * 0.4, 0.0, 0.25)
        self.grid.setScale(0.8)
        Gui = loader.loadModel('models/gui/char_gui')
        buttonImage = (Gui.find('**/chargui_text_block_large'),
                       Gui.find('**/chargui_text_block_large_down'),
                       Gui.find('**/chargui_text_block_large_over'),
                       Gui.find('**/chargui_text_block_large'))
        self.takeAllButton = GuiButton.GuiButton(
            parent=self,
            relief=None,
            image=buttonImage,
            image_scale=0.4,
            text=PLocalizer.InventoryPlunderTakeAll,
            text_font=PiratesGlobals.getInterfaceOutlineFont(),
            text_align=TextNode.ACenter,
            text_pos=(0, -0.01),
            text_scale=PiratesGuiGlobals.TextScaleLarge,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            pos=(self.sizeX * 0.8, 0, 0.2),
            helpText=PLocalizer.InventoryPlunderGiveNothingBack,
            helpPos=(0.1, 0, -0.07),
            helpOpaque=1,
            helpDelay=1.0,
            command=self.takeAllLoot)
        if self.takeAllButton.helpBox:
            self.takeAllButton.helpBox.setPos(0.3, 0, -0.01)
        if self.itemsToTake:
            self.takeAllButton.hide()
        if self.timer:
            self.timerUI = DirectLabel(
                parent=self,
                relief=None,
                pos=(0.64, 0, 0.21),
                text=str(self.timer),
                text_align=TextNode.ACenter,
                text_font=PiratesGlobals.getInterfaceOutlineFont(),
                text_fg=PiratesGuiGlobals.TextFG1,
                text_shadow=PiratesGuiGlobals.TextShadow,
                text_scale=PiratesGuiGlobals.TextScaleTitleSmall,
                text_pos=(0.0, -0.02))
            self.takeAllButton.setPos(Point3(0.825, 0, 0.2))
            self.timerStart = globalClock.getRealTime()
            taskMgr.add(self.__updateTimer,
                        self.taskName('plunderPanelTimeUpdate'))
        maingui = loader.loadModel('models/gui/gui_main')
        box = (maingui.find('**/exit_button'), maingui.find('**/exit_button'),
               maingui.find('**/exit_button_over'),
               maingui.find('**/exit_button'))
        x = maingui.find('**/x2')
        titleText = text = PLocalizer.InventoryPlunderTitle % self.typeName
        if self.customName:
            titleText = self.customName
        self.titleLabel = DirectLabel(
            parent=self,
            relief=None,
            pos=(0.5, 0, 0.68),
            text=titleText,
            text_align=TextNode.ACenter,
            text_font=PiratesGlobals.getInterfaceOutlineFont(),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_scale=PiratesGuiGlobals.TextScaleTitleSmall,
            text_pos=(0.0, -0.02),
            image=maingui.find('**/gui_inv_treasure_loot_bg'),
            image_scale=(0.3, 0.35, 0.35),
            image_pos=(0.04, 0, 0))
        self.closeButton = DirectButton(parent=self,
                                        relief=None,
                                        pos=(self.sizeX + 0.25, 0,
                                             self.sizeZ - 1.08),
                                        image=box,
                                        image_scale=0.5,
                                        geom=x,
                                        geom_scale=0.25,
                                        geom_pos=(-0.32, 0, 0.958),
                                        command=self.manager.closePlunder)
        if self.autoShow:
            self.closeButton.hide()
        self.ratingLabel = DirectLabel(
            parent=self,
            relief=None,
            text=PLocalizer.InventoryPlunderRating,
            text_align=TextNode.ALeft,
            text_font=PiratesGlobals.getInterfaceFont(),
            text_fg=PiratesGuiGlobals.TextFG16,
            text_scale=PiratesGuiGlobals.TextScaleLarge,
            pos=(self.sizeX * 0.1, 0, 0.2))
        if self.rating < 0:
            self.ratingLabel.hide()
        else:
            if self.itemsToTake:
                if self.itemsToTake == 1:
                    self.ratingLabel[
                        'text'] = PLocalizer.InventoryPlunderPickSingular
                else:
                    self.ratingLabel[
                        'text'] = PLocalizer.InventoryPlunderPickPlural % self.itemsToTake
            else:
                toplevelgui = loader.loadModel('models/gui/toplevel_gui')
                rating = self.attachNewNode('rating')
                rating.setPos(self.sizeX * 0.35, 0, 0.21)
                for i in range(0, 5):
                    skull = rating.attachNewNode('skull%s' % i)
                    toplevelgui.find('**/pir_t_gui_gen_goldSkull').copyTo(
                        skull)
                    skull.setScale(0.2)
                    skull.setX(i * 0.05)
                    if i >= self.rating:
                        skull.setColor(0, 0, 0, 0.25)

                rating.flattenStrong()
        self.setupPlunder(self.plunderList)
        self.accept('lootsystem-plunderContainer-Empty',
                    self.checkAllContainers)
        return
Exemplo n.º 22
0
    def loadGUI(self):
        shipcard = loader.loadModel('models/gui/ship_battle')
        tex = shipcard.find('**/ship_battle_speed_bar*')
        self.hpFrame = DirectFrame(parent = self, state = DGG.DISABLED, relief = None, image = tex, image_scale = (0.23000000000000001, 1, 0.5), pos = (0.40000000000000002, 0, 0.31), scale = 1.2)
        if self['shipOV']:
            hp = self['shipOV'].Hp
            maxHp = self['shipOV'].maxHp
            sp = self['shipOV'].Sp
            maxSp = self['shipOV'].maxSp
            if ShipSnapshot.PrivateerRepairOnLaunch and self['siegeTeam'] and self['shipOV'].state == 'Off':
                hp = maxHp
                sp = maxSp

        else:
            hp = self['hp']
            maxHp = self['maxHp']
            sp = self['sp']
            maxSp = self['maxSp']
        hpFraction = max(0, float(hp) / float(maxHp)) * 100.0
        spFraction = max(0, float(sp) / float(maxSp)) * 100.0
        if hpFraction >= 0.5:
            barColor = (0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1)
        elif hpFraction >= 0.25:
            barColor = (1.0, 1.0, 0.10000000000000001, 1)
        else:
            barColor = (1.0, 0.0, 0.0, 1)
        self.hpMeter = DirectWaitBar(parent = self.hpFrame, state = DGG.DISABLED, relief = DGG.RAISED, borderWidth = (0.002, 0.002), range = 100.0, value = hpFraction, frameColor = (0, 0, 0, 1), barColor = barColor, frameSize = (-0.222, 0.084000000000000005, -0.0089999999999999993, 0.0089999999999999993), pos = (0.069000000000000006, 0, 0.001), text = PLocalizer.Hull, text_scale = PiratesGuiGlobals.TextScaleLarge * 0.75, text_align = TextNode.ARight, text_pos = (-0.25, -0.0080000000000000002), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont())
        self.spFrame = DirectFrame(parent = self, state = DGG.DISABLED, relief = None, image = tex, image_scale = (0.23000000000000001, 1, 0.5), pos = (0.40000000000000002, 0, 0.26000000000000001), scale = 1.2)
        self.spMeter = DirectWaitBar(parent = self.spFrame, state = DGG.DISABLED, relief = DGG.RAISED, borderWidth = (0.002, 0.002), range = 100.0, value = spFraction, frameColor = (0, 0, 0, 1), barColor = (0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (-0.222, 0.084000000000000005, -0.0089999999999999993, 0.0089999999999999993), pos = (0.069000000000000006, 0, 0.001), text = PLocalizer.Speed, text_scale = PiratesGuiGlobals.TextScaleLarge * 0.75, text_align = TextNode.ARight, text_pos = (-0.25, -0.0080000000000000002), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont())
        cargoTex = shipcard.find('**/ship_battle_dish02*')
        if self['shipOV']:
            cargo = len(self['shipOV'].cargo)
            maxCargo = self['shipOV'].maxCargo
        else:
            cargo = self['cargo']
            maxCargo = self['maxCargo']
        self.cargoMeter = GuiButton.GuiButton(parent = self, state = DGG.DISABLED, relief = None, helpText = PLocalizer.CargoIconHelp2, helpPos = (0.10000000000000001, 0, 0.14999999999999999), image = cargoTex, image_scale = 0.32000000000000001, text = '%d/%d' % (cargo, maxCargo), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_pos = (0.0, -0.029999999999999999), text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.26300000000000001, 0, 0.17000000000000001))
        self.cargoLabel = DirectLabel(parent = self.cargoMeter, relief = None, state = DGG.DISABLED, text = PLocalizer.Cargo, text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleSmall, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.0, 0, 0.014999999999999999))
        if self['shipOV']:
            crew = self['shipOV'].crewCount
            maxCrew = self['shipOV'].maxCrew
        else:
            crew = self['crew']
            maxCrew = self['maxCrew']
        self.crewMeter = GuiButton.GuiButton(parent = self, state = DGG.DISABLED, relief = None, helpText = PLocalizer.CrewIconHelp, helpPos = (-0.10000000000000001, 0, 0.14999999999999999), image = cargoTex, image_scale = 0.32000000000000001, text = '%d/%d' % (crew, maxCrew), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_pos = (0.0, -0.029999999999999999), text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.40200000000000002, 0, 0.17000000000000001))
        self.crewLabel = DirectLabel(parent = self.crewMeter, relief = None, state = DGG.DISABLED, text = PLocalizer.Crew, text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleSmall, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.0, 0, 0.014999999999999999))
        if self['shipOV']:
            time = self['shipOV'].getTimeLeft()
        else:
            time = self['time']
        self.timer = PiratesTimer.PiratesTimer(showMinutes = True, mode = None, titleText = '', titleFg = '', infoText = '', cancelText = '', cancelCallback = None)
        self.timer.setFontColor(PiratesGuiGlobals.TextFG2)
        self.timer.reparentTo(self)
        self.timer.setScale(0.55000000000000004)
        self.timer.setPos(0.54000000000000004, 0, 0.17000000000000001)
        if time:
            self.timer.unstash()
            self.timer.countdown(time)
        else:
            self.timer.stash()
            self.timer.timerExpired()
    def __init__(self,
                 parent,
                 titleId,
                 position,
                 panelIndex,
                 titlesPage,
                 defaultOnLand=0,
                 defaultOnSea=0):
        DirectFrame.__init__(self, parent, pos=position)
        self.iconModel = loader.loadModel(TitleGlobals.getModelPath(titleId))
        tempModel = loader.loadModel('models/textureCards/skillIcons')
        self.titleId = titleId
        self.rank = 1
        self.maxRank = 1
        self.expPoints = 241
        self.expBase = 150
        self.expTarget = 400
        self.landActive = defaultOnLand
        self.seaActive = defaultOnSea
        self.panelIndex = panelIndex
        self.titlesPage = titlesPage
        self.booleanTitle = TitleGlobals.isBooleanTitle(self.titleId)
        topgui = loader.loadModel('models/gui/toplevel_gui')
        self.titleNameFrame = BorderFrame.BorderFrame(
            parent=self,
            relief=None,
            pos=(0.12, 0, 0.01),
            frameSize=(-0.14999999999999999, 0.5, -0.14999999999999999,
                       0.029999999999999999),
            modelName='pir_m_gui_frm_subframe',
            imageColorScale=VBase4(0.75, 0.75, 0.90000000000000002, 0.75),
            text=TitleGlobals.getTitleRankName(self.titleId, self.expPoints),
            text_align=TextNode.ALeft,
            text_scale=0.035000000000000003,
            text_pos=(0, -0.02),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_wordwrap=15,
            text_shadow=(0, 0, 0, 1),
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceFont())
        self.titleDescFrame = DirectFrame(
            parent=self,
            relief=None,
            pos=(0.125, 0, -0.095000000000000001),
            text=TitleGlobals.getTitleDesc(self.titleId),
            text_align=TextNode.ALeft,
            text_scale=0.029999999999999999,
            text_pos=(0, -0.01),
            text_fg=PiratesGuiGlobals.TextFG2,
            text_wordwrap=15,
            text_shadow=(0, 0, 0, 1),
            textMayChange=0,
            text_font=PiratesGlobals.getInterfaceFont())
        shipcard = loader.loadModel('models/gui/ship_battle')
        tex = shipcard.find('**/ship_battle_speed_bar*')
        self.expFrame = DirectFrame(parent=self,
                                    pos=(0.35999999999999999, 0,
                                         -0.050000000000000003),
                                    relief=None,
                                    image=tex,
                                    image_scale=(0.23000000000000001, 1, 0.5),
                                    scale=(1.48, 1, 1.2))
        self.expMeter = DirectWaitBar(
            parent=self.expFrame,
            relief=DGG.RAISED,
            borderWidth=(0.0040000000000000001, 0.0040000000000000001),
            range=100,
            value=50,
            frameColor=(0, 0, 0, 0),
            barColor=(223 / 255.0, 137 / 255.0, 28 / 255.0, 1),
            frameSize=(-0.222, 0.084000000000000005, -0.012, 0.012),
            pos=(0.069000000000000006, 0, 0.0))
        self.expMeterText = DirectFrame(
            parent=self,
            relief=None,
            pos=(0.59999999999999998, 0, 0.0),
            text='%s / %s' % (self.expBase, self.expTarget),
            text_align=TextNode.ARight,
            text_scale=0.029999999999999999,
            text_pos=(0, -0.01),
            text_fg=PiratesGuiGlobals.TextFG2,
            text_wordwrap=15,
            text_shadow=(0, 0, 0, 1),
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceFont())
        if self.booleanTitle:
            self.expFrame.hide()
            self.expMeterText.hide()

        imgScale = TitleGlobals.getScale(self.titleId)
        self.iconFrame = GuiButton.GuiButton(
            parent=self,
            pos=(0.040000000000000001, 0, -0.050000000000000003),
            helpText=TitleGlobals.getTitleName(self.titleId),
            helpPos=(-0.26000000000000001, 0, 0.080000000000000002),
            relief=None,
            image=self.iconModel.find(
                '**/' + TitleGlobals.getIconName(self.titleId, 1)),
            image_scale=(0.14999999999999999 * imgScale, 1,
                         0.14999999999999999 * imgScale))
        self.landButton = DirectButton.DirectButton(
            parent=self,
            pos=(0.70999999999999996, 0, -0.050000000000000003),
            relief=None,
            scale=0.22,
            image_color=VBase4(0.75, 0.84999999999999998, 1.0, 1.0),
            image=(topgui.find('**/pir_t_gui_frm_base_circle_over'),
                   topgui.find('**/pir_t_gui_frm_base_circle'),
                   topgui.find('**/pir_t_gui_frm_base_circle_over'),
                   topgui.find('**/pir_t_gui_frm_base_circle')),
            command=self.selectLandBadge,
            extraArgs=[self.panelIndex])
        self.titlesPage.landButtons.append(self.landButton)
        self.seaButton = DirectButton.DirectButton(
            parent=self,
            pos=(0.87, 0, -0.050000000000000003),
            relief=None,
            scale=0.22,
            image_color=VBase4(0.75, 0.84999999999999998, 1.0, 1.0),
            image=(topgui.find('**/pir_t_gui_frm_base_circle_over'),
                   topgui.find('**/pir_t_gui_frm_base_circle'),
                   topgui.find('**/pir_t_gui_frm_base_circle_over'),
                   topgui.find('**/pir_t_gui_frm_base_circle')),
            command=self.selectSeaBadge,
            extraArgs=[self.panelIndex])
        self.titlesPage.seaButtons.append(self.seaButton)
Exemplo n.º 24
0
    def loadTypeAName(self):
        self.nameEntry = DirectEntry(
            parent=self.parent,
            relief=DGG.FLAT,
            scale=0.16,
            width=MAX_NAME_WIDTH,
            numLines=2,
            focus=0,
            cursorKeys=1,
            autoCapitalize=1,
            frameColor=(0.0, 0.0, 0.0, 0.0),
            text=PL.NameGUI_EmptyNameText,
            text_fg=(1.0, 1.0, 0.5, 1.0),
            pos=(-0.65000000000000002, 0.0, -0.050000000000000003),
            suppressKeys=1,
            suppressMouse=1,
            image=self.charGui.find('**/chargui_frame02'),
            image_scale=(15, 0.0, 8.5),
            image_pos=(4.3899999999999997, 0.0, -0.20000000000000001))
        self.nameEntryGuidelines = DirectLabel(
            parent=self.parent,
            relief=None,
            text=PL.NameGUI_Guidelines,
            text_align=TextNode.ALeft,
            text_fg=PiratesGuiGlobals.TextFG3,
            text_pos=(0, 0.25),
            text_wordwrap=18,
            scale=0.10000000000000001,
            pos=(-0.69999999999999996, 0, -0.5))
        if self.cr:
            self.nameEntryGuidelinesURL = DirectButton(
                parent=self.parent,
                relief=None,
                pos=(0, 0, -0.55000000000000004),
                command=base.popupBrowser,
                extraArgs=[launcher.getValue('GAME_INGAME_NAMING')],
                text=PL.NameGUI_URLText,
                text0_fg=PiratesGuiGlobals.TextFG2,
                text1_fg=PiratesGuiGlobals.TextFG2,
                text2_fg=PiratesGuiGlobals.TextFG1,
                text_font=PiratesGlobals.getInterfaceFont(),
                text_shadow=PiratesGuiGlobals.TextShadow,
                text_scale=0.089999999999999997,
                text_pos=(0, -0.63500000000000001))

        func = lambda param=self: param.fsm.request('PickAName')
        self.pickANameButton = self._makeButton(
            text=PL.NameGUI_PickANameButtonText,
            command=func,
            pos=(0, 0, -1.7))
        if not self.independent:
            if not self.main.isNPCEditor:
                self.submitButton = self._makeButton(
                    text=PL.NameGUI_SubmitButtonText,
                    command=self._typedAName,
                    pos=(0, 0, 1.7))
                self.submitButton.hide()

        else:
            self.cancelButton = GuiButton.GuiButton(
                parent=self.bookModel,
                text=PL.MakeAPirateCancel,
                text_fg=(1, 1, 1, 1),
                text_scale=0.080000000000000002,
                text_pos=(0, -0.25 * 0.10000000000000001, 0),
                scale=1.8,
                image_scale=0.40000000000000002,
                command=self.cancel,
                pos=(-0.68000000000000005, 0, -2.4300000000000002))
            self.randomButton = GuiButton.GuiButton(
                parent=self.bookModel,
                text=PL.RandomButton,
                text_fg=(1, 1, 1, 1),
                text_scale=0.080000000000000002,
                text_pos=(0, -0.25 * 0.10000000000000001, 0),
                scale=1.8,
                image_scale=0.40000000000000002,
                command=self.makeRandomName,
                pos=(0.050000000000000003, 0, -2.4300000000000002))
            self.randomButton.hide()
            self.submitButton = GuiButton.GuiButton(
                parent=self.bookModel,
                text=PL.NameGUI_SubmitButtonText,
                text_fg=(1, 1, 1, 1),
                text_scale=0.080000000000000002,
                text_pos=(0, -0.25 * 0.10000000000000001, 0),
                scale=1.8,
                image_scale=0.40000000000000002,
                command=self.complete,
                pos=(0.78000000000000003, 0, -2.4300000000000002))
        self.typeANameGui.append(self.pickANameButton)
        self.typeANameGui.append(self.nameEntry)
        self.typeANameGui.append(self.nameEntryGuidelines)
        if self.cr:
            self.typeANameGui.append(self.nameEntryGuidelinesURL)

        self.hide()
Exemplo n.º 25
0
    def __init__(self, holidayId, wonInvasion, reputationEarned, enemiesKilled,
                 barricadesSaved, wavesCleared):
        DirectFrame.__init__(self,
                             relief=None,
                             parent=base.aspect2d,
                             image=None,
                             pos=(0.0, 0.0, 0.5))
        self.holidayId = holidayId
        self.wonInvasion = wonInvasion
        self.reputationEarned = reputationEarned
        self.enemiesKilled = enemiesKilled
        self.barricadesSaved = barricadesSaved
        self.wavesCleared = wavesCleared
        self.panel = None
        self.onIsland = False
        if localAvatar.getParentObj():
            if localAvatar.getParentObj().getUniqueId(
            ) == InvasionGlobals.getIslandId(self.holidayId):
                if localAvatar.getParentObj().minimap:
                    self.onIsland = True
                self.firePaths = []
                top_gui = loader.loadModel('models/gui/toplevel_gui')
                general_frame_gui = loader.loadModel(
                    'models/gui/general_frame')
                main_gui = loader.loadModel('models/gui/gui_main')
                background = general_frame_gui.find('**/middle')
                side_bar = main_gui.find('**/boarder_side')
                top_left = general_frame_gui.find('**/topLeft')
                top_right = general_frame_gui.find('**/topRight')
                bottom_left = general_frame_gui.find('**/bottomLeft')
                bottom_right = general_frame_gui.find('**/bottomRight')
                generic_x = main_gui.find('**/x2')
                generic_box = main_gui.find('**/exit_button')
                generic_box_over = main_gui.find('**/exit_button_over')
                parchment = top_gui.find('**/pir_t_gui_gen_parchment')
                wax_seal = top_gui.find('**/pir_t_gui_gen_waxSeal')
                fires = [
                    top_gui.find('**/pir_t_gui_gen_fire0'),
                    top_gui.find('**/pir_t_gui_gen_fire1'),
                    top_gui.find('**/pir_t_gui_gen_fire2')
                ]
                top_gui.removeNode()
                general_frame_gui.removeNode()
                main_gui.removeNode()
                if self.onIsland:
                    topLeftBackground = OnscreenImage(parent=self,
                                                      image=background,
                                                      scale=0.75,
                                                      pos=(0.75, 0.0, 0.0),
                                                      color=(0.3, 0.3, 0.3,
                                                             1.0))
                    topRightBackground = OnscreenImage(parent=self,
                                                       image=background,
                                                       scale=0.75,
                                                       pos=(1.5, 0.0, 0.0),
                                                       color=(0.3, 0.3, 0.3,
                                                              1.0))
                    bottomLeftBackground = OnscreenImage(parent=self,
                                                         image=background,
                                                         scale=0.75,
                                                         pos=(0.75, 0.0,
                                                              -0.75),
                                                         color=(0.3, 0.3, 0.3,
                                                                1.0))
                    bottomRightBackground = OnscreenImage(parent=self,
                                                          image=background,
                                                          scale=0.75,
                                                          pos=(1.5, 0.0,
                                                               -0.75),
                                                          color=(0.3, 0.3, 0.3,
                                                                 1.0))
                    leftBorder1 = OnscreenImage(parent=self,
                                                image=side_bar,
                                                scale=0.25,
                                                pos=(-0.26, 0.0, -0.53))
                    leftBorder2 = OnscreenImage(parent=self,
                                                image=side_bar,
                                                scale=0.25,
                                                pos=(-0.26, 0.0, -1.15))
                    rightBorder1 = OnscreenImage(parent=self,
                                                 image=side_bar,
                                                 scale=0.25,
                                                 pos=(1.235, 0.0, -0.53))
                    rightBorder2 = OnscreenImage(parent=self,
                                                 image=side_bar,
                                                 scale=0.25,
                                                 pos=(1.235, 0.0, -1.15))
                    topBorder1 = OnscreenImage(parent=self,
                                               image=side_bar,
                                               scale=0.25,
                                               pos=(0.53, 0.0, -0.26),
                                               hpr=(0, 0, -90))
                    topBorder2 = OnscreenImage(parent=self,
                                               image=side_bar,
                                               scale=0.25,
                                               pos=(1.15, 0.0, -0.26),
                                               hpr=(0, 0, -90))
                    bottomBorder1 = OnscreenImage(parent=self,
                                                  image=side_bar,
                                                  scale=0.25,
                                                  pos=(0.53, 0.0, -1.765),
                                                  hpr=(0, 0, -90))
                    bottomBorder2 = OnscreenImage(parent=self,
                                                  image=side_bar,
                                                  scale=0.25,
                                                  pos=(1.15, 0.0, -1.765),
                                                  hpr=(0, 0, -90))
                    topLeftCorner = OnscreenImage(parent=self,
                                                  image=top_left,
                                                  scale=1.0,
                                                  pos=(0.12, 0.0, -0.11))
                    topRightCorner = OnscreenImage(parent=self,
                                                   image=top_right,
                                                   scale=1.0,
                                                   pos=(1.38, 0.0, -0.11))
                    bottomLeftCorner = OnscreenImage(parent=self,
                                                     image=bottom_left,
                                                     scale=1.0,
                                                     pos=(0.12, 0.0, -1.39))
                    bottomRightCorner = OnscreenImage(parent=self,
                                                      image=bottom_right,
                                                      scale=1.0,
                                                      pos=(1.38, 0.0, -1.39))
                    titlePos = (0.75, 0, -0.08)
                    resultPos = (0.75, 0, -0.17)
                    scoreboardPos = (0.2, 0, -1.35)
                    closePos = (1.81, 0, -1.21)
                else:
                    leftBackground = OnscreenImage(parent=self,
                                                   image=background,
                                                   scale=0.75,
                                                   pos=(0.75, 0.0, -0.375),
                                                   color=(0.3, 0.3, 0.3, 1.0))
                    rightBackground = OnscreenImage(parent=self,
                                                    image=background,
                                                    scale=0.75,
                                                    pos=(1.5, 0.0, -0.375),
                                                    color=(0.3, 0.3, 0.3, 1.0))
                    leftBorder = OnscreenImage(parent=self,
                                               image=side_bar,
                                               scale=0.25,
                                               pos=(-0.26, 0.0, -0.84))
                    rightBorder = OnscreenImage(parent=self,
                                                image=side_bar,
                                                scale=0.25,
                                                pos=(1.235, 0.0, -0.84))
                    topBorder1 = OnscreenImage(parent=self,
                                               image=side_bar,
                                               scale=0.25,
                                               pos=(0.53, 0.0, -0.635),
                                               hpr=(0, 0, -90))
                    topBorder2 = OnscreenImage(parent=self,
                                               image=side_bar,
                                               scale=0.25,
                                               pos=(1.15, 0.0, -0.635),
                                               hpr=(0, 0, -90))
                    bottomBorder1 = OnscreenImage(parent=self,
                                                  image=side_bar,
                                                  scale=0.25,
                                                  pos=(0.53, 0.0, -1.39),
                                                  hpr=(0, 0, -90))
                    bottomBorder2 = OnscreenImage(parent=self,
                                                  image=side_bar,
                                                  scale=0.25,
                                                  pos=(1.15, 0.0, -1.39),
                                                  hpr=(0, 0, -90))
                    topLeftCorner = OnscreenImage(parent=self,
                                                  image=top_left,
                                                  scale=1.0,
                                                  pos=(0.12, 0.0, -0.485))
                    topRightCorner = OnscreenImage(parent=self,
                                                   image=top_right,
                                                   scale=1.0,
                                                   pos=(1.38, 0.0, -0.485))
                    bottomLeftCorner = OnscreenImage(parent=self,
                                                     image=bottom_left,
                                                     scale=1.0,
                                                     pos=(0.12, 0.0, -1.015))
                    bottomRightCorner = OnscreenImage(parent=self,
                                                      image=bottom_right,
                                                      scale=1.0,
                                                      pos=(1.38, 0.0, -1.015))
                    titlePos = (0.75, 0, -0.5)
                    resultPos = (0.75, 0, -0.59)
                    scoreboardPos = (0.2, 0, -0.9)
                    closePos = (1.81, 0, -1.585)
                titleTxt = PLocalizer.InvasionScoreboardTitle % PLocalizer.LocationNames[
                    InvasionGlobals.getIslandId(self.holidayId)]
                title = DirectLabel(
                    parent=self,
                    relief=None,
                    text=titleTxt,
                    text_align=TextNode.ACenter,
                    text_scale=0.07,
                    text_fg=PiratesGuiGlobals.TextFG1,
                    text_shadow=PiratesGuiGlobals.TextShadow,
                    pos=titlePos,
                    text_font=PiratesGlobals.getPirateOutlineFont())
                if self.wonInvasion:
                    resultText = PLocalizer.InvasionWon
                else:
                    resultText = PLocalizer.InvasionLost % PLocalizer.getInvasionMainZoneName(
                        HolidayGlobals.getHolidayName(self.holidayId))
                result = DirectLabel(
                    parent=self,
                    relief=None,
                    text=resultText,
                    text_align=TextNode.ACenter,
                    text_scale=PiratesGuiGlobals.TextScaleTitleMed,
                    text_fg=PiratesGuiGlobals.TextFG2,
                    text_shadow=PiratesGuiGlobals.TextShadow,
                    pos=resultPos,
                    text_font=PiratesGlobals.getPirateOutlineFont())
                self.screenNode = None
                self.screenNodeScale = None
                if self.onIsland:
                    parchmentImage = OnscreenImage(parent=self,
                                                   image=parchment,
                                                   scale=(0.8, 0, 0.95),
                                                   pos=(0.75, 0, -0.7))
                    self.screenNode = localAvatar.getParentObj(
                    ).minimap.getScreenNode()
                if self.screenNode:
                    self.screenNode.reparentTo(self)
                    screenInfo = InvasionGlobals.getScreenInfo(self.holidayId)
                    self.screenNode.setPos(screenInfo[0])
                    self.screenNodeScale = self.screenNode.getScale()
                    self.screenNode.setScale(screenInfo[1])
                    self.screenNode.show()
                waxSealImage = self.onIsland and self.wonInvasion and OnscreenImage(
                    parent=self,
                    image=wax_seal,
                    pos=(1.27, 0, -0.95),
                    scale=1.0)
                self.fireSeq = None
            else:
                for fireInfo in InvasionGlobals.getLossFires(self.holidayId):
                    firePath = NodePath(SequenceNode('SeqNode'))
                    firePath.setPos
                    firePath.setScale
                    for fireCard in fires:
                        firePath.node().addChild(fireCard.node())

                    firePath.node().setFrameRate(10)
                    firePath.node().loop(False)
                    firePath.reparentTo(self)
                    firePath.setPos(fireInfo[0])
                    firePath.setScale(fireInfo[1])
                    self.firePaths.append(firePath)

        closeButton = GuiButton.GuiButton(
            parent=self,
            relief=None,
            pos=closePos,
            image=(generic_box, generic_box, generic_box_over, generic_box),
            image_scale=0.6,
            command=localAvatar.guiMgr.removeInvasionScoreboard)
        xButton = OnscreenImage(parent=closeButton,
                                image=generic_x,
                                scale=0.3,
                                pos=(-0.382, 0, 1.15))
        self.createScoreboard(scoreboardPos)
        return
Exemplo n.º 26
0
    def __init__(self, playerId, avId, avName):
        GuiPanel.GuiPanel.__init__(self,
                                   PLocalizer.ReportPlayerTitle,
                                   0.69999999999999996,
                                   0.90000000000000002,
                                   showClose=False,
                                   titleSize=1)
        FSM.FSM.__init__(self, 'ReportAPlayer')
        self.initialiseoptions(ReportAPlayer)
        self.titleLabel['text_scale'] = PiratesGuiGlobals.TextScaleTitleSmall
        self.titleLabel.setPos(0.029999999999999999, 0, 0.81000000000000005)
        self.setPos(-(self.width) * 0.5, 0, -(self.height) * 0.5)
        self.setScale(1.3999999999999999)
        self.playerId = playerId
        self.avId = avId
        self.avName = avName
        self.category = None
        gui = loader.loadModel('models/gui/toplevel_gui')
        geomX = gui.find('**/generic_x')
        self.fieldText = DirectLabel(
            parent=self,
            relief=None,
            text='',
            text_align=TextNode.ALeft,
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_wordwrap=20,
            text_fg=PiratesGuiGlobals.TextFG2,
            pos=(0.050000000000000003, 0, 0.75),
            textMayChange=1)
        self.buttons = []
        for i in range(4):
            button = GuiButton.GuiButton(
                parent=self,
                text='',
                textMayChange=1,
                text_scale=PiratesGuiGlobals.TextScaleMed,
                text_pos=(0, -0.01),
                text_wordwrap=16,
                image_scale=(0.56000000000000005, 0.25, 0.25))
            button.hide()
            button.setPos(self.width * 0.5, 0, 0.5 + i * -0.10000000000000001)
            self.buttons.append(button)

        self.cancelButton = GuiButton.GuiButton(
            parent=self,
            text=PLocalizer.ReportPlayerCancel,
            textMayChange=1,
            text_scale=PiratesGuiGlobals.TextScaleMed,
            text_pos=(0.035000000000000003, -0.01),
            image_scale=(0.29999999999999999, 0.22, 0.22),
            geom=(geomX, ) * 4,
            geom_pos=(-0.059999999999999998, 0, 0),
            geom_scale=0.5,
            geom0_color=PiratesGuiGlobals.ButtonColor3[0],
            geom1_color=PiratesGuiGlobals.ButtonColor3[1],
            geom2_color=PiratesGuiGlobals.ButtonColor3[2],
            geom3_color=PiratesGuiGlobals.ButtonColor3[3],
            image3_color=(0.80000000000000004, 0.80000000000000004,
                          0.80000000000000004, 1),
            pos=(self.width * 0.5, 0, 0.074999999999999997),
            command=self.destroy)
        if base.cr.centralLogger.hasReportedPlayer(self.playerId, self.avId):
            self.request('AlreadyReported')
        else:
            self.request('TopMenu')
 def __init__(self, name, stats, playerStats, ship):
     GuiPanel.GuiPanel.__init__(self,
                                '',
                                self.width,
                                self.height,
                                showClose=False)
     self.ship = ship
     self.stats = stats
     self.playerStats = playerStats
     self.initialiseoptions(HighSeasScoreboard)
     self.leftPanel = None
     self.rightPanel = None
     titleTxt = PLocalizer.ScoreboardTitle
     if self.ship.shipClass == ShipGlobals.BLACK_PEARL:
         titleTxt = PLocalizer.BlackPearlScoreboard
     else:
         titleTxt = PLocalizer.LootScoreboard
     self.title = DirectLabel(
         parent=self,
         relief=None,
         text=titleTxt,
         text_align=TextNode.ALeft,
         text_scale=self.titleHeight,
         text_fg=PiratesGuiGlobals.TextFG10,
         text_shadow=PiratesGuiGlobals.TextShadow,
         pos=(0.029999999999999999, 0,
              self.height - self.titleHeight - 0.029999999999999999),
         text_font=PiratesGlobals.getPirateOutlineFont(),
         textMayChange=1)
     self.closeButton = DialogButton.DialogButton(
         parent=self,
         buttonStyle=DialogButton.DialogButton.NO,
         text=PLocalizer.lClose,
         pos=(1.05, 0, 0.074999999999999997),
         command=self.closePanel)
     self.grids = {}
     self.manager = base.localAvatar.guiMgr.inventoryUIManager
     self.buttonSize = self.manager.standardButtonSize
     main_gui = loader.loadModel('models/gui/gui_main')
     generic_x = main_gui.find('**/x2')
     generic_box = main_gui.find('**/exit_button')
     generic_box_over = main_gui.find('**/exit_button_over')
     main_gui.removeNode()
     self.newCloseButton = GuiButton.GuiButton(
         parent=self,
         relief=None,
         pos=(2.2999999999999998, 0, 1.0800000000000001),
         image=(generic_box, generic_box, generic_box_over, generic_box),
         image_scale=0.40000000000000002,
         command=self.closePanel)
     xButton = OnscreenImage(parent=self.newCloseButton,
                             image=generic_x,
                             scale=0.20000000000000001,
                             pos=(-0.25600000000000001, 0,
                                  0.76600000000000001))
     gui = loader.loadModel('models/gui/toplevel_gui')
     buttonImage = (gui.find('**/generic_button'),
                    gui.find('**/generic_button_down'),
                    gui.find('**/generic_button_over'),
                    gui.find('**/generic_button_disabled'))
     gui.removeNode()
     self.takeAllButton = DirectButton(
         parent=self,
         relief=None,
         image=buttonImage,
         image_scale=(0.26000000000000001, 1.0, 0.22),
         image0_color=VBase4(0.65000000000000002, 0.65000000000000002,
                             0.65000000000000002, 1),
         image1_color=VBase4(0.40000000000000002, 0.40000000000000002,
                             0.40000000000000002, 1),
         image2_color=VBase4(0.90000000000000002, 0.90000000000000002,
                             0.90000000000000002, 1),
         image3_color=VBase4(0.40999999999999998, 0.40000000000000002,
                             0.40000000000000002, 1),
         text=PLocalizer.InventoryPlunderTakeAll,
         text_font=PiratesGlobals.getPirateBoldOutlineFont(),
         text_align=TextNode.ACenter,
         text_pos=(0, -0.01),
         text_scale=PiratesGuiGlobals.TextScaleLarge,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         pos=(1.05, 0, 0.074999999999999997),
         command=self.takeAllLoot)
     self.setBin('gui-fixed', -1)
     self.createScoreboard()