Exemplo n.º 1
0
class PVPCompletePanel(BorderFrame):
    SUMMARY_PAGE = 1
    DETAILS_PAGE = 2
    
    def __init__(self, name, pvp):
        self.width = PiratesGuiGlobals.PVPCompletePanelWidth
        self.height = PiratesGuiGlobals.PVPCompletePanelHeight
        BorderFrame.__init__(self, frameSize = (self.width * 0.14999999999999999, self.width * 0.84999999999999998, self.height * 0.81999999999999995, self.height), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.94999999999999996, 0.75))
        self.secondLayer = BorderFrame(parent = self, relief = None, frameSize = (self.width * 0.14999999999999999, self.width * 0.84999999999999998, self.height * 0.81999999999999995, self.height), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
        self.initialiseoptions(PVPCompletePanel)
        self.endButton = GuiButton(parent = self, text = PLocalizer.PVPExit, command = pvp.requestPVPLeave, pos = (1.25, 0, 0.10000000000000001), image = GuiButton.redGenericButton, image_scale = 0.59999999999999998)
        self.endButton.setBin('gui-popup', 0)
        self.name = name
        self.title = DirectLabel(parent = self, relief = None, text = name, text_align = TextNode.ACenter, text_scale = 0.070000000000000007, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (1.25, 0, 1.6200000000000001))
        if pvp.hasTeams():
            team1Score = '0'
            team2Score = '0'
            for stat in pvp.scoreboardHolder.getItemList():
                if stat['Team'] == 1:
                    team1Score = stat['Score']
                    continue
                if stat['Team'] == 2:
                    team2Score = stat['Score']
                    continue
            
            self.team1ScoreLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.PVPTeamScore % (1, team1Score), text_align = TextNode.ACenter, text_scale = 0.040000000000000001, text_fg = PVPGlobals.getTeamColor(1), text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (1.05, 0, 1.55))
            self.team2ScoreLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.PVPTeamScore % (2, team2Score), text_align = TextNode.ACenter, text_scale = 0.040000000000000001, text_fg = PVPGlobals.getTeamColor(2), text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (1.45, 0, 1.55))
        
        self.outcome = DirectLabel(parent = self, relief = None, text = '', text_align = TextNode.ACenter, text_scale = 0.059999999999999998, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (1.25, 0, 1.45))
        if pvp.hasTeams():
            if team1Score > team2Score:
                self.outcome['text_fg'] = PVPGlobals.getTeamColor(1)
            elif team2Score > team1Score:
                self.outcome['text_fg'] = PVPGlobals.getTeamColor(2)
            
        
        self.borderTwo = BorderFrame(parent = self, relief = None, frameSize = (self.width * 0.14999999999999999, self.width * 0.84999999999999998, 0, self.height * 0.80000000000000004), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
        self.borderTwoSecondLayer = BorderFrame(parent = self.borderTwo, relief = None, frameSize = (self.width * 0.14999999999999999, self.width * 0.84999999999999998, 0, self.height * 0.80000000000000004), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
        self.two = ScoreFrame(PiratesGuiGlobals.PVPCompletePageWidth - 1.0, PiratesGuiGlobals.PVPCompletePageHeight, pvp.statsHolder, 0, sortOrder = 2)
        self.two.reparentTo(self.borderTwo)
        self.two.setPos(0.45000000000000001, 0, -0.14999999999999999)
        self.two.setup()
        self.game = pvp

    
    def setOutcome(self, outcome):
        self.outcome['text'] = outcome

    
    def destroy(self):
        self.borderTwoSecondLayer.destroy()
        self.borderTwoSecondLayer = None
        self.borderTwo.destroy()
        self.borderTwo = None
        self.two.destroy()
        self.two = None
        self.secondLayer.destroy()
        self.secondLater = None
        self.game = None
        BorderFrame.destroy(self)
Exemplo n.º 2
0
 def __init__(self, owner, avId):
     self.owner = owner
     self.avId = avId
     self.hp = 0
     self.maxHp = 0
     GuiButton.__init__(self, text='', text_scale=PiratesGuiGlobals.TextScaleSmall, text_pos=(0.025,
                                                                                              0.085), text_align=TextNode.ALeft, text_fg=self.OnlineTextColor, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, text_wordwrap=14, relief=None, borderWidth=PiratesGuiGlobals.BorderWidthSmall, frameColor=(0.45,
                                                                                                                                                                                                                                                                                                                     0.45,
                                                                                                                                                                                                                                                                                                                     0.35,
                                                                                                                                                                                                                                                                                                                     1.0), image_scale=(0.45,
                                                                                                                                                                                                                                                                                                                                        1,
                                                                                                                                                                                                                                                                                                                                        0.2), image_pos=(0.215,
                                                                                                                                                                                                                                                                                                                                                         0.0,
                                                                                                                                                                                                                                                                                                                                                         0.08), command=self.select)
     self.initialiseoptions(AvatarInfoButton)
     self.hpMeter = DirectWaitBar(parent=self, relief=DGG.RAISED, borderWidth=(0.004,
                                                                               0.004), range=50, value=20, frameColor=(0.05,
                                                                                                                       0.35,
                                                                                                                       0.05,
                                                                                                                       1), barColor=(0.1,
                                                                                                                                     0.7,
                                                                                                                                     0.1,
                                                                                                                                     1), pos=(0.015,
                                                                                                                                              0,
                                                                                                                                              0.06), frameSize=(0,
                                                                                                                                                                0.25,
                                                                                                                                                                0,
                                                                                                                                                                0.018), text='%s/%s' % (self.hp, self.maxHp), text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleMicro, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text_pos=(0.256,
                                                                                                                                                                                                                                                                                                                                                                             0,
                                                                                                                                                                                                                                                                                                                                                                             0.005), textMayChange=1)
     return
 def _createFooter(self, myParent):
     doWhatNextTxt = None
     txtScale = PiratesGuiGlobals.TextScaleLarge * 1.5
     DirectLabel(parent=myParent,
                 relief=None,
                 state=DGG.DISABLED,
                 text='%s/%s' % (self.panelNumber, self.numOfPanels),
                 text_scale=txtScale,
                 text_align=TextNode.ACenter,
                 text_fg=PiratesGuiGlobals.TextFG1,
                 text_shadow=PiratesGuiGlobals.TextShadow,
                 text_pos=(0, 0, 0),
                 text_font=self.bodyfont,
                 textMayChange=0,
                 pos=(2.1, 0, 0.03))
     self.prevButton = GuiButton(parent=self,
                                 pos=(1.85, 0, -0.05),
                                 text=PLocalizer.CannonDefense['Previous'])
     if self.roundComplete == RoundCompleteFlags.GAME_DEFEAT:
         doWhatNextTxt = PLocalizer.CannonDefense['Exit']
     else:
         doWhatNextTxt = PLocalizer.CannonDefense['Continue']
     self.nextButton = GuiButton(parent=self,
                                 pos=(2.1, 0, -0.05),
                                 text=doWhatNextTxt)
     return
Exemplo n.º 4
0
    def _Subtitler__loadOptionButtons(self, options, callback, extraArgs):
        def optionCallback(*args):
            self.advancePageNumber()
            callback(*args)

        for i in xrange(len(options)):
            optionButton = GuiButton(
                parent=base.a2dBottomRight,
                pos=(-0.14999999999999999 - (len(options) - 1 - i) * 0.25, 0,
                     0.095000000000000001),
                text=str(options[i]),
                text_pos=(0, -0.012500000000000001),
                text_scale=0.050000000000000003,
                text_fg=PiratesGuiGlobals.TextFG2,
                textMayChange=1,
                command=optionCallback,
                extraArgs=[options[i]] + extraArgs,
                sortOrder=90)
            if self.specialButtonImage:
                optionButton['image'] = self.specialButtonImage
                optionButton['image_scale'] = (0.59999999999999998,
                                               0.59999999999999998,
                                               0.59999999999999998)

            optionButton.hide()
            self._Subtitler__optionButtons.append(optionButton)
Exemplo n.º 5
0
 def _addedToMap(self, map):
     self.mapGeom.setScale(aspect2d, 0.059999999999999998)
     overlayNode = map.getOverlayNode()
     transform = self.mapGeom.getTransform(overlayNode)
     self.button = GuiButton(parent = overlayNode, state = DGG.NORMAL, image = self.mapGeom, pos = transform.getPos(), image_hpr = transform.getHpr(), image_scale = transform.getScale(), helpText = MinimapShop.HELP_DICT[self.shopType], helpPos = (-0.27000000000000002, 0, 0.070000000000000007), helpDelay = 0, helpOpaque = True, sortOrder = MinimapShop.SORT)
     self.button.setAlphaScale(1, 1)
     self.mapGeom.detachNode()
Exemplo n.º 6
0
    def __init__(self, potionGame):
        self.potionGame = potionGame
        DirectFrame.__init__(self, parent=potionGame.dialogs, relief=None)
        self.setPos((-0.5, 0, 0.075))
        guiAssets = loader.loadModel('models/minigames/pir_m_gui_pot_textureCard')
        parch = guiAssets.find('**/pir_t_gui_pot_potionIngredients')
        parch.setScale(3.45, 1, 3.45)
        parch.setPos(0.5, 0, -0.02)
        self.background = parch.copyTo(self)
        self.bQuit = GuiButton(image=(guiAssets.find('**/pir_t_gui_pot_exitIngredients'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredients')), scale=(0.3,
                                                                                                                                                                                                                                                                  0.3,
                                                                                                                                                                                                                                                                  0.3), command=self.quit)
        self.bQuit.reparentTo(self)
        self.bQuit.setPos(1.673, 0, 0.767)
        self.messageText = PLocalizer.PotionGui['InfoText']
        self.message = DirectLabel(parent=self, relief=None, text=self.messageText, text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_align=TextNode.ARight, text_fg=PotionGlobals.TextColor, text_shadow=None, pos=(-0.17, 0, 0.72), textMayChange=0)
        self.pieces = []
        self.pieceLabels = []
        for color in range(6):
            for level in range(6):
                piece = PotionBoardPiece(self, color, level + 1)
                piece.setPiecePosition(level * 0.112 - 0.277, 0.17 - color * 0.0709)
                piece.background.setDepthTest(False)
                piece.background.setDepthWrite(False)
                piece.setScale(0.35)
                self.pieces.append(piece)
                piecelabel = self.message = DirectLabel(parent=self, relief=None, text=PLocalizer.PotionIngredients[color][level], text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ACenter, text_fg=PotionGlobals.TextColor, text_shadow=None, pos=(level * 0.386 - 0.452, 0, 0.438 - color * 0.245), textMayChange=0)
                self.pieceLabels.append(piecelabel)

        guiAssets.removeNode()
        return
 def __init__(self, owner, avId):
     self.owner = owner
     self.avId = avId
     self.hp = 0
     self.maxHp = 0
     GuiButton.__init__(self, text = '', text_scale = PiratesGuiGlobals.TextScaleSmall, text_pos = (0.025000000000000001, 0.085000000000000006), text_align = TextNode.ALeft, text_fg = self.OnlineTextColor, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, text_wordwrap = 14, relief = None, borderWidth = PiratesGuiGlobals.BorderWidthSmall, frameColor = (0.45000000000000001, 0.45000000000000001, 0.34999999999999998, 1.0), image_scale = (0.45000000000000001, 1, 0.20000000000000001), image_pos = (0.215, 0.0, 0.080000000000000002), command = self.select)
     self.initialiseoptions(AvatarInfoButton)
     self.hpMeter = DirectWaitBar(parent = self, relief = DGG.RAISED, borderWidth = (0.0040000000000000001, 0.0040000000000000001), range = 50, value = 20, frameColor = (0.050000000000000003, 0.34999999999999998, 0.050000000000000003, 1), barColor = (0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1), pos = (0.014999999999999999, 0, 0.059999999999999998), frameSize = (0, 0.25, 0, 0.017999999999999999), text = '%s/%s' % (self.hp, self.maxHp), text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleMicro, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_pos = (0.25600000000000001, 0, 0.0050000000000000001), textMayChange = 1)
 def __init__(self, w, h, locationId = LocationIds.PORT_ROYAL_ISLAND):
     GuiPanel.GuiPanel.__init__(self, '', w, h, True)
     self.card = loader.loadModel('models/gui/pir_m_gui_fsh_legendaryScreen')
     self.storyImageCard = loader.loadModel('models/minigames/pir_m_gam_fsh_legendaryGui')
     self.UICompoments = { }
     self.setPos(-1.1499999999999999, 0.0, -0.59999999999999998)
     self['geom'] = self.card.find('**/background')
     self['geom_pos'] = (0.57999999999999996, 0.0, 0.63)
     self['geom_scale'] = (0.94999999999999996, 0.0, 0.84999999999999998)
     self.coinImage = OnscreenImage(parent = self, image = self.card.find('**/coin'), scale = 0.90000000000000002, hpr = (0, 0, 0), pos = (0.84999999999999998, 0, 0.84999999999999998))
     self.titleTextNode = TextNode('legendPanelTitle')
     self.titleTextNode.setText(PLocalizer.LegendSelectionGui['panelTitle'])
     self.titleTextNode.setFont(PiratesGlobals.getPirateFont())
     self.titleTextNode.setTextColor(0.87, 0.81999999999999995, 0.54000000000000004, 0.90000000000000002)
     self.titleTextNodePath = NodePath(self.titleTextNode)
     self.titleTextNodePath.setPos(0.65000000000000002, 0.0, 1.2)
     self.titleTextNodePath.setScale(0.070000000000000007)
     self.titleTextNodePath.reparentTo(self)
     self.introTextNode = TextNode('legendaryIntroTextNode')
     self.introTextNode.setText(PLocalizer.LegendSelectionGui['legendIntro'])
     self.introTextNode.setWordwrap(14.0)
     self.introTextNode.setTextColor(0.90000000000000002, 0.80000000000000004, 0.46999999999999997, 0.90000000000000002)
     self.introTextNodePath = NodePath(self.introTextNode)
     self.introTextNodePath.setPos(0.59999999999999998, 0.0, 0.5)
     self.introTextNodePath.setScale(0.042000000000000003)
     self.introTextNodePath.reparentTo(self)
     self.buttonRootNode = NodePath('button_RootNode')
     self.buttonRootNode.reparentTo(self)
     self.buttonRootNode.setPos(-0.080000000000000002, 0.0, 1.1499999999999999)
     self.iconCard = loader.loadModel('models/gui/treasure_gui')
     self.legendSelectionButtons = { }
     btnGeom = (self.card.find('**/fishButton/idle'), self.card.find('**/fishButton/idle'), self.card.find('**/fishButton/over'))
     for i in range(len(FishingGlobals.legendaryFishData)):
         fishName = FishingGlobals.legendaryFishData[i]['name']
         fishId = FishingGlobals.legendaryFishData[i]['id']
         assetsKey = CollectionMap.Assets[fishId]
         pos_x = 0.29999999999999999
         pos_z = 0.0 - i * 0.25
         button = GuiButton(parent = self.buttonRootNode, text = (fishName, fishName, fishName, fishName), text0_fg = (0.42999999999999999, 0.28999999999999998, 0.19, 1.0), text1_fg = (0.42999999999999999, 0.28999999999999998, 0.19, 1.0), text2_fg = (0.42999999999999999, 0.28999999999999998, 0.19, 1.0), text3_fg = (0.42999999999999999, 0.28999999999999998, 0.19, 1.0), text_scale = 0.035000000000000003, text_pos = (0.037999999999999999, -0.0050000000000000001), pos = (pos_x, 0, pos_z), hpr = (0, 0, 0), scale = 1.5, image = btnGeom, image_pos = (0, 0, 0), image_scale = 0.69999999999999996, sortOrder = 2, command = self.buttonClickHandle, extraArgs = [
             fishId,
             assetsKey,
             locationId])
         button.icon = OnscreenImage(parent = button, image = self.iconCard.find('**/%s*' % assetsKey), scale = 0.34999999999999998, hpr = (0, 0, 0), pos = (-0.123, 0, 0.0050000000000000001))
     
     self.legendPanel = GuiPanel.GuiPanel('', 2.6000000000000001, 1.8999999999999999, True)
     self.legendPanel.setPos(-1.3, 0.0, -0.94999999999999996)
     self.legendPanel.background = OnscreenImage(parent = self.legendPanel, scale = (2.3999999999999999, 0, 1.8), image = self.storyImageCard.find('**/pir_t_gui_fsh_posterBackground'), hpr = (0, 0, 0), pos = (1.3, 0, 0.94999999999999996))
     self.legendPanel.storyImage = OnscreenImage(parent = self.legendPanel, scale = 1, image = self.card.find('**/coin'), hpr = (0, 0, 0), pos = (1.8, 0, 1))
     self.storyTextNode = TextNode('storyTextNode')
     self.storyTextNode.setText('')
     self.storyTextNode.setWordwrap(19.0)
     self.storyTextNode.setTextColor(0.23000000000000001, 0.089999999999999997, 0.029999999999999999, 1.0)
     self.storyTextNodePath = NodePath(self.storyTextNode)
     self.storyTextNodePath.setPos(0.33000000000000002, 0.0, 1.6699999999999999)
     self.storyTextNodePath.setScale(0.050000000000000003)
     self.storyTextNodePath.reparentTo(self.legendPanel)
     self.callBack = None
     self.legendPanel.hide()
 def __init__(self, parent, **kw):
     optiondefs = (('nodePath', None, None), ('image_scale', (1.0, 1.0, 1.0), None))
     self.defineoptions(kw, optiondefs)
     GuiButton.__init__(self, parent)
     self.initialiseoptions(RepairGameButton)
     self.disabledStateNode = self.stateNodePath[3].getChild(0)
     self.downStateNode = self.stateNodePath[1].getChild(0)
     self.overStateNode = self.stateNodePath[2].getChild(0)
     self.inProgress = False
     self._initGUI()
Exemplo n.º 10
0
 def __init__(self, parent, **kw):
     optiondefs = (('nodePath', None, None), ('image_scale', (1.0, 1.0,
                                                              1.0), None))
     self.defineoptions(kw, optiondefs)
     GuiButton.__init__(self, parent)
     self.initialiseoptions(RepairGameButton)
     self.disabledStateNode = self.stateNodePath[3].getChild(0)
     self.downStateNode = self.stateNodePath[1].getChild(0)
     self.overStateNode = self.stateNodePath[2].getChild(0)
     self.inProgress = False
     self._initGUI()
Exemplo n.º 11
0
 def setupButtons(self):
     if self['buttonStyle'] == OTPDialog.YesNo:
         self.yesButton = GuiButton(parent = self, image_scale = (0.22, 0.22, 0.14999999999999999), pos = (0.27500000000000002, 0, -0.10000000000000001), text = PLocalizer.DialogYes, command = self.handleYes)
         self.noButton = GuiButton(parent = self, image_scale = (0.22, 0.22, 0.14999999999999999), pos = (0.55000000000000004, 0, -0.10000000000000001), text = PLocalizer.DialogNo, command = self.handleNo)
         self.adjustFrameForButtons()
     elif self['buttonStyle'] == OTPDialog.CancelOnly:
         lookoutUI = loader.loadModel('models/gui/lookout_gui')
         self.cancelButton = DirectButton(parent = self, relief = None, image = (lookoutUI.find('**/lookout_close_window'), lookoutUI.find('**/lookout_close_window_down'), lookoutUI.find('**/lookout_close_window_over'), lookoutUI.find('**/lookout_close_window_disabled')), pos = (0.75, 0, -0.050000000000000003), scale = 0.12, command = self.handleCancel)
     elif self['buttonStyle'] == OTPDialog.TwoChoice:
         self.boardButton = GuiButton(parent = self, image_scale = (0.14999999999999999, 0.22, 0.14999999999999999), pos = (0.55000000000000004, 0, -0.10000000000000001), text = PLocalizer.BoardShip, command = self.handleYes)
         lookoutUI = loader.loadModel('models/gui/lookout_gui')
         self.cancelButton = DirectButton(parent = self, relief = None, image = (lookoutUI.find('**/lookout_close_window'), lookoutUI.find('**/lookout_close_window_down'), lookoutUI.find('**/lookout_close_window_over'), lookoutUI.find('**/lookout_close_window_disabled')), pos = (0.75, 0, -0.050000000000000003), scale = 0.12, command = self.handleCancel)
         self['frameSize'] = (self['frameSize'][0], self['frameSize'][1], self['frameSize'][2] + 0.01, self['frameSize'][3])
         self.adjustFrameForButtons()
    def _Subtitler__loadOptionButtons(self, options, callback, extraArgs):

        def optionCallback(*args):
            self.advancePageNumber()
            callback(*args)

        for i in xrange(len(options)):
            optionButton = GuiButton(parent = base.a2dBottomRight, pos = (-0.14999999999999999 - (len(options) - 1 - i) * 0.25, 0, 0.095000000000000001), text = str(options[i]), text_pos = (0, -0.012500000000000001), text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG2, textMayChange = 1, command = optionCallback, extraArgs = [
                options[i]] + extraArgs, sortOrder = 90)
            if self.specialButtonImage:
                optionButton['image'] = self.specialButtonImage
                optionButton['image_scale'] = (0.59999999999999998, 0.59999999999999998, 0.59999999999999998)

            optionButton.hide()
            self._Subtitler__optionButtons.append(optionButton)
Exemplo n.º 13
0
 def _initButtons(self):
     self.sellButtonModel = loader.loadModel(
         'models/gui/pir_m_gui_can_buttonSell')
     self.sellButton = GuiButton(
         parent=self,
         image=(self.sellButtonModel.find('**/idle'),
                self.sellButtonModel.find('**/idle'),
                self.sellButtonModel.find('**/over')),
         image_scale=1,
         scale=0.40000000000000002,
         sortOrder=100,
         pos=(0, 0, -0.125),
         command=self.onSellClick)
     self.sellButton.bind(DGG.ENTER, self.showToolTip)
     self.sellButton.bind(DGG.EXIT, self.hideToolTip)
Exemplo n.º 14
0
 def _addedToMap(self, map):
     self.mapGeom.setScale(aspect2d, 0.3)
     overlayNode = map.getOverlayNode()
     worldNode = map.getWorldNode()
     transform = self.mapGeom.getTransform(overlayNode)
     self.hpMeter = HpMeter(width=0.4, parent=overlayNode)
     self.hpMeter.setP(-90)
     if self.zone != InvasionGlobals.getTotalCapturePoints(self.holidayId):
         self.hpMeter.setPos(transform.getPos() + (50, 0, 0))
     else:
         self.hpMeter.setPos(InvasionGlobals.getMainCapturePointHpPos(self.holidayId))
     self.hpMeter.setScale(transform.getScale())
     self.hpMeter['sortOrder'] = MinimapCapturePoint.SORT
     self.hpMeter.setAlphaScale(1, 1)
     self.hpMeter.categoryLabel['text_scale'] = 0.1
     self.hpMeter.update(1, 1)
     topGui = loader.loadModel('models/gui/toplevel_gui')
     if self.zone != InvasionGlobals.getTotalCapturePoints(self.holidayId):
         self.barricadeIcon = OnscreenImage(parent=self.mapGeom, image=topGui.find('**/pir_t_gui_gen_barricade'), scale=1.5, hpr=(0,
                                                                                                                                  90,
                                                                                                                                  0), color=(1.0,
                                                                                                                                             0.5,
                                                                                                                                             0.0,
                                                                                                                                             1))
     self.barricadeDestroyed = OnscreenImage(parent=overlayNode, image=topGui.find('**/pir_t_gui_gen_Xred'), scale=transform.getScale() * 4.0, pos=transform.getPos(), hpr=(0,
                                                                                                                                                                            -90,
                                                                                                                                                                            0))
     self.barricadeDestroyed.hide()
     topGui.removeNode()
     self.mouseOver = GuiButton(parent=self.hpMeter, relief=None, state=DGG.NORMAL, scale=3.0, image=None, frameSize=(-0.1, 0.15, -0.03, 0.03), helpText=PLocalizer.CapturePointNames[self.holidayId][self.zone], helpPos=(0.1, 0, -0.08), helpDelay=0, helpOpaque=True, sortOrder=MinimapShop.SORT)
     return
 def _addedToMap(self, map):
     self.mapGeom.setScale(aspect2d, 0.059999999999999998)
     overlayNode = map.getOverlayNode()
     transform = self.mapGeom.getTransform(overlayNode)
     self.button = GuiButton(parent = overlayNode, state = DGG.NORMAL, image = self.mapGeom, pos = transform.getPos(), image_hpr = transform.getHpr(), image_scale = transform.getScale(), helpText = MinimapShop.HELP_DICT[self.shopType], helpPos = (-0.27000000000000002, 0, 0.070000000000000007), helpDelay = 0, helpOpaque = True, sortOrder = MinimapShop.SORT)
     self.button.setAlphaScale(1, 1)
     self.mapGeom.detachNode()
 def _createFooter(self, myParent):
     txtScale = PiratesGuiGlobals.TextScaleLarge * 1.5
     if self.roundComplete == RoundCompleteFlags.WAVE_COMPLETE:
         nextWaveTxt = PLocalizer.CannonDefense['NextWave'] % '?'
         self.lblCountDown = DirectLabel(
             parent=myParent,
             relief=None,
             state=DGG.DISABLED,
             text=nextWaveTxt,
             text_scale=txtScale,
             text_align=TextNode.ARight,
             text_fg=PiratesGuiGlobals.TextFG1,
             text_shadow=PiratesGuiGlobals.TextShadow,
             text_pos=(0, 0, 0),
             text_font=self.bodyfont,
             textMayChange=1,
             pos=(2.25, 0, -0.059999999999999998))
         self.lblCountDown.hide()
     else:
         DirectLabel(parent=myParent,
                     relief=None,
                     state=DGG.DISABLED,
                     text='%s/%s' % (self.panelNumber, self.numOfPanels),
                     text_scale=txtScale,
                     text_align=TextNode.ACenter,
                     text_fg=PiratesGuiGlobals.TextFG1,
                     text_shadow=PiratesGuiGlobals.TextShadow,
                     text_pos=(0, 0, 0),
                     text_font=self.bodyfont,
                     textMayChange=0,
                     pos=(2.1000000000000001, 0, 0.029999999999999999))
         self.nextButton = GuiButton(parent=self,
                                     pos=(2.1000000000000001, 0,
                                          -0.050000000000000003),
                                     text=PLocalizer.CannonDefense['Next'])
 def __init__(self, potionGame):
     self.potionGame = potionGame
     DirectFrame.__init__(self, parent = potionGame.dialogs, relief = None)
     self.setPos((-0.5, 0, 0.074999999999999997))
     guiAssets = loader.loadModel('models/minigames/pir_m_gui_pot_textureCard')
     parch = guiAssets.find('**/pir_t_gui_pot_potionIngredients')
     parch.setScale(3.4500000000000002, 1, 3.4500000000000002)
     parch.setPos(0.5, 0, -0.02)
     self.background = parch.copyTo(self)
     self.bQuit = GuiButton(image = (guiAssets.find('**/pir_t_gui_pot_exitIngredients'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredients')), scale = (0.29999999999999999, 0.29999999999999999, 0.29999999999999999), command = self.quit)
     self.bQuit.reparentTo(self)
     self.bQuit.setPos(1.673, 0, 0.76700000000000002)
     self.messageText = PLocalizer.PotionGui['InfoText']
     self.message = DirectLabel(parent = self, relief = None, text = self.messageText, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ARight, text_fg = PotionGlobals.TextColor, text_shadow = None, pos = (-0.17000000000000001, 0, 0.71999999999999997), textMayChange = 0)
     self.pieces = []
     self.pieceLabels = []
     for color in range(6):
         for level in range(6):
             piece = PotionBoardPiece(self, color, level + 1)
             piece.setPiecePosition(level * 0.112 - 0.27700000000000002, 0.17000000000000001 - color * 0.070900000000000005)
             piece.background.setDepthTest(False)
             piece.background.setDepthWrite(False)
             piece.setScale(0.34999999999999998)
             self.pieces.append(piece)
             piecelabel = DirectLabel(parent = self, relief = None, text = PLocalizer.PotionIngredients[color][level], text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PotionGlobals.TextColor, text_shadow = None, pos = (level * 0.38600000000000001 - 0.45200000000000001, 0, 0.438 - color * 0.245), textMayChange = 0)
             self.message = DirectLabel(parent = self, relief = None, text = PLocalizer.PotionIngredients[color][level], text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PotionGlobals.TextColor, text_shadow = None, pos = (level * 0.38600000000000001 - 0.45200000000000001, 0, 0.438 - color * 0.245), textMayChange = 0)
             self.pieceLabels.append(piecelabel)
         
     
     guiAssets.removeNode()
Exemplo n.º 18
0
 def _initGUI(self):
     self.model = loader.loadModel('models/gui/pir_m_gui_srp_main')
     self.repairGamePicker = RepairGamePickerGUI(self, self.repairGame, self.model.find('**/group_picker'))
     self.staticElements = GUIFactory.generateStaticElements(self.model.getChild(0), self)
     self.textElements = { }
     self.textElements['title'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.91000000000000003), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.textElements['tutorial'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 14, scale = (0.044999999999999998, 0.044999999999999998, 0.044999999999999998), pos = (0.0, 0.0, 0.79500000000000004), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.textElements['level'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), scale = (0.052499999999999998, 0.052499999999999998, 0.052499999999999998), pos = (0.315, 0.0, 0.69999999999999996), relief = None, textMayChange = 1, text_align = TextNode.ARight, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.textElements['level'].stash()
     self.textElements['idleMessage'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 15, scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.0), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.textElements['cycleCompleteMessage'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 20, scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.0), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.closeButton = GuiButton(image = (self.model.find('**/esc_button/idle'), self.model.find('**/esc_button/over'), self.model.find('**/esc_button/over'), self.model.find('**/esc_button/idle')), image_scale = (0.75, 0.75, 0.75), image_pos = (0.074999999999999997, 0, 0.080000000000000002), hotkeys = [
         'Escape'], hotkeyLabel = PLocalizer.Minigame_Repair_Leave_Game_Text, pos = (-0.40000000000000002, 0.0, 0.01), parent = base.a2dBottomRight, command = self.handleExitGame)
     self.closeButton.setBin('background', -90)
     self.model.removeNode()
     del self.model
 def createGui(self):
     ShipFrame.createGui(self)
     self.nameLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(self['shipName'], 2), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_pos = (0.059999999999999998, 0.014999999999999999), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, frameColor = PiratesGuiGlobals.ButtonColor1[3], frameSize = (self['frameSize'][0] + 0.040000000000000001, self['frameSize'][1] - 0.029999999999999999, -0.0, 0.050000000000000003), pos = (0, 0, self['frameSize'][3] - 0.089999999999999997))
     self.classLabel = DirectLabel(parent = self.nameLabel, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.ShipClassNames.get(self['shipClass']), 1), text_font = PiratesGlobals.getInterfaceFont(), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_pos = (self.nameLabel['frameSize'][0] + 0.02, -0.029999999999999999))
     self.typeLabel = DirectLabel(parent = self.nameLabel, relief = None, state = DGG.DISABLED, text = '', text_pos = (0.59999999999999998, -0.029999999999999999), text_font = PiratesGlobals.getInterfaceFont(), text_scale = 0.032000000000000001, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), textMayChange = 0)
     self.stateLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_font = PiratesGlobals.getInterfaceFont(), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), text_pos = (0.19, 0.070000000000000007), text_scale = PiratesGuiGlobals.TextScaleLarge, textMayChange = 0)
     gui = loader.loadModel('models/gui/toplevel_gui')
     geomCheck = gui.find('**/generic_check')
     self.button = GuiButton(parent = self, pos = (0.73999999999999999, 0, 0.080000000000000002), text = PLocalizer.SelectShip, text_scale = PiratesGuiGlobals.TextScaleLarge, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0.035000000000000003, -0.014), geom = (geomCheck,) * 4, geom_pos = (-0.059999999999999998, 0, 0), geom_scale = 0.5, geom0_color = PiratesGuiGlobals.ButtonColor6[0], geom1_color = PiratesGuiGlobals.ButtonColor6[1], geom2_color = PiratesGuiGlobals.ButtonColor6[2], geom3_color = PiratesGuiGlobals.ButtonColor6[3], image3_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), helpPos = (-0.40000000000000002, 0, 0.029999999999999999), helpDelay = 0.29999999999999999, command = self['command'], extraArgs = self['extraArgs'])
Exemplo n.º 20
0
class MinimapShop(MinimapObject):
    SORT = 2
    SIGN_DICT = {'blacksmith': '**/shopCoin_blacksmith','shipwright': '**/shopCoin_shipwright','gunsmith': '**/shopCoin_gunsmith','weapons': '**/shopCoin_gunsmith','tailor': '**/shopCoin_tailor','barber': '**/shopCoin_barber','jeweler': '**/shopCoin_jeweler','tattoo': '**/shopCoin_tattoo','voodoo': '**/shopCoin_voodoo','gypsy': '**/shopCoin_voodoo','tavern': '**/shopCoin_tavern','fishmaster': '**/shopCoin_fishing','cannonmaster': '**/shopCoin_cannon','stowaway': '**/shopCoin_stowaway','catalogrep': '**/shopCoin_catalog'}
    SIGNS = {}
    HELP_DICT = {'blacksmith': PLocalizer.ShopBlacksmith,'shipwright': PLocalizer.ShopShipwright,'gunsmith': PLocalizer.ShopGunsmith,'weapons': PLocalizer.ShopGunsmith,'tailor': PLocalizer.ShopTailor,'barber': PLocalizer.ShopBarber,'jeweler': PLocalizer.ShopJewelry,'tattoo': PLocalizer.ShopTattoo,'voodoo': PLocalizer.ShopGypsy,'gypsy': PLocalizer.ShopGypsy,'tavern': PLocalizer.ShopTavern,'fishmaster': PLocalizer.ShopFishmaster,'cannonmaster': PLocalizer.ShopCannoneer,'stowaway': PLocalizer.ShopStowaway,'catalogrep': PLocalizer.ShopCatalogRep}

    @classmethod
    def loadSigns(cls):
        if not MinimapShop.SIGNS:
            coins = loader.loadModel('models/textureCards/shopCoins')
            for coin in coins.findAllMatches('**/shopCoin_*'):
                coin.setP(-90)
                coin.flattenStrong()

            for pattern, signName in MinimapShop.SIGN_DICT.iteritems():
                MinimapShop.SIGNS[pattern] = coins.find(signName)

    @classmethod
    def getShopType(cls, shopString):
        for pattern in MinimapShop.SIGN_DICT:
            if pattern in shopString:
                return pattern

        return None

    def __init__(self, uid, worldNode, shopType):
        self.loadSigns()
        worldNode.setHpr(0, 0, 0)
        MinimapObject.__init__(self, uid, worldNode, MinimapShop.SIGNS[shopType])
        self.shopType = shopType
        self.button = None
        return

    def _addedToMap(self, map):
        self.mapGeom.setScale(aspect2d, 0.06)
        overlayNode = map.getOverlayNode()
        transform = self.mapGeom.getTransform(overlayNode)
        self.button = GuiButton(parent=overlayNode, state=DGG.NORMAL, image=self.mapGeom, pos=transform.getPos(), image_hpr=transform.getHpr(), image_scale=transform.getScale(), helpText=MinimapShop.HELP_DICT[self.shopType], helpPos=(-0.27, 0, 0.07), helpDelay=0, helpOpaque=True, sortOrder=MinimapShop.SORT)
        self.button.setAlphaScale(1, 1)
        self.mapGeom.detachNode()

    def _removedFromMap(self, map):
        if self.button:
            self.button.destroy()
            self.button = None
        return

    def _updateOnMap(self, map):
        MinimapObject._updateOnMap(self, map)
        if self.button:
            if base.localAvatar.guiMgr.invasionScoreboard or base.localAvatar.isInInvasion():
                self.button.hide()
            else:
                self.button.show()
    def __init__(self):
        DirectFrame.__init__(self, relief=None)
        self.crewButtons = {}
        self.crewQuestInts = {}
        imagePos = (-0.45, 0.0, -0.3)
        self.images = loader.loadModel('models/gui/gui_bpcrew')
        for crewMember in self.crewData:
            uniqueId = crewMember.get('uniqueId')
            memberImage = self.images.find('**/' + crewMember.get('image'))
            containerName = crewMember.get('ladder')
            container = QuestLadderDB.getContainer(containerName)
            self.crewQuestInts[uniqueId] = QuestLadderDB.getAllParentQuestInts(container)
            self.crewButtons[uniqueId] = GuiButton(parent=self, pos=imagePos, state=DGG.DISABLED, image=memberImage, image_scale=0.18, geom_pos=imagePos)

        self.accept('clientLogout', self.destroy)
        return
 def _initGUI(self):
     self.model = loader.loadModel('models/gui/pir_m_gui_srp_main')
     self.repairGamePicker = RepairGamePickerGUI(self, self.repairGame, self.model.find('**/group_picker'))
     self.staticElements = GUIFactory.generateStaticElements(self.model.getChild(0), self)
     self.textElements = { }
     self.textElements['title'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.91000000000000003), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.textElements['tutorial'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 14, scale = (0.044999999999999998, 0.044999999999999998, 0.044999999999999998), pos = (0.0, 0.0, 0.79500000000000004), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.textElements['level'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), scale = (0.052499999999999998, 0.052499999999999998, 0.052499999999999998), pos = (0.315, 0.0, 0.69999999999999996), relief = None, textMayChange = 1, text_align = TextNode.ARight, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.textElements['level'].stash()
     self.textElements['idleMessage'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 15, scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.0), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.textElements['cycleCompleteMessage'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 20, scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.0), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
     self.closeButton = GuiButton(image = (self.model.find('**/esc_button/idle'), self.model.find('**/esc_button/over'), self.model.find('**/esc_button/over'), self.model.find('**/esc_button/idle')), image_scale = (0.75, 0.75, 0.75), image_pos = (0.074999999999999997, 0, 0.080000000000000002), hotkeys = [
         'Escape'], hotkeyLabel = PLocalizer.Minigame_Repair_Leave_Game_Text, pos = (-0.40000000000000002, 0.0, 0.01), parent = base.a2dBottomRight, command = self.handleExitGame)
     self.closeButton.setBin('background', -90)
     self.model.removeNode()
     del self.model
Exemplo n.º 23
0
 def setupButtons(self):
     if self['buttonStyle'] == OTPDialog.YesNo:
         self.yesButton = GuiButton(parent=self,
                                    image_scale=(0.22, 0.22, 0.15),
                                    pos=(0.275, 0, -0.1),
                                    text=PLocalizer.DialogYes,
                                    command=self.handleYes)
         self.noButton = GuiButton(parent=self,
                                   image_scale=(0.22, 0.22, 0.15),
                                   pos=(0.55, 0, -0.1),
                                   text=PLocalizer.DialogNo,
                                   command=self.handleNo)
         self.adjustFrameForButtons()
     else:
         if self['buttonStyle'] == OTPDialog.CancelOnly:
             lookoutUI = loader.loadModel('models/gui/lookout_gui')
             self.cancelButton = DirectButton(
                 parent=self,
                 relief=None,
                 image=(lookoutUI.find('**/lookout_close_window'),
                        lookoutUI.find('**/lookout_close_window_down'),
                        lookoutUI.find('**/lookout_close_window_over'),
                        lookoutUI.find('**/lookout_close_window_disabled')),
                 pos=(0.75, 0, -0.05),
                 scale=0.12,
                 command=self.handleCancel)
         else:
             if self['buttonStyle'] == OTPDialog.TwoChoice:
                 self.boardButton = GuiButton(parent=self,
                                              image_scale=(0.15, 0.22,
                                                           0.15),
                                              pos=(0.55, 0, -0.1),
                                              text=PLocalizer.BoardShip,
                                              command=self.handleYes)
                 lookoutUI = loader.loadModel('models/gui/lookout_gui')
                 self.cancelButton = DirectButton(
                     parent=self,
                     relief=None,
                     image=(lookoutUI.find('**/lookout_close_window'),
                            lookoutUI.find('**/lookout_close_window_down'),
                            lookoutUI.find('**/lookout_close_window_over'),
                            lookoutUI.find(
                                '**/lookout_close_window_disabled')),
                     pos=(0.75, 0, -0.05),
                     scale=0.12,
                     command=self.handleCancel)
                 self['frameSize'] = (self['frameSize'][0],
                                      self['frameSize'][1],
                                      self['frameSize'][2] + 0.01,
                                      self['frameSize'][3])
                 self.adjustFrameForButtons()
     return
 def __init__(self, gameObject = None):
     base.loadingScreen.beginStep('LegendaryGameGUI', 4, 20)
     self.gameObject = gameObject
     self.guiImage = loader.loadModel('models/minigames/pir_m_gam_fsh_legendaryGui')
     self.UICompoments = { }
     self.uiBaseNode = NodePath('baseNode')
     self.uiBaseNode.reparentTo(aspect2d)
     self.uiBaseNode.show()
     self.leftBaseNode = NodePath('leftBaseNode')
     self.leftBaseNode.reparentTo(base.a2dLeftCenter)
     self.leftBaseNode.show()
     self.fishActor = None
     self.actorAnim = { }
     self.scaleSize = {
         InventoryType.Collection_Set11_Part1: 0.059999999999999998,
         InventoryType.Collection_Set11_Part2: 0.055,
         InventoryType.Collection_Set11_Part3: 0.12,
         InventoryType.Collection_Set11_Part4: 0.086999999999999994,
         InventoryType.Collection_Set11_Part5: 0.080000000000000002 }
     self.meterFrame = DirectFrame(parent = self.leftBaseNode, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.0, 0.0), frameColor = (1.0, 1.0, 1.0, 0.0), relief = None, state = DGG.DISABLED, pos = (1.0, 0.0, -0.45000000000000001), hpr = (0, 0, 0), scale = (1.3, 0.0, 1.3), image = self.guiImage.find('**/pir_t_gui_fsh_meter'), image_scale = (0.20000000000000001, 0.0, 0.80000000000000004), image_pos = (0, 0, 0), text = '', textMayChange = 1, text_scale = PiratesGuiGlobals.TextScaleTitleLarge, text_pos = (-0.55000000000000004, 0.10000000000000001), text_shadow = PiratesGuiGlobals.TextShadow)
     self.UICompoments['meterFrame'] = self.meterFrame
     self.fishingRod = DirectFrame(parent = self.meterFrame, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.0, 0.0), relief = None, state = DGG.DISABLED, pos = FishingGlobals.fishingRodScreenPosition, image = self.guiImage.find('**/pir_t_gui_fsh_fullRod'), image_scale = (1.0, 0.0, 0.125), image_pos = (0.20000000000000001, 0, 0))
     self.fishingRod.setR(FishingGlobals.fishingRodInitSlope)
     self.UICompoments['fishingRod'] = self.fishingRod
     base.loadingScreen.tick()
     self.fishingHandleBaseFrame = DirectFrame(parent = self.uiBaseNode, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.5, 1.5), frameColor = (1.0, 1.0, 1.0, 0.0), relief = None, state = DGG.DISABLED, pos = (0.0, 0.0, 0.0), hpr = (0, 0, 0), scale = (0.71999999999999997, 0.0, 0.71999999999999997), image = self.guiImage.find('**/pir_t_gui_fsh_partialRod'), image_scale = (3.7999999999999998, 0.0, 1.8999999999999999), image_pos = (0, 0, 0), image_hpr = (0.0, 0.0, 0))
     self.fishingHandleBaseFrame.hide()
     self.UICompoments['fishingHandleBaseFrame'] = self.fishingHandleBaseFrame
     self.fishingHandle = DirectFrame(parent = self.fishingHandleBaseFrame, frameSize = (-0.080000000000000002, 0.080000000000000002, -0.20000000000000001, 0.20000000000000001), relief = None, state = DGG.DISABLED, pos = (-0.10000000000000001, 0.0, -0.050000000000000003), hpr = (0, 0, 0), image = self.guiImage.find('**/pir_t_gui_fsh_handleArm'), image_scale = (1.0, 0.0, 1.0), image_pos = (-0.042000000000000003, 0, -0.115), image_hpr = (0.0, 0.0, 0))
     self.UICompoments['fishingHandle'] = self.fishingHandle
     self.arrowImage = DirectFrame(parent = self.fishingHandleBaseFrame, frameSize = (-0.40000000000000002, 0.40000000000000002, -0.40000000000000002, 0.40000000000000002), relief = None, state = DGG.DISABLED, pos = (0.0, 0.0, 0.0), hpr = (0, 0, 0), scale = (1.2, 0.0, 1.2), image = self.guiImage.find('**/pir_t_gui_fsh_arrow'), image_scale = (1.0, 0.0, 1.0), image_pos = (0.0, 0, 0.0), image_hpr = (0.0, 0.0, 0.0))
     self.arrowImage.hide()
     self.UICompoments['arrowImage'] = self.arrowImage
     btnGeom = (self.guiImage.find('**/pir_t_gui_fsh_handle'), self.guiImage.find('**/pir_t_gui_fsh_handle'), self.guiImage.find('**/pir_t_gui_fsh_handleOn'))
     self.fishingHandleButton = GuiButton(pos = (-0.29999999999999999, 0, -0.55000000000000004), hpr = (0, 0, 0), scale = 0.45000000000000001, image = btnGeom, image_pos = (0, 0, 0), image_scale = 1.0, sortOrder = 2)
     self.fishingHandleButton.bind(DGG.B1PRESS, self.handleButtonClicked)
     self.fishingHandleButton.reparentTo(self.fishingHandle)
     self.UICompoments['fishingHandleButton'] = self.fishingHandleButton
     self.fishingHandleBaseFrame.setTransparency(TransparencyAttrib.MAlpha)
     self.meterFrame.setTransparency(TransparencyAttrib.MAlpha)
     self.lineOneTransitTextNode = TextNode('lineOneTransitText')
     self.lineOneTransitTextNode.setFont(PiratesGlobals.getPirateFont())
     self.lineOneTransitTextNode.setText('')
     self.lineOneTransitTextNode.setAlign(TextNode.ACenter)
     self.lineOneTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
     self.lineOneTransitTextNodePath = NodePath(self.lineOneTransitTextNode)
     self.lineOneTransitTextNodePath.setPos(0.0, 0.0, -0.80000000000000004)
     self.lineOneTransitTextNodePath.setScale(0.34999999999999998, 0.34999999999999998, 0.34999999999999998)
     self.lineOneTransitTextNodePath.reparentTo(self.uiBaseNode)
     self.lineOneTransitTextNodePath.hide()
     self.UICompoments['lineOneTransitText'] = self.lineOneTransitTextNodePath
     self.lineTwoTransitTextNode = TextNode('lineTwoTransitText')
     self.lineTwoTransitTextNode.setFont(PiratesGlobals.getPirateFont())
     self.lineTwoTransitTextNode.setText('')
     self.lineTwoTransitTextNode.setAlign(TextNode.ACenter)
     self.lineTwoTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
     self.lineTwoTransitTextNodePath = NodePath(self.lineTwoTransitTextNode)
     self.lineTwoTransitTextNodePath.setPos(-0.40000000000000002, 0.0, -0.94999999999999996)
     self.lineTwoTransitTextNodePath.setScale(0.12, 0.12, 0.12)
     self.lineTwoTransitTextNodePath.reparentTo(self.uiBaseNode)
     self.lineTwoTransitTextNodePath.hide()
     self.UICompoments['lineTwoTransitText'] = self.lineTwoTransitTextNodePath
     base.loadingScreen.tick()
     self.test_guiImage = loader.loadModel('models/gui/toplevel_gui')
     self.buttonIcon = (self.test_guiImage.find('**/treasure_chest_closed'), self.test_guiImage.find('**/treasure_chest_closed'), self.test_guiImage.find('**/treasure_chest_closed_over'))
     self.winImagePanel = GuiPanel.GuiPanel('', 2.6000000000000001, 1.8999999999999999, True)
     self.winImagePanel.setPos(-1.3, 0.0, -0.94999999999999996)
     self.winImagePanel.reparentTo(self.uiBaseNode)
     self.winImagePanel.background = OnscreenImage(parent = self.winImagePanel, scale = (2.3999999999999999, 0, 1.8), image = self.guiImage.find('**/pir_t_gui_fsh_posterBackground'), hpr = (0, 0, 0), pos = (1.3, 0, 0.94999999999999996))
     self.winImagePanel.setBin('gui-popup', -4)
     self.winTitleTextNode = TextNode('winTitleTextNode')
     self.winTitleTextNode.setText('Congratulations!')
     self.winTitleTextNode.setAlign(TextNode.ACenter)
     self.winTitleTextNode.setFont(PiratesGlobals.getPirateFont())
     self.winTitleTextNode.setTextColor(0.23000000000000001, 0.089999999999999997, 0.029999999999999999, 1.0)
     self.winTitleTextNodePath = NodePath(self.winTitleTextNode)
     self.winTitleTextNodePath.setPos(1.3500000000000001, 0.0, 1.6699999999999999)
     self.winTitleTextNodePath.setScale(0.17999999999999999)
     self.winTitleTextNodePath.reparentTo(self.winImagePanel)
     self.wholeStoryTextNode = TextNode('storyTextNode')
     self.wholeStoryTextNode.setText('')
     self.wholeStoryTextNode.setWordwrap(19.0)
     self.wholeStoryTextNode.setTextColor(0.23000000000000001, 0.089999999999999997, 0.029999999999999999, 1.0)
     self.wholeStoryTextNodePath = NodePath(self.wholeStoryTextNode)
     self.wholeStoryTextNodePath.setPos(0.33000000000000002, 0.0, 1.6399999999999999)
     self.wholeStoryTextNodePath.setScale(0.050000000000000003)
     self.wholeStoryTextNodePath.reparentTo(self.winImagePanel)
     self.winImagePanel.closeButton['command'] = self.closeDialogGotNextState
     self.winImagePanel.closeButton['extraArgs'] = [
         'winImagePanel',
         'FarewellLegendaryFish',
         False]
     self.UICompoments['winImagePanel'] = self.winImagePanel
     self.winImagePanel.hide()
     self.luiCloseDialogSequence = Sequence()
     self.arrowImageRotationInterval = LerpHprInterval(self.arrowImage, 2.2000000000000002, self.arrowImage.getHpr() + Point3(0.0, 0.0, 280.0), self.arrowImage.getHpr())
     self.luiArrowRotatingSequence = Sequence(Func(self.showGui, [
         'arrowImage']), Parallel(Func(self.arrowImageRotationInterval.start), Wait(2.2000000000000002)), Func(self.hideGui, [
         'arrowImage']), Func(self.arrowImage.setHpr, self.arrowImage.getHpr() + Point3(0.0, 0.0, 5.0)), name = self.gameObject.distributedFishingSpot.uniqueName('luiArrowRotatingSequence'))
     self.lineOneColorChange = LerpColorScaleInterval(self.lineOneTransitTextNodePath, FishingGlobals.legendaryTransitionTextDuration, (1.0, 1.0, 1.0, 0.0), (1.0, 1.0, 1.0, 1.0), blendType = 'easeOut')
     self.lineOnePosChange = LerpPosInterval(self.lineOneTransitTextNodePath, FishingGlobals.legendaryTransitionTextDuration, (0.0, 0.0, -0.20000000000000001), (0.0, 0.0, -0.80000000000000004), blendType = 'easeOut')
     self.lineTwoCholorChange = LerpColorScaleInterval(self.lineTwoTransitTextNodePath, FishingGlobals.legendaryTransitionTextDuration, (1.0, 1.0, 1.0, 1.0), (1.0, 1.0, 1.0, 1.0), blendType = 'easeOut')
     self.lineTwoPosChange = LerpPosInterval(self.lineTwoTransitTextNodePath, FishingGlobals.legendaryTransitionTextDuration, (0.0, 0.0, -0.32000000000000001), (0.0, 0.0, -0.94999999999999996), blendType = 'easeOut')
     self.transitionTextMovingSequence = Sequence(Func(self.lineOneTransitTextNodePath.show), Func(self.lineTwoTransitTextNodePath.show), Parallel(self.lineOnePosChange, self.lineTwoPosChange, self.lineOneColorChange, self.lineTwoCholorChange), Func(self.lineOneTransitTextNodePath.hide), Func(self.lineTwoTransitTextNodePath.hide), name = self.gameObject.distributedFishingSpot.uniqueName('transitionTextMovingSequence'))
     self.meterFadeInInterval = Sequence(Func(self.meterFrame.show), LerpColorScaleInterval(self.meterFrame, FishingGlobals.legendaryTransitionTextDuration, colorScale = (1.0, 1.0, 1.0, 1.0), startColorScale = (1.0, 1.0, 1.0, 0.0), blendType = 'easeOut'), name = 'FadeInLegendaryMeter')
     self.meterFadeOutInterval = Sequence(LerpColorScaleInterval(self.meterFrame, FishingGlobals.legendaryTransitionTextDuration, colorScale = (1.0, 1.0, 1.0, 0.0), startColorScale = (1.0, 1.0, 1.0, 1.0), blendType = 'easeOut'), Func(self.meterFrame.hide), name = 'FadeOutLegendaryMeter')
     self.rodFadeInInterval = Sequence(Func(self.fishingHandleBaseFrame.show), LerpColorScaleInterval(self.fishingHandleBaseFrame, FishingGlobals.legendaryTransitionTextDuration, colorScale = (1.0, 1.0, 1.0, 1.0), startColorScale = (1.0, 1.0, 1.0, 0.0), blendType = 'easeOut'), name = 'FadeInLegendaryRodInterface')
     self.rodFadeOutInterval = Sequence(LerpColorScaleInterval(self.fishingHandleBaseFrame, FishingGlobals.legendaryTransitionTextDuration, colorScale = (1.0, 1.0, 1.0, 0.0), startColorScale = (1.0, 1.0, 1.0, 1.0), blendType = 'easeOut'), Func(self.fishingHandleBaseFrame.hide), name = 'FadeOutLegendaryRodInterface')
     base.loadingScreen.tick()
     smallScale = self.fishingHandleButton['scale']
     bigScale = self.fishingHandleButton['scale'] * 1.2
     self.buttonGrowUpInterval = LerpScaleInterval(self.fishingHandleButton, 1.0, bigScale, smallScale)
     self.luiFightTransitSequence = Sequence(Parallel(Func(self.fishingHandleBaseFrame.show), Func(self.meterFadeOutInterval.start), Func(self.rodFadeInInterval.start), Func(self.buttonGrowUpInterval.start)), Wait(1.0), Func(self.meterFrame.hide), name = self.gameObject.distributedFishingSpot.uniqueName('luiFightTransitSequence'))
     self.luiReelTransitSequence = Sequence(Parallel(Func(self.fishingHandleBaseFrame.show), Func(self.meterFadeOutInterval.start), Func(self.rodFadeInInterval.start)), Wait(1.0), Func(self.meterFrame.hide), name = self.gameObject.distributedFishingSpot.uniqueName('luiReelTransitSequence'))
     self.luiStruggleTransitSequence = Sequence(Parallel(Func(self.meterFrame.show), Func(self.resetFishingRod), self.meterFadeInInterval, self.rodFadeOutInterval), Wait(1.0), Func(self.fishingHandleBaseFrame.hide), name = self.gameObject.distributedFishingSpot.uniqueName('luiStruggleTransitSequence'))
     self.meterFadeOutInterval.start()
     self.rodFadeOutInterval.start()
     self.hideAllGUI()
     base.loadingScreen.endStep('LegendaryGameGUI')
 def initializeTableInterface(self):
     self.levelUpIval = None
     self.swapCard = False
     self.cardSwapIndex = 0
     self.swapDialog = None
     self.leaveDialog = None
     self.swapResultDialog = None
     self.timer = False
     self.timeout = False
     self.buttonArray = []
     self.suitGeomArray = []
     if not True:
         self.suitGeomArray.append(self.suitImage(0))
         self.suitGeomArray.append(self.suitImage(1))
         self.suitGeomArray.append(self.suitImage(2))
         self.suitGeomArray.append(self.suitImage(3))
     else:
         self.suitIcons = loader.loadModel('models/gui/suit_icons')
         if self.suitIcons:
             scale = 0.080000000000000002
             icon = self.suitIcons.find('**/suit_icon_h')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_d')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_c')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_s')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
         else:
             self.suitGeomArray = [
                 None,
                 None,
                 None,
                 None]
     x = -0.35999999999999999
     y = 0.070000000000000007
     x_increment = 0.23999999999999999
     text = PLocalizer.TableLeave
     button = GuiButton(parent = self.menu, command = self.leaveAction, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         PlayingCardGlobals.Leave])
     self.leaveButton = button
     self.buttonArray = self.buttonArray + [
         button]
     button.show()
     text = PLocalizer.TableCancel
     button = GuiButton(parent = self.menu, command = self.cancelSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         0])
     self.cancelButton = button
     self.buttonArray = self.buttonArray + [
         button]
     button.hide()
     x = x + x_increment
     self.suit = 0
     self.rank = 0
     self.cardSwapIndex = 0
     self.suitButtonArray = []
     self.rankButtonArray = []
     x = -0.35999999999999999
     y = 0.17749999999999999
     x_increment = 0.23999999999999999
     suit = 0
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent = self.menu, command = self.cardSuitSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         suit])
     self.suitButtonArray = self.suitButtonArray + [
         button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent = self.menu, command = self.cardSuitSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         suit])
     self.suitButtonArray = self.suitButtonArray + [
         button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent = self.menu, command = self.cardSuitSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         suit])
     self.suitButtonArray = self.suitButtonArray + [
         button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent = self.menu, command = self.cardSuitSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         suit])
     self.suitButtonArray = self.suitButtonArray + [
         button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     x = -0.35999999999999999 - 0.059999999999999998
     y = 0.17749999999999999
     x_increment = 0.12
     rank = 0
     text = PLocalizer.Card2
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card3
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card4
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card5
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card6
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card7
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card8
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card9
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     x = -0.35999999999999999 - 0.059999999999999998
     y = 0.070000000000000007
     x_increment = 0.12
     x = x + x_increment
     x = x + x_increment
     x = x + x_increment
     text = PLocalizer.CardT
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardJ
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardQ
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardK
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardA
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
class MinimapShop(MinimapObject):
    SORT = 2
    SIGN_DICT = {
        'blacksmith': '**/shopCoin_blacksmith',
        'shipwright': '**/shopCoin_shipwright',
        'gunsmith': '**/shopCoin_gunsmith',
        'weapons': '**/shopCoin_gunsmith',
        'tailor': '**/shopCoin_tailor',
        'barber': '**/shopCoin_barber',
        'jeweler': '**/shopCoin_jeweler',
        'tattoo': '**/shopCoin_tattoo',
        'voodoo': '**/shopCoin_voodoo',
        'gypsy': '**/shopCoin_voodoo',
        'tavern': '**/shopCoin_tavern',
        'fishmaster': '**/shopCoin_fishing',
        'cannonmaster': '**/shopCoin_cannon',
        'stowaway': '**/shopCoin_stowaway',
        'catalogrep': '**/shopCoin_catalog' }
    SIGNS = { }
    HELP_DICT = {
        'blacksmith': PLocalizer.ShopBlacksmith,
        'shipwright': PLocalizer.ShopShipwright,
        'gunsmith': PLocalizer.ShopGunsmith,
        'weapons': PLocalizer.ShopGunsmith,
        'tailor': PLocalizer.ShopTailor,
        'barber': PLocalizer.ShopBarber,
        'jeweler': PLocalizer.ShopJewelry,
        'tattoo': PLocalizer.ShopTattoo,
        'voodoo': PLocalizer.ShopGypsy,
        'gypsy': PLocalizer.ShopGypsy,
        'tavern': PLocalizer.ShopTavern,
        'fishmaster': PLocalizer.ShopFishmaster,
        'cannonmaster': PLocalizer.ShopCannoneer,
        'stowaway': PLocalizer.ShopStowaway,
        'catalogrep': PLocalizer.ShopCatalogRep }
    
    def loadSigns(cls):
        if not MinimapShop.SIGNS:
            coins = loader.loadModel('models/textureCards/shopCoins')
            for coin in coins.findAllMatches('**/shopCoin_*'):
                coin.setP(-90)
                coin.flattenStrong()
            
            for (pattern, signName) in MinimapShop.SIGN_DICT.iteritems():
                MinimapShop.SIGNS[pattern] = coins.find(signName)
            
        

    loadSigns = classmethod(loadSigns)
    
    def getShopType(cls, shopString):
        for pattern in MinimapShop.SIGN_DICT:
            if pattern in shopString:
                return pattern
                continue
        

    getShopType = classmethod(getShopType)
    
    def __init__(self, uid, worldNode, shopType):
        self.loadSigns()
        worldNode.setHpr(0, 0, 0)
        MinimapObject.__init__(self, uid, worldNode, MinimapShop.SIGNS[shopType])
        self.shopType = shopType
        self.button = None

    
    def _addedToMap(self, map):
        self.mapGeom.setScale(aspect2d, 0.059999999999999998)
        overlayNode = map.getOverlayNode()
        transform = self.mapGeom.getTransform(overlayNode)
        self.button = GuiButton(parent = overlayNode, state = DGG.NORMAL, image = self.mapGeom, pos = transform.getPos(), image_hpr = transform.getHpr(), image_scale = transform.getScale(), helpText = MinimapShop.HELP_DICT[self.shopType], helpPos = (-0.27000000000000002, 0, 0.070000000000000007), helpDelay = 0, helpOpaque = True, sortOrder = MinimapShop.SORT)
        self.button.setAlphaScale(1, 1)
        self.mapGeom.detachNode()

    
    def _removedFromMap(self, map):
        if self.button:
            self.button.destroy()
            self.button = None
        

    
    def _updateOnMap(self, map):
        MinimapObject._updateOnMap(self, map)
        if self.button:
            if base.localAvatar.guiMgr.invasionScoreboard or base.localAvatar.isInInvasion():
                self.button.hide()
            else:
                self.button.show()
class PotionInfo(DirectFrame):
    
    def __init__(self, potionGame):
        self.potionGame = potionGame
        DirectFrame.__init__(self, parent = potionGame.dialogs, relief = None)
        self.setPos((-0.5, 0, 0.074999999999999997))
        guiAssets = loader.loadModel('models/minigames/pir_m_gui_pot_textureCard')
        parch = guiAssets.find('**/pir_t_gui_pot_potionIngredients')
        parch.setScale(3.4500000000000002, 1, 3.4500000000000002)
        parch.setPos(0.5, 0, -0.02)
        self.background = parch.copyTo(self)
        self.bQuit = GuiButton(image = (guiAssets.find('**/pir_t_gui_pot_exitIngredients'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredients')), scale = (0.29999999999999999, 0.29999999999999999, 0.29999999999999999), command = self.quit)
        self.bQuit.reparentTo(self)
        self.bQuit.setPos(1.673, 0, 0.76700000000000002)
        self.messageText = PLocalizer.PotionGui['InfoText']
        self.message = DirectLabel(parent = self, relief = None, text = self.messageText, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ARight, text_fg = PotionGlobals.TextColor, text_shadow = None, pos = (-0.17000000000000001, 0, 0.71999999999999997), textMayChange = 0)
        self.pieces = []
        self.pieceLabels = []
        for color in range(6):
            for level in range(6):
                piece = PotionBoardPiece(self, color, level + 1)
                piece.setPiecePosition(level * 0.112 - 0.27700000000000002, 0.17000000000000001 - color * 0.070900000000000005)
                piece.background.setDepthTest(False)
                piece.background.setDepthWrite(False)
                piece.setScale(0.34999999999999998)
                self.pieces.append(piece)
                piecelabel = DirectLabel(parent = self, relief = None, text = PLocalizer.PotionIngredients[color][level], text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PotionGlobals.TextColor, text_shadow = None, pos = (level * 0.38600000000000001 - 0.45200000000000001, 0, 0.438 - color * 0.245), textMayChange = 0)
                self.message = DirectLabel(parent = self, relief = None, text = PLocalizer.PotionIngredients[color][level], text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PotionGlobals.TextColor, text_shadow = None, pos = (level * 0.38600000000000001 - 0.45200000000000001, 0, 0.438 - color * 0.245), textMayChange = 0)
                self.pieceLabels.append(piecelabel)
            
        
        guiAssets.removeNode()

    
    def destroy(self):
        self.bQuit.destroy()
        DirectFrame.destroy(self)

    
    def show(self):
        if self.potionGame.closeCurrentDialog is not None:
            self.potionGame.closeCurrentDialog()
        
        self.potionGame.closeCurrentDialog = self.cleanUp
        self.potionGame.disableButtons()
        self.unstash()

    
    def toggle(self):
        if self.isStashed():
            self.show()
        else:
            self.quit()

    
    def cleanUp(self):
        self.potionGame.closeCurrentDialog = None
        self.potionGame.enableButtons()
        self.stash()

    
    def quit(self):
        self.cleanUp()
        if self.potionGame.gameFSM.gameStarted:
            self.potionGame.gameFSM.request('Eval')
        else:
            self.potionGame.gameFSM.request('RecipeSelect')
Exemplo n.º 28
0
class ChestTray(GuiTray.GuiTray):
    WantClothingPage = base.config.GetBool('want-clothing-page', 0)
    if not base.config.GetBool('want-land-infamy', 0):
        pass
    WantTitlesPage = base.config.GetBool('want-sea-infamy', 0)
    
    def __init__(self, parent, parentMgr, pos = None, sortOrder = 0):
        GuiTray.GuiTray.__init__(self, parent, 0.59999999999999998, 0.12)
        self.initialiseoptions(ChestTray)
        self.setBin('gui-fixed', 0)
        self.state = 0
        self.buttonsParent = self.attachNewNode(PandaNode('ChestTray.buttonsParent'), sortOrder)
        self.stickyButtonsParent = self.attachNewNode(PandaNode('ChestTray.stickyButtonsParent'), sortOrder)
        self.stickyButtonsParent.setPos(0, 0, 0.02)
        self.buttons = { }
        self.buildShowHideButtonsIvals()
        self.openSfx = loadSfx(SoundGlobals.SFX_GUI_OPEN_SEACHEST)
        self.openSfx.setVolume(0.40000000000000002)
        self.closeSfx = loadSfx(SoundGlobals.SFX_GUI_CLOSE_SEACHEST)
        self.closeSfx.setVolume(0.40000000000000002)
        gui = loader.loadModel('models/gui/toplevel_gui')
        gui_main = loader.loadModel('models/gui/gui_main')
        helpPos = (-0.26000000000000001, 0, 0.059999999999999998)
        helpDelay = 0
        self.buttonImage = gui.find('**/topgui_icon_box')
        self.buttonImageIn = gui.find('**/topgui_icon_box_in')
        self.buttonColors = (VBase4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1), VBase4(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), VBase4(1.0, 1.0, 1.0, 1), VBase4(0.59999999999999998, 0.59999999999999998, 0.59999999999999998, 1))
        self.currentButtonIn = None
        self.highlightButtons = [
            'guiMgrToggleMap',
            'guiMgrToggleWeapons',
            'guiMgrToggleQuest',
            'guiMgrToggleLevels',
            'guiMgrToggleShips',
            'guiMgrToggleTreasures',
            'guiMgrToggleLookout',
            'guiMgrToggleInventory',
            'guiMgrToggleTitles']
        buttonOptions = {
            'image': self.buttonImage,
            'geom': None,
            'relief': None,
            'frameSize': (0, 0.12, 0, 0.12),
            'image_scale': 0.46999999999999997,
            'image_pos': (0.059999999999999998, 0, 0.059999999999999998),
            'image0_color': self.buttonColors[0],
            'image1_color': self.buttonColors[1],
            'image2_color': self.buttonColors[2],
            'image3_color': self.buttonColors[3],
            'geom_scale': 0.12,
            'geom_pos': (0.059999999999999998, 0, 0.059999999999999998),
            'command': self.togglePanel }
        extraHeight = 0
        if self.WantTitlesPage:
            extraHeight = 0.12
        
        buttonOptions['geom'] = gui.find('**/friend_button_over')
        buttonOptions['geom_scale'] = 0.12
        self.socialButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'f',
            'shift-f'], hotkeyLabel = 'F', helpText = PLocalizer.SocialButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleSocial'], pos = (0.01, 0, 1.1599999999999999 + extraHeight))
        self.buttons['guiMgrToggleSocial'] = self.socialButton
        buttonOptions['geom'] = gui.find('**/compass_small_button_open_over')
        buttonOptions['geom_scale'] = 0.089999999999999997
        self.radarButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'c',
            'shift-c'], hotkeyLabel = 'C', helpText = PLocalizer.RadarButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleRadar'], pos = (0.01, 0, 1.04 + extraHeight))
        self.buttons['guiMgrToggleRadar'] = self.radarButton
        buttonPosZ = 0.88
        buttonHeight = 0.12
        if self.WantTitlesPage:
            buttonPosZ += buttonHeight
        
        buttonOptions['geom'] = gui_main.find('**/world_map_icon')
        buttonOptions['geom_scale'] = 0.095000000000000001
        self.mapButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'm',
            'shift-m'], hotkeyLabel = 'M', helpText = PLocalizer.MapButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleMap'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleMap'] = self.mapButton
        buttonPosZ -= buttonHeight
        self.highlightButton('guiMgrToggleMap')
        buttonOptions['geom'] = (gui.find('**/treasure_chest_closed_over'),)
        buttonOptions['geom_scale'] = 0.12
        self.bagButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'i',
            'shift-i'], hotkeyLabel = 'I', helpText = PLocalizer.SocialButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleInventory'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleInventory'] = self.bagButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_weapons')
        buttonOptions['geom_scale'] = 0.17999999999999999
        self.weaponButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'y',
            'shift-y'], hotkeyLabel = 'Y', helpText = PLocalizer.WeaponButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleWeapons'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleWeapons'] = self.weaponButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_skills')
        buttonOptions['geom_scale'] = 0.17999999999999999
        self.levelButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'k',
            'shift-k'], hotkeyLabel = 'K', helpText = PLocalizer.SkillButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleLevels'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleLevels'] = self.levelButton
        buttonPosZ -= buttonHeight
        if self.WantClothingPage:
            buttonOptions['geom'] = gui.find('**/topgui_icon_clothing')
            buttonOptions['geom_scale'] = 0.17000000000000001
            self.clothingButton = GuiButton(parent = self.buttonsParent, helpText = PLocalizer.ClothingButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
                'guiMgrToggleClothing'], pos = (0.01, 0, buttonPosZ))
            self.buttons['guiMgrToggleClothing'] = self.clothingButton
            buttonPosZ -= buttonHeight
        
        if self.WantTitlesPage:
            buttonOptions['geom'] = gui.find('**/topgui_infamy_frame')
            buttonOptions['geom_scale'] = 0.20000000000000001
            self.titlesButton = GuiButton(parent = self.buttonsParent, hotkeys = [
                'b',
                'shift-b'], hotkeyLabel = 'B', helpText = PLocalizer.TitlesButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
                'guiMgrToggleTitles'], pos = (0.01, 0, buttonPosZ))
            self.buttons['guiMgrToggleTitles'] = self.titlesButton
            buttonPosZ -= buttonHeight
        
        buttonOptions['geom'] = gui.find('**/topgui_icon_ship')
        buttonOptions['geom_scale'] = 0.20000000000000001
        self.shipsButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'h',
            'shift-h'], hotkeyLabel = 'H', helpText = PLocalizer.ShipsButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleShips'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleShips'] = self.shipsButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_journal')
        buttonOptions['geom_scale'] = 0.17999999999999999
        self.questButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'j',
            'shift-j'], hotkeyLabel = 'J', helpText = PLocalizer.QuestButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleQuest'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleQuest'] = self.questButton
        buttonPosZ -= buttonHeight
        self.lookoutButtonNormal = gui.find('**/telescope_button')
        self.lookoutButtonLight = gui.find('**/telescope_button_over')
        self.lookoutButtonSearch3o = gui.find('**/lookout_icon_over_03')
        buttonOptions['geom'] = None
        self.lookoutButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'l',
            'shift-l'], hotkeyLabel = 'L', helpText = PLocalizer.LookoutButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleLookout'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleLookout'] = self.lookoutButton
        buttonPosZ -= buttonHeight
        self.lookoutButtonImage = OnscreenImage(parent = self.stickyButtonsParent, image = self.lookoutButtonLight, scale = 0.29999999999999999, pos = (0.065000000000000002, 0.0, 0.215))
        self.lookoutButtonImage.sourceImage = self.lookoutButtonLight
        buttonOptions['geom'] = gui.find('**/topgui_icon_main_menu')
        buttonOptions['geom_scale'] = 0.17999999999999999
        self.mainMenuButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            PiratesGlobals.OptionsHotkey,
            'escape'], hotkeyLabel = 'F7', helpText = PLocalizer.QuestButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleMainMenu'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleMainMenu'] = self.mainMenuButton
        buttonPosZ -= buttonHeight
        self.chestButtonClosed = (gui.find('**/treasure_chest_closed'), gui.find('**/treasure_chest_closed'), gui.find('**/treasure_chest_closed_over'))
        self.chestButtonOpen = gui.find('**/treasure_chest_open_over')
        self.chestButton = GuiButton(command = self.toggle, parent = self, relief = None, image = self.chestButtonClosed, image_scale = 0.14999999999999999, image_pos = (0.050000000000000003, 0, 0.059999999999999998), scale = 1.2)
        self.chestHotkeyText = DirectLabel(parent = self.chestButton, relief = None, text = 'Tab', text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleSmall, text_pos = (0.11, 0.0), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getPirateBoldOutlineFont(), textMayChange = 1)
        self.buttonsParent.hide()
        self.buttonsParent.setPos(0.20000000000000001, 0, 0.14000000000000001)
        self.stickyButtonsParent.hide()
        self.stickyButtonsParent.setPos(0.20000000000000001, 0, 0.14000000000000001)
        gui.removeNode()

    
    def destroy(self):
        self.showButtonsIval.pause()
        del self.showButtonsIval
        self.hideButtonsIval.pause()
        del self.hideButtonsIval
        self.buttonsParent.removeNode()
        del self.buttonsParent
        self.stickyButtonsParent.removeNode()
        del self.stickyButtonsParent
        for button in self.buttons:
            self.buttons[button].destroy()
            self.buttons[button] = None
        
        del self.buttons
        self.bagButton = None
        self.radarButton = None
        self.lookoutButton = None
        self.mapButton = None
        self.shipsButton = None
        self.titlesButton = None
        self.mainMenuButton = None
        self.socialButton = None
        self.levelButton = None
        self.chestButton = None
        self.questButton = None
        self.weaponButton = None
        loader.unloadSfx(self.openSfx)
        loader.unloadSfx(self.closeSfx)
        del self.openSfx
        del self.closeSfx
        GuiTray.GuiTray.destroy(self)

    
    def highlightButton(self, button):
        
        def changeButtonImage(button, image):
            button['image'] = image
            button['image0_color'] = self.buttonColors[0]
            button['image1_color'] = self.buttonColors[1]
            button['image2_color'] = self.buttonColors[2]
            button['image3_color'] = self.buttonColors[3]

        if self.currentButtonIn:
            changeButtonImage(self.buttons[self.currentButtonIn], self.buttonImage)
        
        self.currentButtonIn = button
        changeButtonImage(self.buttons[self.currentButtonIn], self.buttonImageIn)

    
    def togglePanel(self, message, args = None):
        if localAvatar.getInventory() == None:
            return None
        
        if message in self.highlightButtons:
            self.highlightButton(message)
        
        messenger.send(message, [
            args])

    
    def toggle(self):
        if not self.isHidden():
            messenger.send(PiratesGlobals.SeaChestHotkey)
            if localAvatar.guiMgr.questPage:
                chestPanel = localAvatar.guiMgr.chestPanel
                if chestPanel.currPageIndex:
                    currPage = chestPanel.pages[chestPanel.currPageIndex]
                
            
        

    
    def isOpen(self):
        return self.state

    
    def showButtons(self):
        if self.hideButtonsIval.isPlaying():
            self.hideButtonsIval.finish()
        
        self.showButtonsIval.start()

    
    def hideButtons(self):
        if self.showButtonsIval.isPlaying():
            self.showButtonsIval.finish()
        
        for button in self.buttons:
            self.buttons[button].hideDetails()
        
        self.hideButtonsIval.start()

    
    def slideOpen(self):
        if not self.state:
            self.openSfx.play()
        
        self.state = 1
        self.chestButton['image'] = self.chestButtonOpen
        self.showButtons()
        if localAvatar.guiMgr.questPage:
            chestPanel = localAvatar.guiMgr.chestPanel
            if chestPanel.currPageIndex:
                currPage = chestPanel.pages[chestPanel.currPageIndex]
            
        

    
    def slideClose(self):
        if self.state:
            self.closeSfx.play()
        
        self.state = 0
        self.chestButton['image'] = self.chestButtonClosed
        self.hideButtons()

    
    def buildShowHideButtonsIvals(self, includeSticky = True):
        showSequence = Sequence(Func(self.buttonsParent.show))
        showParallel = Parallel(LerpPosInterval(self.buttonsParent, 0.20000000000000001, pos = Point3(0, 0, 0.14000000000000001), startPos = self.buttonsParent.getPos, blendType = 'easeOut'))
        if includeSticky:
            showSequence.append(Func(self.stickyButtonsParent.show))
            showParallel.append(LerpPosInterval(self.stickyButtonsParent, 0.20000000000000001, pos = Point3(0, 0, 0.14000000000000001), startPos = self.stickyButtonsParent.getPos, blendType = 'easeOut'))
        
        showSequence.append(showParallel)
        self.showButtonsIval = showSequence
        hideParallel = Parallel(LerpPosInterval(self.buttonsParent, 0.20000000000000001, pos = Point3(0.20000000000000001, 0, 0.14000000000000001), startPos = self.buttonsParent.getPos, blendType = 'easeIn'))
        hideSequence = Sequence(hideParallel, Func(self.buttonsParent.hide))
        if includeSticky:
            hideSequence.append(Func(self.stickyButtonsParent.hide))
            hideParallel.append(LerpPosInterval(self.stickyButtonsParent, 0.20000000000000001, pos = Point3(0.20000000000000001, 0, 0.14000000000000001), startPos = self.stickyButtonsParent.getPos, blendType = 'easeIn'))
        
        hideSequence.append(hideParallel)
        self.hideButtonsIval = hideSequence

    
    def hideChestButton(self):
        self.chestButton.hide()

    
    def showChestButton(self):
        self.chestButton.show()
Exemplo n.º 29
0
 def initializeTableInterface(self):
     self.levelUpIval = None
     self.swapCard = False
     self.cardSwapIndex = 0
     self.swapDialog = None
     self.leaveDialog = None
     self.swapResultDialog = None
     self.timer = False
     self.timeout = False
     self.buttonArray = []
     self.suitGeomArray = []
     if not True:
         self.suitGeomArray.append(self.suitImage(0))
         self.suitGeomArray.append(self.suitImage(1))
         self.suitGeomArray.append(self.suitImage(2))
         self.suitGeomArray.append(self.suitImage(3))
     else:
         self.suitIcons = loader.loadModel('models/gui/suit_icons')
         if self.suitIcons:
             scale = 0.080000000000000002
             icon = self.suitIcons.find('**/suit_icon_h')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_d')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_c')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_s')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
         else:
             self.suitGeomArray = [None, None, None, None]
     x = -0.35999999999999999
     y = 0.070000000000000007
     x_increment = 0.23999999999999999
     text = PLocalizer.TableLeave
     button = GuiButton(parent=self.menu,
                        command=self.leaveAction,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text,
                            [PlayingCardGlobals.Leave])
     self.leaveButton = button
     self.buttonArray = self.buttonArray + [button]
     button.show()
     text = PLocalizer.TableCancel
     button = GuiButton(parent=self.menu,
                        command=self.cancelSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [0])
     self.cancelButton = button
     self.buttonArray = self.buttonArray + [button]
     button.hide()
     x = x + x_increment
     self.suit = 0
     self.rank = 0
     self.cardSwapIndex = 0
     self.suitButtonArray = []
     self.rankButtonArray = []
     x = -0.35999999999999999
     y = 0.17749999999999999
     x_increment = 0.23999999999999999
     suit = 0
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent=self.menu,
                        command=self.cardSuitSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [suit])
     self.suitButtonArray = self.suitButtonArray + [button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent=self.menu,
                        command=self.cardSuitSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [suit])
     self.suitButtonArray = self.suitButtonArray + [button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent=self.menu,
                        command=self.cardSuitSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [suit])
     self.suitButtonArray = self.suitButtonArray + [button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent=self.menu,
                        command=self.cardSuitSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [suit])
     self.suitButtonArray = self.suitButtonArray + [button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     x = -0.35999999999999999 - 0.059999999999999998
     y = 0.17749999999999999
     x_increment = 0.12
     rank = 0
     text = PLocalizer.Card2
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card3
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card4
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card5
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card6
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card7
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card8
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card9
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     x = -0.35999999999999999 - 0.059999999999999998
     y = 0.070000000000000007
     x_increment = 0.12
     x = x + x_increment
     x = x + x_increment
     x = x + x_increment
     text = PLocalizer.CardT
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardJ
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardQ
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardK
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardA
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
 def __init__(self, title, x, y, width, height):
     self.popupDialog = None
     self.feedbackPanel = None
     self.gameOptions = None
     DirectFrame.__init__(self,
                          relief=None,
                          image=loader.loadModel('models/misc/fade'),
                          image_scale=(5, 2, 2),
                          image_color=(0, 0, 0, 0.29999999999999999),
                          image_pos=(0.5, 0, 0.80000000000000004),
                          state=DGG.NORMAL,
                          pos=(x, 0.0, y),
                          sortOrder=20)
     self.initialiseoptions(MainMenu)
     self.setBin('gui-fixed', 5)
     self.model = loader.loadModel('models/gui/avatar_chooser_rope')
     self.parentFrame = DirectFrame(parent=self, pos=(0, 0, 1.2))
     self.ropeFrame = DirectFrame(
         parent=self.parentFrame,
         relief=None,
         image=self.model.find('**/avatar_c_A_rope'),
         image_scale=0.35999999999999999,
         pos=(0.51800000000000002, 0, 1.5800000000000001))
     self.ropeFrame2 = DirectFrame(
         parent=self.parentFrame,
         relief=None,
         image=self.model.find('**/avatar_c_A_rope'),
         image_scale=0.35999999999999999,
         pos=(1.0760000000000001, 0, 1.5800000000000001))
     self.logo = loader.loadModel('models/gui/potcLogo')
     self.logo.reparentTo(self.parentFrame)
     self.logo.setPos(width / 2.0, 0, height - 0.14999999999999999)
     self.logo.setScale(0.90000000000000002)
     self.buttons = []
     hotkeys = ['']
     hotkeyConfig = getBase().config.GetString('want-menu-hotkeys', '')
     if hotkeyConfig and '%' not in hotkeyConfig:
         hotkeyConfig = 'f%s'
     buttonCount = 0
     if hotkeyConfig:
         hotkeys = ['esc']
         buttonCount += 1
     self.returnButton = GuiButton(
         parent=self.logo,
         relief=None,
         text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text=PLocalizer.MainMenuReturn,
         image=(self.model.find('**/avatar_c_A_top'),
                self.model.find('**/avatar_c_A_top'),
                self.model.find('**/avatar_c_A_top_over')),
         image_scale=0.40000000000000002,
         text_pos=(0, -0.02),
         pos=(0, 0, -0.45000000000000001),
         command=self._MainMenu__handleReturn,
         hotkeys=hotkeys,
         hotkeyLabel=hotkeys[0],
         hotkeyLabelX=0.20000000000000001,
         hotkeyArgs=False)
     self.buttons.append(self.returnButton)
     if hotkeyConfig:
         hotkeys = [hotkeyConfig % (buttonCount, )]
         buttonCount += 1
     self.optionsButton = GuiButton(
         parent=self.logo,
         relief=None,
         text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text=PLocalizer.MainMenuOptions,
         image=(self.model.find('**/avatar_c_A_middle'),
                self.model.find('**/avatar_c_A_middle'),
                self.model.find('**/avatar_c_A_middle_over')),
         image_scale=0.40000000000000002,
         text_pos=(0, -0.014999999999999999),
         pos=(0, 0, -0.56399999999999995),
         command=self._MainMenu__handleOptions,
         hotkeys=hotkeys,
         hotkeyLabel=hotkeys[0],
         hotkeyLabelX=0.20000000000000001,
         hotkeyArgs=False)
     self.buttons.append(self.optionsButton)
     if hotkeyConfig:
         hotkeys = [hotkeyConfig % (buttonCount, )]
         buttonCount += 1
     self.feedbackButton = GuiButton(
         parent=self.logo,
         relief=None,
         text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text=PLocalizer.MainMenuFeedback,
         image=(self.model.find('**/avatar_c_A_middle'),
                self.model.find('**/avatar_c_A_middle'),
                self.model.find('**/avatar_c_A_middle_over')),
         image_scale=0.40000000000000002,
         text_pos=(0, -0.014999999999999999),
         pos=(0, 0, -0.67000000000000004),
         command=self._MainMenu__loadFeedbackPanel,
         hotkeys=hotkeys,
         hotkeyLabel=hotkeys[0],
         hotkeyLabelX=0.20000000000000001,
         hotkeyArgs=False)
     self.buttons.append(self.feedbackButton)
     self.buttonZ = -0.67000000000000004
     magicWordConfig = getBase().config.GetString('want-menu-magic', '')
     if magicWordConfig:
         self.magicButtons = []
         magicWords = _[1]
         magicWords = [
             choice(mw[0] == '~', mw, '~%s' % mw) for mw in magicWords
         ]
         for mw in magicWords:
             if hotkeyConfig:
                 hotkeys = [hotkeyConfig % (buttonCount, )]
                 buttonCount += 1
             self.buttonZ = self.buttonZ - 0.106
             self.magicButtons.append(
                 GuiButton(
                     parent=self.logo,
                     relief=None,
                     text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
                     text_fg=PiratesGuiGlobals.TextFG2,
                     text_shadow=PiratesGuiGlobals.TextShadow,
                     text=mw,
                     image=(self.model.find('**/avatar_c_A_middle'),
                            self.model.find('**/avatar_c_A_middle'),
                            self.model.find('**/avatar_c_A_middle_over')),
                     image_scale=0.40000000000000002,
                     text_pos=(0, -0.014999999999999999),
                     pos=(0, 0, self.buttonZ),
                     command=lambda mw=mw: self._MainMenu__handleMagic(mw),
                     hotkeys=hotkeys,
                     hotkeyLabel=hotkeys[0],
                     hotkeyLabelX=0.20000000000000001,
                     hotkeyArgs=False))
         self.buttons.extend(self.magicButtons)
     if hotkeyConfig:
         hotkeys = [hotkeyConfig % (buttonCount, )]
         buttonCount += 1
     self.buttonZ = self.buttonZ - 0.106
     self.logoutButton = GuiButton(
         parent=self.logo,
         relief=None,
         text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text=PLocalizer.MainMenuLogout,
         image=(self.model.find('**/avatar_c_A_middle'),
                self.model.find('**/avatar_c_A_middle'),
                self.model.find('**/avatar_c_A_middle_over')),
         image_scale=0.40000000000000002,
         text_pos=(0, -0.014999999999999999),
         pos=(0, 0, self.buttonZ),
         command=self._MainMenu__handleLogout,
         hotkeys=hotkeys,
         hotkeyLabel=hotkeys[0],
         hotkeyLabelX=0.20000000000000001,
         hotkeyArgs=False)
     self.buttons.append(self.logoutButton)
     if hotkeyConfig:
         hotkeys = [hotkeyConfig % (buttonCount, )]
         buttonCount += 1
     self.buttonZ = self.buttonZ - 0.157
     self.quitButton = GuiButton(
         parent=self.logo,
         relief=None,
         text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text=PLocalizer.MainMenuQuit,
         image=(self.model.find('**/avatar_c_A_bottom'),
                self.model.find('**/avatar_c_A_bottom'),
                self.model.find('**/avatar_c_A_bottom_over')),
         image_scale=0.40000000000000002,
         text_pos=(0, 0.035000000000000003),
         pos=(0, 0, self.buttonZ),
         command=self._MainMenu__handleQuit,
         hotkeys=hotkeys,
         hotkeyLabel=hotkeys[0],
         hotkeyLabelX=0.20000000000000001,
         hotkeyArgs=False)
     self.buttons.append(self.quitButton)
     self.barFrame = DirectFrame(
         parent=self.logo,
         relief=None,
         image=self.model.find('**/avatar_c_B_frame'),
         image_scale=0.34999999999999998,
         pos=(0, 0, -0.34999999999999998))
     self.showMenuIval = None
     self.hideMenuIval = None
     self.buildShowHideMenuIvals()
     self.menuSfx = loadSfx(SoundGlobals.SFX_GUI_SHOW_PANEL)
     self.menuSfx.setVolume(0.40000000000000002)
Exemplo n.º 31
0
 def __init__(self, parent, parentMgr, pos = None, sortOrder = 0):
     GuiTray.GuiTray.__init__(self, parent, 0.59999999999999998, 0.12)
     self.initialiseoptions(ChestTray)
     self.setBin('gui-fixed', 0)
     self.state = 0
     self.buttonsParent = self.attachNewNode(PandaNode('ChestTray.buttonsParent'), sortOrder)
     self.stickyButtonsParent = self.attachNewNode(PandaNode('ChestTray.stickyButtonsParent'), sortOrder)
     self.stickyButtonsParent.setPos(0, 0, 0.02)
     self.buttons = { }
     self.buildShowHideButtonsIvals()
     self.openSfx = loadSfx(SoundGlobals.SFX_GUI_OPEN_SEACHEST)
     self.openSfx.setVolume(0.40000000000000002)
     self.closeSfx = loadSfx(SoundGlobals.SFX_GUI_CLOSE_SEACHEST)
     self.closeSfx.setVolume(0.40000000000000002)
     gui = loader.loadModel('models/gui/toplevel_gui')
     gui_main = loader.loadModel('models/gui/gui_main')
     helpPos = (-0.26000000000000001, 0, 0.059999999999999998)
     helpDelay = 0
     self.buttonImage = gui.find('**/topgui_icon_box')
     self.buttonImageIn = gui.find('**/topgui_icon_box_in')
     self.buttonColors = (VBase4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1), VBase4(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), VBase4(1.0, 1.0, 1.0, 1), VBase4(0.59999999999999998, 0.59999999999999998, 0.59999999999999998, 1))
     self.currentButtonIn = None
     self.highlightButtons = [
         'guiMgrToggleMap',
         'guiMgrToggleWeapons',
         'guiMgrToggleQuest',
         'guiMgrToggleLevels',
         'guiMgrToggleShips',
         'guiMgrToggleTreasures',
         'guiMgrToggleLookout',
         'guiMgrToggleInventory',
         'guiMgrToggleTitles']
     buttonOptions = {
         'image': self.buttonImage,
         'geom': None,
         'relief': None,
         'frameSize': (0, 0.12, 0, 0.12),
         'image_scale': 0.46999999999999997,
         'image_pos': (0.059999999999999998, 0, 0.059999999999999998),
         'image0_color': self.buttonColors[0],
         'image1_color': self.buttonColors[1],
         'image2_color': self.buttonColors[2],
         'image3_color': self.buttonColors[3],
         'geom_scale': 0.12,
         'geom_pos': (0.059999999999999998, 0, 0.059999999999999998),
         'command': self.togglePanel }
     extraHeight = 0
     if self.WantTitlesPage:
         extraHeight = 0.12
     
     buttonOptions['geom'] = gui.find('**/friend_button_over')
     buttonOptions['geom_scale'] = 0.12
     self.socialButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'f',
         'shift-f'], hotkeyLabel = 'F', helpText = PLocalizer.SocialButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleSocial'], pos = (0.01, 0, 1.1599999999999999 + extraHeight))
     self.buttons['guiMgrToggleSocial'] = self.socialButton
     buttonOptions['geom'] = gui.find('**/compass_small_button_open_over')
     buttonOptions['geom_scale'] = 0.089999999999999997
     self.radarButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'c',
         'shift-c'], hotkeyLabel = 'C', helpText = PLocalizer.RadarButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleRadar'], pos = (0.01, 0, 1.04 + extraHeight))
     self.buttons['guiMgrToggleRadar'] = self.radarButton
     buttonPosZ = 0.88
     buttonHeight = 0.12
     if self.WantTitlesPage:
         buttonPosZ += buttonHeight
     
     buttonOptions['geom'] = gui_main.find('**/world_map_icon')
     buttonOptions['geom_scale'] = 0.095000000000000001
     self.mapButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'm',
         'shift-m'], hotkeyLabel = 'M', helpText = PLocalizer.MapButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleMap'], pos = (0.01, 0, buttonPosZ))
     self.buttons['guiMgrToggleMap'] = self.mapButton
     buttonPosZ -= buttonHeight
     self.highlightButton('guiMgrToggleMap')
     buttonOptions['geom'] = (gui.find('**/treasure_chest_closed_over'),)
     buttonOptions['geom_scale'] = 0.12
     self.bagButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'i',
         'shift-i'], hotkeyLabel = 'I', helpText = PLocalizer.SocialButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleInventory'], pos = (0.01, 0, buttonPosZ))
     self.buttons['guiMgrToggleInventory'] = self.bagButton
     buttonPosZ -= buttonHeight
     buttonOptions['geom'] = gui.find('**/topgui_icon_weapons')
     buttonOptions['geom_scale'] = 0.17999999999999999
     self.weaponButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'y',
         'shift-y'], hotkeyLabel = 'Y', helpText = PLocalizer.WeaponButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleWeapons'], pos = (0.01, 0, buttonPosZ))
     self.buttons['guiMgrToggleWeapons'] = self.weaponButton
     buttonPosZ -= buttonHeight
     buttonOptions['geom'] = gui.find('**/topgui_icon_skills')
     buttonOptions['geom_scale'] = 0.17999999999999999
     self.levelButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'k',
         'shift-k'], hotkeyLabel = 'K', helpText = PLocalizer.SkillButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleLevels'], pos = (0.01, 0, buttonPosZ))
     self.buttons['guiMgrToggleLevels'] = self.levelButton
     buttonPosZ -= buttonHeight
     if self.WantClothingPage:
         buttonOptions['geom'] = gui.find('**/topgui_icon_clothing')
         buttonOptions['geom_scale'] = 0.17000000000000001
         self.clothingButton = GuiButton(parent = self.buttonsParent, helpText = PLocalizer.ClothingButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
             'guiMgrToggleClothing'], pos = (0.01, 0, buttonPosZ))
         self.buttons['guiMgrToggleClothing'] = self.clothingButton
         buttonPosZ -= buttonHeight
     
     if self.WantTitlesPage:
         buttonOptions['geom'] = gui.find('**/topgui_infamy_frame')
         buttonOptions['geom_scale'] = 0.20000000000000001
         self.titlesButton = GuiButton(parent = self.buttonsParent, hotkeys = [
             'b',
             'shift-b'], hotkeyLabel = 'B', helpText = PLocalizer.TitlesButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
             'guiMgrToggleTitles'], pos = (0.01, 0, buttonPosZ))
         self.buttons['guiMgrToggleTitles'] = self.titlesButton
         buttonPosZ -= buttonHeight
     
     buttonOptions['geom'] = gui.find('**/topgui_icon_ship')
     buttonOptions['geom_scale'] = 0.20000000000000001
     self.shipsButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'h',
         'shift-h'], hotkeyLabel = 'H', helpText = PLocalizer.ShipsButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleShips'], pos = (0.01, 0, buttonPosZ))
     self.buttons['guiMgrToggleShips'] = self.shipsButton
     buttonPosZ -= buttonHeight
     buttonOptions['geom'] = gui.find('**/topgui_icon_journal')
     buttonOptions['geom_scale'] = 0.17999999999999999
     self.questButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'j',
         'shift-j'], hotkeyLabel = 'J', helpText = PLocalizer.QuestButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleQuest'], pos = (0.01, 0, buttonPosZ))
     self.buttons['guiMgrToggleQuest'] = self.questButton
     buttonPosZ -= buttonHeight
     self.lookoutButtonNormal = gui.find('**/telescope_button')
     self.lookoutButtonLight = gui.find('**/telescope_button_over')
     self.lookoutButtonSearch3o = gui.find('**/lookout_icon_over_03')
     buttonOptions['geom'] = None
     self.lookoutButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         'l',
         'shift-l'], hotkeyLabel = 'L', helpText = PLocalizer.LookoutButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleLookout'], pos = (0.01, 0, buttonPosZ))
     self.buttons['guiMgrToggleLookout'] = self.lookoutButton
     buttonPosZ -= buttonHeight
     self.lookoutButtonImage = OnscreenImage(parent = self.stickyButtonsParent, image = self.lookoutButtonLight, scale = 0.29999999999999999, pos = (0.065000000000000002, 0.0, 0.215))
     self.lookoutButtonImage.sourceImage = self.lookoutButtonLight
     buttonOptions['geom'] = gui.find('**/topgui_icon_main_menu')
     buttonOptions['geom_scale'] = 0.17999999999999999
     self.mainMenuButton = GuiButton(parent = self.buttonsParent, hotkeys = [
         PiratesGlobals.OptionsHotkey,
         'escape'], hotkeyLabel = 'F7', helpText = PLocalizer.QuestButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
         'guiMgrToggleMainMenu'], pos = (0.01, 0, buttonPosZ))
     self.buttons['guiMgrToggleMainMenu'] = self.mainMenuButton
     buttonPosZ -= buttonHeight
     self.chestButtonClosed = (gui.find('**/treasure_chest_closed'), gui.find('**/treasure_chest_closed'), gui.find('**/treasure_chest_closed_over'))
     self.chestButtonOpen = gui.find('**/treasure_chest_open_over')
     self.chestButton = GuiButton(command = self.toggle, parent = self, relief = None, image = self.chestButtonClosed, image_scale = 0.14999999999999999, image_pos = (0.050000000000000003, 0, 0.059999999999999998), scale = 1.2)
     self.chestHotkeyText = DirectLabel(parent = self.chestButton, relief = None, text = 'Tab', text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleSmall, text_pos = (0.11, 0.0), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getPirateBoldOutlineFont(), textMayChange = 1)
     self.buttonsParent.hide()
     self.buttonsParent.setPos(0.20000000000000001, 0, 0.14000000000000001)
     self.stickyButtonsParent.hide()
     self.stickyButtonsParent.setPos(0.20000000000000001, 0, 0.14000000000000001)
     gui.removeNode()
    def __init__(self, table):
        DirectFrame.__init__(self, relief = None)
        self.initialiseoptions(BlackjackTableGUI)
        self.table = table
        self.destroyed = False
        self.maxHandCards = 14
        self.playerStatusPanels = []
        for i in range(self.table.NumSeats + 1):
            statusPanel = BlackjackStatusPanel(self.maxHandCards)
            statusPanel.setName('playerHand-%s' % i)
            pos = self.HandPos[i]
            statusPanel.setPos(pos)
            self.playerStatusPanels.append(statusPanel)
        
        self.localStatusPanel = self.playerStatusPanels[self.LocalAvatarGuiIndex]
        width = 1.0
        height = 0.25
        self.menu = BorderFrame(parent = base.a2dBottomCenter, frameSize = (-width / 2.0, width / 2.0, 0, height), pos = (0, 0, 0))
        self.width = width
        self.height = height
        self.initializeTableInterface()
        x = -0.35999999999999999
        y = 0.17749999999999999
        x_increment = 0.23999999999999999
        helpText = PLocalizer.TableCardsHelp
        helpPos = (0.0, 0.0, 0.23999999999999999)
        text = PLocalizer.BlackjackCardSwap
        button = GuiButton(parent = self.menu, command = self.playerAction, helpText = helpText, helpPos = helpPos, pos = (x, 0, y), canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.CardSwap])
        button.show()
        self.cardSwapButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackDoubleDown
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.DoubleDown])
        button.show()
        self.doubleDownButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackStay
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Stay])
        button.show()
        self.stayButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackHit
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Hit])
        button.show()
        self.hitButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        x = -0.35999999999999999
        y = 0.070000000000000007
        x_increment = 0.23999999999999999
        x += x_increment
        x += x_increment
        text = PLocalizer.BlackjackSplit
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Split])
        button.show()
        self.splitButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        bid = self.table.getTableBidAmount()
        text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Bid])
        button.show()
        self.bidButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        
        def bid_update_function(value):
            bid = self.sliderValueToBid(value)
            text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
            self.bidButton['text'] = text
            self.bidAmount = bid

        self.bidAmount = 2
        default_value = 0.0
        x = 0.0
        y = -0.25
        label = PLocalizer.BlackjackBid
        resolution = 1.0
        self.bidSlider = self.create_slider(bid_update_function, default_value, x, y, resolution, label, self.menu)
        x = -0.35999999999999999
        y = 0.17749999999999999
        x_increment = 0.23999999999999999
        text = PLocalizer.PokerCheat1
        button = GuiButton(parent = self.menu, command = self.cardSwapButtonSelection, canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.Cheat1])
        self.cheat1Button = button
        self.buttonArray = self.buttonArray + [
            button]
        x = x + x_increment
        text = PLocalizer.PokerCheat2
        button = GuiButton(parent = self.menu, command = self.cardSwapButtonSelection, canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.Cheat2])
        self.cheat2Button = button
        self.buttonArray = self.buttonArray + [
            button]
        x = x + x_increment
        self.hideCheatButtons()
        self.disableAllPlayButtons()
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32000000000000001
        currentMoney = localAvatar.getInventory().getGoldInPocket()
        self.moneyDisplay = DirectLabel(parent = self.menu, relief = None, pos = (-0.29999999999999999 + x_increment / 2.0, 0, 0.074999999999999997), geom = goldCoin, geom_scale = (scale, scale, scale), geom_pos = (0, 0, 0), text = '%s' % currentMoney, text_align = TextNode.ALeft, text_scale = 0.035000000000000003, text_pos = (0.044999999999999998, -0.01), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, scale = 1.1000000000000001)
        self.accept(InventoryGlobals.getCategoryQuantChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.setMoney)
        this = self
        identifier = 0
        this.sfxArray = []
        this.hitIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_HIT)]
        identifier = identifier + 1
        self.hands = []
        self.splitCardsArray = []
        self.canSplit = False
        self.canDoubleDown = False
        self.bid = False
Exemplo n.º 33
0
class PotionInfo(DirectFrame):
    def __init__(self, potionGame):
        self.potionGame = potionGame
        DirectFrame.__init__(self, parent=potionGame.dialogs, relief=None)
        self.setPos((-0.5, 0, 0.074999999999999997))
        guiAssets = loader.loadModel(
            'models/minigames/pir_m_gui_pot_textureCard')
        parch = guiAssets.find('**/pir_t_gui_pot_potionIngredients')
        parch.setScale(3.4500000000000002, 1, 3.4500000000000002)
        parch.setPos(0.5, 0, -0.02)
        self.background = parch.copyTo(self)
        self.bQuit = GuiButton(
            image=(guiAssets.find('**/pir_t_gui_pot_exitIngredients'),
                   guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'),
                   guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'),
                   guiAssets.find('**/pir_t_gui_pot_exitIngredients')),
            scale=(0.29999999999999999, 0.29999999999999999,
                   0.29999999999999999),
            command=self.quit)
        self.bQuit.reparentTo(self)
        self.bQuit.setPos(1.673, 0, 0.76700000000000002)
        self.messageText = PLocalizer.PotionGui['InfoText']
        self.message = DirectLabel(
            parent=self,
            relief=None,
            text=self.messageText,
            text_scale=PiratesGuiGlobals.TextScaleTitleSmall,
            text_align=TextNode.ARight,
            text_fg=PotionGlobals.TextColor,
            text_shadow=None,
            pos=(-0.17000000000000001, 0, 0.71999999999999997),
            textMayChange=0)
        self.pieces = []
        self.pieceLabels = []
        for color in range(6):
            for level in range(6):
                piece = PotionBoardPiece(self, color, level + 1)
                piece.setPiecePosition(
                    level * 0.112 - 0.27700000000000002,
                    0.17000000000000001 - color * 0.070900000000000005)
                piece.background.setDepthTest(False)
                piece.background.setDepthWrite(False)
                piece.setScale(0.34999999999999998)
                self.pieces.append(piece)
                piecelabel = DirectLabel(
                    parent=self,
                    relief=None,
                    text=PLocalizer.PotionIngredients[color][level],
                    text_scale=PiratesGuiGlobals.TextScaleMed,
                    text_align=TextNode.ACenter,
                    text_fg=PotionGlobals.TextColor,
                    text_shadow=None,
                    pos=(level * 0.38600000000000001 - 0.45200000000000001, 0,
                         0.438 - color * 0.245),
                    textMayChange=0)
                self.message = DirectLabel(
                    parent=self,
                    relief=None,
                    text=PLocalizer.PotionIngredients[color][level],
                    text_scale=PiratesGuiGlobals.TextScaleMed,
                    text_align=TextNode.ACenter,
                    text_fg=PotionGlobals.TextColor,
                    text_shadow=None,
                    pos=(level * 0.38600000000000001 - 0.45200000000000001, 0,
                         0.438 - color * 0.245),
                    textMayChange=0)
                self.pieceLabels.append(piecelabel)

        guiAssets.removeNode()

    def destroy(self):
        self.bQuit.destroy()
        DirectFrame.destroy(self)

    def show(self):
        if self.potionGame.closeCurrentDialog is not None:
            self.potionGame.closeCurrentDialog()

        self.potionGame.closeCurrentDialog = self.cleanUp
        self.potionGame.disableButtons()
        self.unstash()

    def toggle(self):
        if self.isStashed():
            self.show()
        else:
            self.quit()

    def cleanUp(self):
        self.potionGame.closeCurrentDialog = None
        self.potionGame.enableButtons()
        self.stash()

    def quit(self):
        self.cleanUp()
        if self.potionGame.gameFSM.gameStarted:
            self.potionGame.gameFSM.request('Eval')
        else:
            self.potionGame.gameFSM.request('RecipeSelect')
 def _initButtons(self):
     self.sellButtonModel = loader.loadModel('models/gui/pir_m_gui_can_buttonSell')
     self.sellButton = GuiButton(parent = self, image = (self.sellButtonModel.find('**/idle'), self.sellButtonModel.find('**/idle'), self.sellButtonModel.find('**/over')), image_scale = 1, scale = 0.40000000000000002, sortOrder = 100, pos = (0, 0, -0.125), command = self.onSellClick)
     self.sellButton.bind(DGG.ENTER, self.showToolTip)
     self.sellButton.bind(DGG.EXIT, self.hideToolTip)
class LegendaryFishingGameGUI:
    
    def __init__(self, gameObject = None):
        base.loadingScreen.beginStep('LegendaryGameGUI', 4, 20)
        self.gameObject = gameObject
        self.guiImage = loader.loadModel('models/minigames/pir_m_gam_fsh_legendaryGui')
        self.UICompoments = { }
        self.uiBaseNode = NodePath('baseNode')
        self.uiBaseNode.reparentTo(aspect2d)
        self.uiBaseNode.show()
        self.leftBaseNode = NodePath('leftBaseNode')
        self.leftBaseNode.reparentTo(base.a2dLeftCenter)
        self.leftBaseNode.show()
        self.fishActor = None
        self.actorAnim = { }
        self.scaleSize = {
            InventoryType.Collection_Set11_Part1: 0.059999999999999998,
            InventoryType.Collection_Set11_Part2: 0.055,
            InventoryType.Collection_Set11_Part3: 0.12,
            InventoryType.Collection_Set11_Part4: 0.086999999999999994,
            InventoryType.Collection_Set11_Part5: 0.080000000000000002 }
        self.meterFrame = DirectFrame(parent = self.leftBaseNode, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.0, 0.0), frameColor = (1.0, 1.0, 1.0, 0.0), relief = None, state = DGG.DISABLED, pos = (1.0, 0.0, -0.45000000000000001), hpr = (0, 0, 0), scale = (1.3, 0.0, 1.3), image = self.guiImage.find('**/pir_t_gui_fsh_meter'), image_scale = (0.20000000000000001, 0.0, 0.80000000000000004), image_pos = (0, 0, 0), text = '', textMayChange = 1, text_scale = PiratesGuiGlobals.TextScaleTitleLarge, text_pos = (-0.55000000000000004, 0.10000000000000001), text_shadow = PiratesGuiGlobals.TextShadow)
        self.UICompoments['meterFrame'] = self.meterFrame
        self.fishingRod = DirectFrame(parent = self.meterFrame, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.0, 0.0), relief = None, state = DGG.DISABLED, pos = FishingGlobals.fishingRodScreenPosition, image = self.guiImage.find('**/pir_t_gui_fsh_fullRod'), image_scale = (1.0, 0.0, 0.125), image_pos = (0.20000000000000001, 0, 0))
        self.fishingRod.setR(FishingGlobals.fishingRodInitSlope)
        self.UICompoments['fishingRod'] = self.fishingRod
        base.loadingScreen.tick()
        self.fishingHandleBaseFrame = DirectFrame(parent = self.uiBaseNode, frameSize = (-0.29999999999999999, 0.29999999999999999, -1.5, 1.5), frameColor = (1.0, 1.0, 1.0, 0.0), relief = None, state = DGG.DISABLED, pos = (0.0, 0.0, 0.0), hpr = (0, 0, 0), scale = (0.71999999999999997, 0.0, 0.71999999999999997), image = self.guiImage.find('**/pir_t_gui_fsh_partialRod'), image_scale = (3.7999999999999998, 0.0, 1.8999999999999999), image_pos = (0, 0, 0), image_hpr = (0.0, 0.0, 0))
        self.fishingHandleBaseFrame.hide()
        self.UICompoments['fishingHandleBaseFrame'] = self.fishingHandleBaseFrame
        self.fishingHandle = DirectFrame(parent = self.fishingHandleBaseFrame, frameSize = (-0.080000000000000002, 0.080000000000000002, -0.20000000000000001, 0.20000000000000001), relief = None, state = DGG.DISABLED, pos = (-0.10000000000000001, 0.0, -0.050000000000000003), hpr = (0, 0, 0), image = self.guiImage.find('**/pir_t_gui_fsh_handleArm'), image_scale = (1.0, 0.0, 1.0), image_pos = (-0.042000000000000003, 0, -0.115), image_hpr = (0.0, 0.0, 0))
        self.UICompoments['fishingHandle'] = self.fishingHandle
        self.arrowImage = DirectFrame(parent = self.fishingHandleBaseFrame, frameSize = (-0.40000000000000002, 0.40000000000000002, -0.40000000000000002, 0.40000000000000002), relief = None, state = DGG.DISABLED, pos = (0.0, 0.0, 0.0), hpr = (0, 0, 0), scale = (1.2, 0.0, 1.2), image = self.guiImage.find('**/pir_t_gui_fsh_arrow'), image_scale = (1.0, 0.0, 1.0), image_pos = (0.0, 0, 0.0), image_hpr = (0.0, 0.0, 0.0))
        self.arrowImage.hide()
        self.UICompoments['arrowImage'] = self.arrowImage
        btnGeom = (self.guiImage.find('**/pir_t_gui_fsh_handle'), self.guiImage.find('**/pir_t_gui_fsh_handle'), self.guiImage.find('**/pir_t_gui_fsh_handleOn'))
        self.fishingHandleButton = GuiButton(pos = (-0.29999999999999999, 0, -0.55000000000000004), hpr = (0, 0, 0), scale = 0.45000000000000001, image = btnGeom, image_pos = (0, 0, 0), image_scale = 1.0, sortOrder = 2)
        self.fishingHandleButton.bind(DGG.B1PRESS, self.handleButtonClicked)
        self.fishingHandleButton.reparentTo(self.fishingHandle)
        self.UICompoments['fishingHandleButton'] = self.fishingHandleButton
        self.fishingHandleBaseFrame.setTransparency(TransparencyAttrib.MAlpha)
        self.meterFrame.setTransparency(TransparencyAttrib.MAlpha)
        self.lineOneTransitTextNode = TextNode('lineOneTransitText')
        self.lineOneTransitTextNode.setFont(PiratesGlobals.getPirateFont())
        self.lineOneTransitTextNode.setText('')
        self.lineOneTransitTextNode.setAlign(TextNode.ACenter)
        self.lineOneTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
        self.lineOneTransitTextNodePath = NodePath(self.lineOneTransitTextNode)
        self.lineOneTransitTextNodePath.setPos(0.0, 0.0, -0.80000000000000004)
        self.lineOneTransitTextNodePath.setScale(0.34999999999999998, 0.34999999999999998, 0.34999999999999998)
        self.lineOneTransitTextNodePath.reparentTo(self.uiBaseNode)
        self.lineOneTransitTextNodePath.hide()
        self.UICompoments['lineOneTransitText'] = self.lineOneTransitTextNodePath
        self.lineTwoTransitTextNode = TextNode('lineTwoTransitText')
        self.lineTwoTransitTextNode.setFont(PiratesGlobals.getPirateFont())
        self.lineTwoTransitTextNode.setText('')
        self.lineTwoTransitTextNode.setAlign(TextNode.ACenter)
        self.lineTwoTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
        self.lineTwoTransitTextNodePath = NodePath(self.lineTwoTransitTextNode)
        self.lineTwoTransitTextNodePath.setPos(-0.40000000000000002, 0.0, -0.94999999999999996)
        self.lineTwoTransitTextNodePath.setScale(0.12, 0.12, 0.12)
        self.lineTwoTransitTextNodePath.reparentTo(self.uiBaseNode)
        self.lineTwoTransitTextNodePath.hide()
        self.UICompoments['lineTwoTransitText'] = self.lineTwoTransitTextNodePath
        base.loadingScreen.tick()
        self.test_guiImage = loader.loadModel('models/gui/toplevel_gui')
        self.buttonIcon = (self.test_guiImage.find('**/treasure_chest_closed'), self.test_guiImage.find('**/treasure_chest_closed'), self.test_guiImage.find('**/treasure_chest_closed_over'))
        self.winImagePanel = GuiPanel.GuiPanel('', 2.6000000000000001, 1.8999999999999999, True)
        self.winImagePanel.setPos(-1.3, 0.0, -0.94999999999999996)
        self.winImagePanel.reparentTo(self.uiBaseNode)
        self.winImagePanel.background = OnscreenImage(parent = self.winImagePanel, scale = (2.3999999999999999, 0, 1.8), image = self.guiImage.find('**/pir_t_gui_fsh_posterBackground'), hpr = (0, 0, 0), pos = (1.3, 0, 0.94999999999999996))
        self.winImagePanel.setBin('gui-popup', -4)
        self.winTitleTextNode = TextNode('winTitleTextNode')
        self.winTitleTextNode.setText('Congratulations!')
        self.winTitleTextNode.setAlign(TextNode.ACenter)
        self.winTitleTextNode.setFont(PiratesGlobals.getPirateFont())
        self.winTitleTextNode.setTextColor(0.23000000000000001, 0.089999999999999997, 0.029999999999999999, 1.0)
        self.winTitleTextNodePath = NodePath(self.winTitleTextNode)
        self.winTitleTextNodePath.setPos(1.3500000000000001, 0.0, 1.6699999999999999)
        self.winTitleTextNodePath.setScale(0.17999999999999999)
        self.winTitleTextNodePath.reparentTo(self.winImagePanel)
        self.wholeStoryTextNode = TextNode('storyTextNode')
        self.wholeStoryTextNode.setText('')
        self.wholeStoryTextNode.setWordwrap(19.0)
        self.wholeStoryTextNode.setTextColor(0.23000000000000001, 0.089999999999999997, 0.029999999999999999, 1.0)
        self.wholeStoryTextNodePath = NodePath(self.wholeStoryTextNode)
        self.wholeStoryTextNodePath.setPos(0.33000000000000002, 0.0, 1.6399999999999999)
        self.wholeStoryTextNodePath.setScale(0.050000000000000003)
        self.wholeStoryTextNodePath.reparentTo(self.winImagePanel)
        self.winImagePanel.closeButton['command'] = self.closeDialogGotNextState
        self.winImagePanel.closeButton['extraArgs'] = [
            'winImagePanel',
            'FarewellLegendaryFish',
            False]
        self.UICompoments['winImagePanel'] = self.winImagePanel
        self.winImagePanel.hide()
        self.luiCloseDialogSequence = Sequence()
        self.arrowImageRotationInterval = LerpHprInterval(self.arrowImage, 2.2000000000000002, self.arrowImage.getHpr() + Point3(0.0, 0.0, 280.0), self.arrowImage.getHpr())
        self.luiArrowRotatingSequence = Sequence(Func(self.showGui, [
            'arrowImage']), Parallel(Func(self.arrowImageRotationInterval.start), Wait(2.2000000000000002)), Func(self.hideGui, [
            'arrowImage']), Func(self.arrowImage.setHpr, self.arrowImage.getHpr() + Point3(0.0, 0.0, 5.0)), name = self.gameObject.distributedFishingSpot.uniqueName('luiArrowRotatingSequence'))
        self.lineOneColorChange = LerpColorScaleInterval(self.lineOneTransitTextNodePath, FishingGlobals.legendaryTransitionTextDuration, (1.0, 1.0, 1.0, 0.0), (1.0, 1.0, 1.0, 1.0), blendType = 'easeOut')
        self.lineOnePosChange = LerpPosInterval(self.lineOneTransitTextNodePath, FishingGlobals.legendaryTransitionTextDuration, (0.0, 0.0, -0.20000000000000001), (0.0, 0.0, -0.80000000000000004), blendType = 'easeOut')
        self.lineTwoCholorChange = LerpColorScaleInterval(self.lineTwoTransitTextNodePath, FishingGlobals.legendaryTransitionTextDuration, (1.0, 1.0, 1.0, 1.0), (1.0, 1.0, 1.0, 1.0), blendType = 'easeOut')
        self.lineTwoPosChange = LerpPosInterval(self.lineTwoTransitTextNodePath, FishingGlobals.legendaryTransitionTextDuration, (0.0, 0.0, -0.32000000000000001), (0.0, 0.0, -0.94999999999999996), blendType = 'easeOut')
        self.transitionTextMovingSequence = Sequence(Func(self.lineOneTransitTextNodePath.show), Func(self.lineTwoTransitTextNodePath.show), Parallel(self.lineOnePosChange, self.lineTwoPosChange, self.lineOneColorChange, self.lineTwoCholorChange), Func(self.lineOneTransitTextNodePath.hide), Func(self.lineTwoTransitTextNodePath.hide), name = self.gameObject.distributedFishingSpot.uniqueName('transitionTextMovingSequence'))
        self.meterFadeInInterval = Sequence(Func(self.meterFrame.show), LerpColorScaleInterval(self.meterFrame, FishingGlobals.legendaryTransitionTextDuration, colorScale = (1.0, 1.0, 1.0, 1.0), startColorScale = (1.0, 1.0, 1.0, 0.0), blendType = 'easeOut'), name = 'FadeInLegendaryMeter')
        self.meterFadeOutInterval = Sequence(LerpColorScaleInterval(self.meterFrame, FishingGlobals.legendaryTransitionTextDuration, colorScale = (1.0, 1.0, 1.0, 0.0), startColorScale = (1.0, 1.0, 1.0, 1.0), blendType = 'easeOut'), Func(self.meterFrame.hide), name = 'FadeOutLegendaryMeter')
        self.rodFadeInInterval = Sequence(Func(self.fishingHandleBaseFrame.show), LerpColorScaleInterval(self.fishingHandleBaseFrame, FishingGlobals.legendaryTransitionTextDuration, colorScale = (1.0, 1.0, 1.0, 1.0), startColorScale = (1.0, 1.0, 1.0, 0.0), blendType = 'easeOut'), name = 'FadeInLegendaryRodInterface')
        self.rodFadeOutInterval = Sequence(LerpColorScaleInterval(self.fishingHandleBaseFrame, FishingGlobals.legendaryTransitionTextDuration, colorScale = (1.0, 1.0, 1.0, 0.0), startColorScale = (1.0, 1.0, 1.0, 1.0), blendType = 'easeOut'), Func(self.fishingHandleBaseFrame.hide), name = 'FadeOutLegendaryRodInterface')
        base.loadingScreen.tick()
        smallScale = self.fishingHandleButton['scale']
        bigScale = self.fishingHandleButton['scale'] * 1.2
        self.buttonGrowUpInterval = LerpScaleInterval(self.fishingHandleButton, 1.0, bigScale, smallScale)
        self.luiFightTransitSequence = Sequence(Parallel(Func(self.fishingHandleBaseFrame.show), Func(self.meterFadeOutInterval.start), Func(self.rodFadeInInterval.start), Func(self.buttonGrowUpInterval.start)), Wait(1.0), Func(self.meterFrame.hide), name = self.gameObject.distributedFishingSpot.uniqueName('luiFightTransitSequence'))
        self.luiReelTransitSequence = Sequence(Parallel(Func(self.fishingHandleBaseFrame.show), Func(self.meterFadeOutInterval.start), Func(self.rodFadeInInterval.start)), Wait(1.0), Func(self.meterFrame.hide), name = self.gameObject.distributedFishingSpot.uniqueName('luiReelTransitSequence'))
        self.luiStruggleTransitSequence = Sequence(Parallel(Func(self.meterFrame.show), Func(self.resetFishingRod), self.meterFadeInInterval, self.rodFadeOutInterval), Wait(1.0), Func(self.fishingHandleBaseFrame.hide), name = self.gameObject.distributedFishingSpot.uniqueName('luiStruggleTransitSequence'))
        self.meterFadeOutInterval.start()
        self.rodFadeOutInterval.start()
        self.hideAllGUI()
        base.loadingScreen.endStep('LegendaryGameGUI')

    
    def hideAllGUI(self):
        self.uiBaseNode.reparentTo(hidden)
        self.leftBaseNode.reparentTo(hidden)

    
    def showAllGUI(self):
        self.uiBaseNode.reparentTo(aspect2d)
        self.leftBaseNode.reparentTo(base.a2dLeftCenter)

    
    def hideGui(self, nameList):
        for ui in nameList:
            self.UICompoments[ui].hide()
        

    
    def showGui(self, nameList):
        for ui in nameList:
            self.UICompoments[ui].show()
        

    
    def destroy(self):
        self.arrowImageRotationInterval.pause()
        self.arrowImageRotationInterval.clearToInitial()
        self.luiArrowRotatingSequence.pause()
        self.luiArrowRotatingSequence.clearToInitial()
        self.luiCloseDialogSequence.pause()
        self.luiCloseDialogSequence.clearToInitial()
        totalKey = self.UICompoments.keys()
        for iKey in totalKey:
            del self.UICompoments[iKey]
        
        self.fishingHandle = None
        self.fishingHandleButton = None
        self.fishingRod.removeNode()
        self.leftBaseNode.removeNode()
        self.uiBaseNode.removeNode()
        if self.fishActor:
            self.fishActor.destroy()
            self.fishActor = None
        

    
    def handleButtonClicked(self, mouseKey):
        if self.gameObject.lfgFsm.getCurrentOrNextState() in [
            'CatchIt']:
            self.gameObject.lfgFsm.request('Transition', 'Struggle')
            self.gameObject.sfx['legendaryGreen'].play()
        

    
    def setTransitionText(self, state):
        self.lineOneTransitTextNode.setText(PLocalizer.LegendaryFishingGui[state][0])
        self.lineTwoTransitTextNode.setText(PLocalizer.LegendaryFishingGui[state][1])

    
    def resetInterval(self):
        self.transitionTextMovingSequence.pause()
        self.transitionTextMovingSequence.clearToInitial()
        self.lineOneColorChange.pause()
        self.lineOneColorChange.clearToInitial()
        self.lineOnePosChange.pause()
        self.lineOnePosChange.clearToInitial()
        self.lineTwoCholorChange.pause()
        self.lineTwoCholorChange.clearToInitial()
        self.lineTwoPosChange.pause()
        self.lineTwoPosChange.clearToInitial()
        self.luiReelTransitSequence.pause()
        self.luiReelTransitSequence.clearToInitial()
        self.luiStruggleTransitSequence.pause()
        self.luiStruggleTransitSequence.clearToInitial()
        self.luiFightTransitSequence.pause()
        self.luiFightTransitSequence.clearToInitial()
        self.buttonGrowUpInterval.pause()
        self.buttonGrowUpInterval.clearToInitial()
        self.meterFadeOutInterval.pause()
        self.meterFadeOutInterval.clearToInitial()
        self.rodFadeInInterval.pause()
        self.rodFadeInInterval.clearToInitial()
        self.meterFadeInInterval.pause()
        self.meterFadeInInterval.clearToInitial()
        self.rodFadeOutInterval.pause()
        self.rodFadeOutInterval.clearToInitial()

    
    def fightingTransit(self):
        self.luiFightTransitSequence.start()

    
    def reelTransit(self):
        self.luiReelTransitSequence.start()

    
    def struggleTransit(self):
        self.luiStruggleTransitSequence.start()

    
    def resetFishingRod(self):
        self.fishingRod.setR(FishingGlobals.fishingRodInitSlope)

    
    def showWinImage(self, fish):
        self.hideGui([
            'meterFrame',
            'fishingHandleBaseFrame'])
        result = fish.myData['name'].split(' ')
        fileName = str(result[0]).capitalize()
        imgName = 'pir_t_gui_fsh_render%s' % fileName
        self.actorAnim['swimIdleOpposite'] = 'models/char/pir_a_gam_fsh_%s_%s.bam' % (fish.myData['model'], 'swimIdleOpposite')
        self.fishActor = BlendActor('models/char/pir_r_gam_fsh_%s.bam' % fish.myData['model'], self.actorAnim, FishingGlobals.defaultFishBlendTime, FishingGlobals.fishBlendTimeDict)
        self.fishActor.setPlayRate(fish.myData['speed'] * fish.myData['swimAnimationMultiplier'], 'swimIdleOpposite')
        self.fishActor.changeAnimationTo('swimIdleOpposite')
        self.fishActor.reparentTo(self.winImagePanel)
        self.fishActor.setScale(self.scaleSize[fish.myData['id']])
        self.fishActor.setPos(1.7, 0, 1.0)
        self.fishActor.setHpr(0, 0, 35)
        self.fishActor.setDepthWrite(True)
        self.fishActor.setDepthTest(True)
        self.wholeStoryTextNode.setText(PLocalizer.LegendSelectionGui['wholeStory'][fish.myData['id']])
        self.winImagePanel.show()

    
    def closeDialogGotNextState(self, object, targetState, ifFadeInAgain):
        if self.fishActor:
            self.fishActor.destroy()
            self.fishActor = None
        
        self.luiCloseDialogSequence = Sequence(Func(self.gameObject.distributedFishingSpot.fadeOut), Wait(0.40000000000000002), Func(self.UICompoments[object].hide), Func(self.gameObject.lfgFsm.request, targetState), name = self.gameObject.distributedFishingSpot.uniqueName('luiCloseDialogSequence'))
        self.luiCloseDialogSequence.start()

    
    def updateStruggleTimerText(self, time, percent):
        self.meterFrame['text'] = str(time)
        self.meterFrame['text_fg'] = (1.0 - percent, percent, 0.0, 1.0)
Exemplo n.º 36
0
class LegendaryFishingGameGUI:
    def __init__(self, gameObject=None):
        base.loadingScreen.beginStep('LegendaryGameGUI', 4, 20)
        self.gameObject = gameObject
        self.guiImage = loader.loadModel(
            'models/minigames/pir_m_gam_fsh_legendaryGui')
        self.UICompoments = {}
        self.uiBaseNode = NodePath('baseNode')
        self.uiBaseNode.reparentTo(aspect2d)
        self.uiBaseNode.show()
        self.leftBaseNode = NodePath('leftBaseNode')
        self.leftBaseNode.reparentTo(base.a2dLeftCenter)
        self.leftBaseNode.show()
        self.fishActor = None
        self.actorAnim = {}
        self.scaleSize = {
            InventoryType.Collection_Set11_Part1: 0.059999999999999998,
            InventoryType.Collection_Set11_Part2: 0.055,
            InventoryType.Collection_Set11_Part3: 0.12,
            InventoryType.Collection_Set11_Part4: 0.086999999999999994,
            InventoryType.Collection_Set11_Part5: 0.080000000000000002
        }
        self.meterFrame = DirectFrame(
            parent=self.leftBaseNode,
            frameSize=(-0.29999999999999999, 0.29999999999999999, -1.0, 0.0),
            frameColor=(1.0, 1.0, 1.0, 0.0),
            relief=None,
            state=DGG.DISABLED,
            pos=(1.0, 0.0, -0.45000000000000001),
            hpr=(0, 0, 0),
            scale=(1.3, 0.0, 1.3),
            image=self.guiImage.find('**/pir_t_gui_fsh_meter'),
            image_scale=(0.20000000000000001, 0.0, 0.80000000000000004),
            image_pos=(0, 0, 0),
            text='',
            textMayChange=1,
            text_scale=PiratesGuiGlobals.TextScaleTitleLarge,
            text_pos=(-0.55000000000000004, 0.10000000000000001),
            text_shadow=PiratesGuiGlobals.TextShadow)
        self.UICompoments['meterFrame'] = self.meterFrame
        self.fishingRod = DirectFrame(
            parent=self.meterFrame,
            frameSize=(-0.29999999999999999, 0.29999999999999999, -1.0, 0.0),
            relief=None,
            state=DGG.DISABLED,
            pos=FishingGlobals.fishingRodScreenPosition,
            image=self.guiImage.find('**/pir_t_gui_fsh_fullRod'),
            image_scale=(1.0, 0.0, 0.125),
            image_pos=(0.20000000000000001, 0, 0))
        self.fishingRod.setR(FishingGlobals.fishingRodInitSlope)
        self.UICompoments['fishingRod'] = self.fishingRod
        base.loadingScreen.tick()
        self.fishingHandleBaseFrame = DirectFrame(
            parent=self.uiBaseNode,
            frameSize=(-0.29999999999999999, 0.29999999999999999, -1.5, 1.5),
            frameColor=(1.0, 1.0, 1.0, 0.0),
            relief=None,
            state=DGG.DISABLED,
            pos=(0.0, 0.0, 0.0),
            hpr=(0, 0, 0),
            scale=(0.71999999999999997, 0.0, 0.71999999999999997),
            image=self.guiImage.find('**/pir_t_gui_fsh_partialRod'),
            image_scale=(3.7999999999999998, 0.0, 1.8999999999999999),
            image_pos=(0, 0, 0),
            image_hpr=(0.0, 0.0, 0))
        self.fishingHandleBaseFrame.hide()
        self.UICompoments[
            'fishingHandleBaseFrame'] = self.fishingHandleBaseFrame
        self.fishingHandle = DirectFrame(
            parent=self.fishingHandleBaseFrame,
            frameSize=(-0.080000000000000002, 0.080000000000000002,
                       -0.20000000000000001, 0.20000000000000001),
            relief=None,
            state=DGG.DISABLED,
            pos=(-0.10000000000000001, 0.0, -0.050000000000000003),
            hpr=(0, 0, 0),
            image=self.guiImage.find('**/pir_t_gui_fsh_handleArm'),
            image_scale=(1.0, 0.0, 1.0),
            image_pos=(-0.042000000000000003, 0, -0.115),
            image_hpr=(0.0, 0.0, 0))
        self.UICompoments['fishingHandle'] = self.fishingHandle
        self.arrowImage = DirectFrame(
            parent=self.fishingHandleBaseFrame,
            frameSize=(-0.40000000000000002, 0.40000000000000002,
                       -0.40000000000000002, 0.40000000000000002),
            relief=None,
            state=DGG.DISABLED,
            pos=(0.0, 0.0, 0.0),
            hpr=(0, 0, 0),
            scale=(1.2, 0.0, 1.2),
            image=self.guiImage.find('**/pir_t_gui_fsh_arrow'),
            image_scale=(1.0, 0.0, 1.0),
            image_pos=(0.0, 0, 0.0),
            image_hpr=(0.0, 0.0, 0.0))
        self.arrowImage.hide()
        self.UICompoments['arrowImage'] = self.arrowImage
        btnGeom = (self.guiImage.find('**/pir_t_gui_fsh_handle'),
                   self.guiImage.find('**/pir_t_gui_fsh_handle'),
                   self.guiImage.find('**/pir_t_gui_fsh_handleOn'))
        self.fishingHandleButton = GuiButton(pos=(-0.29999999999999999, 0,
                                                  -0.55000000000000004),
                                             hpr=(0, 0, 0),
                                             scale=0.45000000000000001,
                                             image=btnGeom,
                                             image_pos=(0, 0, 0),
                                             image_scale=1.0,
                                             sortOrder=2)
        self.fishingHandleButton.bind(DGG.B1PRESS, self.handleButtonClicked)
        self.fishingHandleButton.reparentTo(self.fishingHandle)
        self.UICompoments['fishingHandleButton'] = self.fishingHandleButton
        self.fishingHandleBaseFrame.setTransparency(TransparencyAttrib.MAlpha)
        self.meterFrame.setTransparency(TransparencyAttrib.MAlpha)
        self.lineOneTransitTextNode = TextNode('lineOneTransitText')
        self.lineOneTransitTextNode.setFont(PiratesGlobals.getPirateFont())
        self.lineOneTransitTextNode.setText('')
        self.lineOneTransitTextNode.setAlign(TextNode.ACenter)
        self.lineOneTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
        self.lineOneTransitTextNodePath = NodePath(self.lineOneTransitTextNode)
        self.lineOneTransitTextNodePath.setPos(0.0, 0.0, -0.80000000000000004)
        self.lineOneTransitTextNodePath.setScale(0.34999999999999998,
                                                 0.34999999999999998,
                                                 0.34999999999999998)
        self.lineOneTransitTextNodePath.reparentTo(self.uiBaseNode)
        self.lineOneTransitTextNodePath.hide()
        self.UICompoments[
            'lineOneTransitText'] = self.lineOneTransitTextNodePath
        self.lineTwoTransitTextNode = TextNode('lineTwoTransitText')
        self.lineTwoTransitTextNode.setFont(PiratesGlobals.getPirateFont())
        self.lineTwoTransitTextNode.setText('')
        self.lineTwoTransitTextNode.setAlign(TextNode.ACenter)
        self.lineTwoTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
        self.lineTwoTransitTextNodePath = NodePath(self.lineTwoTransitTextNode)
        self.lineTwoTransitTextNodePath.setPos(-0.40000000000000002, 0.0,
                                               -0.94999999999999996)
        self.lineTwoTransitTextNodePath.setScale(0.12, 0.12, 0.12)
        self.lineTwoTransitTextNodePath.reparentTo(self.uiBaseNode)
        self.lineTwoTransitTextNodePath.hide()
        self.UICompoments[
            'lineTwoTransitText'] = self.lineTwoTransitTextNodePath
        base.loadingScreen.tick()
        self.test_guiImage = loader.loadModel('models/gui/toplevel_gui')
        self.buttonIcon = (
            self.test_guiImage.find('**/treasure_chest_closed'),
            self.test_guiImage.find('**/treasure_chest_closed'),
            self.test_guiImage.find('**/treasure_chest_closed_over'))
        self.winImagePanel = GuiPanel.GuiPanel('', 2.6000000000000001,
                                               1.8999999999999999, True)
        self.winImagePanel.setPos(-1.3, 0.0, -0.94999999999999996)
        self.winImagePanel.reparentTo(self.uiBaseNode)
        self.winImagePanel.background = OnscreenImage(
            parent=self.winImagePanel,
            scale=(2.3999999999999999, 0, 1.8),
            image=self.guiImage.find('**/pir_t_gui_fsh_posterBackground'),
            hpr=(0, 0, 0),
            pos=(1.3, 0, 0.94999999999999996))
        self.winImagePanel.setBin('gui-popup', -4)
        self.winTitleTextNode = TextNode('winTitleTextNode')
        self.winTitleTextNode.setText('Congratulations!')
        self.winTitleTextNode.setAlign(TextNode.ACenter)
        self.winTitleTextNode.setFont(PiratesGlobals.getPirateFont())
        self.winTitleTextNode.setTextColor(0.23000000000000001,
                                           0.089999999999999997,
                                           0.029999999999999999, 1.0)
        self.winTitleTextNodePath = NodePath(self.winTitleTextNode)
        self.winTitleTextNodePath.setPos(1.3500000000000001, 0.0,
                                         1.6699999999999999)
        self.winTitleTextNodePath.setScale(0.17999999999999999)
        self.winTitleTextNodePath.reparentTo(self.winImagePanel)
        self.wholeStoryTextNode = TextNode('storyTextNode')
        self.wholeStoryTextNode.setText('')
        self.wholeStoryTextNode.setWordwrap(19.0)
        self.wholeStoryTextNode.setTextColor(0.23000000000000001,
                                             0.089999999999999997,
                                             0.029999999999999999, 1.0)
        self.wholeStoryTextNodePath = NodePath(self.wholeStoryTextNode)
        self.wholeStoryTextNodePath.setPos(0.33000000000000002, 0.0,
                                           1.6399999999999999)
        self.wholeStoryTextNodePath.setScale(0.050000000000000003)
        self.wholeStoryTextNodePath.reparentTo(self.winImagePanel)
        self.winImagePanel.closeButton[
            'command'] = self.closeDialogGotNextState
        self.winImagePanel.closeButton['extraArgs'] = [
            'winImagePanel', 'FarewellLegendaryFish', False
        ]
        self.UICompoments['winImagePanel'] = self.winImagePanel
        self.winImagePanel.hide()
        self.luiCloseDialogSequence = Sequence()
        self.arrowImageRotationInterval = LerpHprInterval(
            self.arrowImage, 2.2000000000000002,
            self.arrowImage.getHpr() + Point3(0.0, 0.0, 280.0),
            self.arrowImage.getHpr())
        self.luiArrowRotatingSequence = Sequence(
            Func(self.showGui, ['arrowImage']),
            Parallel(Func(self.arrowImageRotationInterval.start),
                     Wait(2.2000000000000002)),
            Func(self.hideGui, ['arrowImage']),
            Func(self.arrowImage.setHpr,
                 self.arrowImage.getHpr() + Point3(0.0, 0.0, 5.0)),
            name=self.gameObject.distributedFishingSpot.uniqueName(
                'luiArrowRotatingSequence'))
        self.lineOneColorChange = LerpColorScaleInterval(
            self.lineOneTransitTextNodePath,
            FishingGlobals.legendaryTransitionTextDuration,
            (1.0, 1.0, 1.0, 0.0), (1.0, 1.0, 1.0, 1.0),
            blendType='easeOut')
        self.lineOnePosChange = LerpPosInterval(
            self.lineOneTransitTextNodePath,
            FishingGlobals.legendaryTransitionTextDuration,
            (0.0, 0.0, -0.20000000000000001), (0.0, 0.0, -0.80000000000000004),
            blendType='easeOut')
        self.lineTwoCholorChange = LerpColorScaleInterval(
            self.lineTwoTransitTextNodePath,
            FishingGlobals.legendaryTransitionTextDuration,
            (1.0, 1.0, 1.0, 1.0), (1.0, 1.0, 1.0, 1.0),
            blendType='easeOut')
        self.lineTwoPosChange = LerpPosInterval(
            self.lineTwoTransitTextNodePath,
            FishingGlobals.legendaryTransitionTextDuration,
            (0.0, 0.0, -0.32000000000000001), (0.0, 0.0, -0.94999999999999996),
            blendType='easeOut')
        self.transitionTextMovingSequence = Sequence(
            Func(self.lineOneTransitTextNodePath.show),
            Func(self.lineTwoTransitTextNodePath.show),
            Parallel(self.lineOnePosChange, self.lineTwoPosChange,
                     self.lineOneColorChange, self.lineTwoCholorChange),
            Func(self.lineOneTransitTextNodePath.hide),
            Func(self.lineTwoTransitTextNodePath.hide),
            name=self.gameObject.distributedFishingSpot.uniqueName(
                'transitionTextMovingSequence'))
        self.meterFadeInInterval = Sequence(
            Func(self.meterFrame.show),
            LerpColorScaleInterval(
                self.meterFrame,
                FishingGlobals.legendaryTransitionTextDuration,
                colorScale=(1.0, 1.0, 1.0, 1.0),
                startColorScale=(1.0, 1.0, 1.0, 0.0),
                blendType='easeOut'),
            name='FadeInLegendaryMeter')
        self.meterFadeOutInterval = Sequence(LerpColorScaleInterval(
            self.meterFrame,
            FishingGlobals.legendaryTransitionTextDuration,
            colorScale=(1.0, 1.0, 1.0, 0.0),
            startColorScale=(1.0, 1.0, 1.0, 1.0),
            blendType='easeOut'),
                                             Func(self.meterFrame.hide),
                                             name='FadeOutLegendaryMeter')
        self.rodFadeInInterval = Sequence(
            Func(self.fishingHandleBaseFrame.show),
            LerpColorScaleInterval(
                self.fishingHandleBaseFrame,
                FishingGlobals.legendaryTransitionTextDuration,
                colorScale=(1.0, 1.0, 1.0, 1.0),
                startColorScale=(1.0, 1.0, 1.0, 0.0),
                blendType='easeOut'),
            name='FadeInLegendaryRodInterface')
        self.rodFadeOutInterval = Sequence(
            LerpColorScaleInterval(
                self.fishingHandleBaseFrame,
                FishingGlobals.legendaryTransitionTextDuration,
                colorScale=(1.0, 1.0, 1.0, 0.0),
                startColorScale=(1.0, 1.0, 1.0, 1.0),
                blendType='easeOut'),
            Func(self.fishingHandleBaseFrame.hide),
            name='FadeOutLegendaryRodInterface')
        base.loadingScreen.tick()
        smallScale = self.fishingHandleButton['scale']
        bigScale = self.fishingHandleButton['scale'] * 1.2
        self.buttonGrowUpInterval = LerpScaleInterval(self.fishingHandleButton,
                                                      1.0, bigScale,
                                                      smallScale)
        self.luiFightTransitSequence = Sequence(
            Parallel(Func(self.fishingHandleBaseFrame.show),
                     Func(self.meterFadeOutInterval.start),
                     Func(self.rodFadeInInterval.start),
                     Func(self.buttonGrowUpInterval.start)),
            Wait(1.0),
            Func(self.meterFrame.hide),
            name=self.gameObject.distributedFishingSpot.uniqueName(
                'luiFightTransitSequence'))
        self.luiReelTransitSequence = Sequence(
            Parallel(Func(self.fishingHandleBaseFrame.show),
                     Func(self.meterFadeOutInterval.start),
                     Func(self.rodFadeInInterval.start)),
            Wait(1.0),
            Func(self.meterFrame.hide),
            name=self.gameObject.distributedFishingSpot.uniqueName(
                'luiReelTransitSequence'))
        self.luiStruggleTransitSequence = Sequence(
            Parallel(Func(self.meterFrame.show), Func(self.resetFishingRod),
                     self.meterFadeInInterval, self.rodFadeOutInterval),
            Wait(1.0),
            Func(self.fishingHandleBaseFrame.hide),
            name=self.gameObject.distributedFishingSpot.uniqueName(
                'luiStruggleTransitSequence'))
        self.meterFadeOutInterval.start()
        self.rodFadeOutInterval.start()
        self.hideAllGUI()
        base.loadingScreen.endStep('LegendaryGameGUI')

    def hideAllGUI(self):
        self.uiBaseNode.reparentTo(hidden)
        self.leftBaseNode.reparentTo(hidden)

    def showAllGUI(self):
        self.uiBaseNode.reparentTo(aspect2d)
        self.leftBaseNode.reparentTo(base.a2dLeftCenter)

    def hideGui(self, nameList):
        for ui in nameList:
            self.UICompoments[ui].hide()

    def showGui(self, nameList):
        for ui in nameList:
            self.UICompoments[ui].show()

    def destroy(self):
        self.arrowImageRotationInterval.pause()
        self.arrowImageRotationInterval.clearToInitial()
        self.luiArrowRotatingSequence.pause()
        self.luiArrowRotatingSequence.clearToInitial()
        self.luiCloseDialogSequence.pause()
        self.luiCloseDialogSequence.clearToInitial()
        totalKey = self.UICompoments.keys()
        for iKey in totalKey:
            del self.UICompoments[iKey]

        self.fishingHandle = None
        self.fishingHandleButton = None
        self.fishingRod.removeNode()
        self.leftBaseNode.removeNode()
        self.uiBaseNode.removeNode()
        if self.fishActor:
            self.fishActor.destroy()
            self.fishActor = None

    def handleButtonClicked(self, mouseKey):
        if self.gameObject.lfgFsm.getCurrentOrNextState() in ['CatchIt']:
            self.gameObject.lfgFsm.request('Transition', 'Struggle')
            self.gameObject.sfx['legendaryGreen'].play()

    def setTransitionText(self, state):
        self.lineOneTransitTextNode.setText(
            PLocalizer.LegendaryFishingGui[state][0])
        self.lineTwoTransitTextNode.setText(
            PLocalizer.LegendaryFishingGui[state][1])

    def resetInterval(self):
        self.transitionTextMovingSequence.pause()
        self.transitionTextMovingSequence.clearToInitial()
        self.lineOneColorChange.pause()
        self.lineOneColorChange.clearToInitial()
        self.lineOnePosChange.pause()
        self.lineOnePosChange.clearToInitial()
        self.lineTwoCholorChange.pause()
        self.lineTwoCholorChange.clearToInitial()
        self.lineTwoPosChange.pause()
        self.lineTwoPosChange.clearToInitial()
        self.luiReelTransitSequence.pause()
        self.luiReelTransitSequence.clearToInitial()
        self.luiStruggleTransitSequence.pause()
        self.luiStruggleTransitSequence.clearToInitial()
        self.luiFightTransitSequence.pause()
        self.luiFightTransitSequence.clearToInitial()
        self.buttonGrowUpInterval.pause()
        self.buttonGrowUpInterval.clearToInitial()
        self.meterFadeOutInterval.pause()
        self.meterFadeOutInterval.clearToInitial()
        self.rodFadeInInterval.pause()
        self.rodFadeInInterval.clearToInitial()
        self.meterFadeInInterval.pause()
        self.meterFadeInInterval.clearToInitial()
        self.rodFadeOutInterval.pause()
        self.rodFadeOutInterval.clearToInitial()

    def fightingTransit(self):
        self.luiFightTransitSequence.start()

    def reelTransit(self):
        self.luiReelTransitSequence.start()

    def struggleTransit(self):
        self.luiStruggleTransitSequence.start()

    def resetFishingRod(self):
        self.fishingRod.setR(FishingGlobals.fishingRodInitSlope)

    def showWinImage(self, fish):
        self.hideGui(['meterFrame', 'fishingHandleBaseFrame'])
        result = fish.myData['name'].split(' ')
        fileName = str(result[0]).capitalize()
        imgName = 'pir_t_gui_fsh_render%s' % fileName
        self.actorAnim[
            'swimIdleOpposite'] = 'models/char/pir_a_gam_fsh_%s_%s.bam' % (
                fish.myData['model'], 'swimIdleOpposite')
        self.fishActor = BlendActor(
            'models/char/pir_r_gam_fsh_%s.bam' % fish.myData['model'],
            self.actorAnim, FishingGlobals.defaultFishBlendTime,
            FishingGlobals.fishBlendTimeDict)
        self.fishActor.setPlayRate(
            fish.myData['speed'] * fish.myData['swimAnimationMultiplier'],
            'swimIdleOpposite')
        self.fishActor.changeAnimationTo('swimIdleOpposite')
        self.fishActor.reparentTo(self.winImagePanel)
        self.fishActor.setScale(self.scaleSize[fish.myData['id']])
        self.fishActor.setPos(1.7, 0, 1.0)
        self.fishActor.setHpr(0, 0, 35)
        self.fishActor.setDepthWrite(True)
        self.fishActor.setDepthTest(True)
        self.wholeStoryTextNode.setText(
            PLocalizer.LegendSelectionGui['wholeStory'][fish.myData['id']])
        self.winImagePanel.show()

    def closeDialogGotNextState(self, object, targetState, ifFadeInAgain):
        if self.fishActor:
            self.fishActor.destroy()
            self.fishActor = None

        self.luiCloseDialogSequence = Sequence(
            Func(self.gameObject.distributedFishingSpot.fadeOut),
            Wait(0.40000000000000002),
            Func(self.UICompoments[object].hide),
            Func(self.gameObject.lfgFsm.request, targetState),
            name=self.gameObject.distributedFishingSpot.uniqueName(
                'luiCloseDialogSequence'))
        self.luiCloseDialogSequence.start()

    def updateStruggleTimerText(self, time, percent):
        self.meterFrame['text'] = str(time)
        self.meterFrame['text_fg'] = (1.0 - percent, percent, 0.0, 1.0)
Exemplo n.º 37
0
class AmmoSkillButton(SkillButton.SkillButton):
    def __init__(self,
                 skillId,
                 slotId,
                 callback,
                 quantity=0,
                 skillRank=0,
                 showQuantity=False,
                 showHelp=False,
                 showRing=False,
                 hotkey=None,
                 name='',
                 showIcon=True,
                 showLock=False,
                 rechargeSkillId=False,
                 assocAmmo=[]):
        if skillId in [
                InventoryType.DefenseCannonRoundShot,
                InventoryType.DefenseCannonEmpty
        ]:
            showQuantity = False

        if not Freebooter.getPaidStatus(
                base.localAvatar.doId
        ) and slotId >= CannonDefenseGlobals.FREEBOOTER_MAX_AMMO_SLOTS:
            showLock = True

        SkillButton.SkillButton.__init__(self, skillId, callback, quantity,
                                         skillRank, showQuantity, showHelp,
                                         showRing, hotkey, name, showIcon,
                                         showLock, rechargeSkillId, assocAmmo)
        self.toggleFrame['image_scale'] = 0.55000000000000004
        self.toolTipBox = None
        self.slotId = slotId
        self._initButtons()
        self.updateSkillId(skillId)

    def _initButtons(self):
        self.sellButtonModel = loader.loadModel(
            'models/gui/pir_m_gui_can_buttonSell')
        self.sellButton = GuiButton(
            parent=self,
            image=(self.sellButtonModel.find('**/idle'),
                   self.sellButtonModel.find('**/idle'),
                   self.sellButtonModel.find('**/over')),
            image_scale=1,
            scale=0.40000000000000002,
            sortOrder=100,
            pos=(0, 0, -0.125),
            command=self.onSellClick)
        self.sellButton.bind(DGG.ENTER, self.showToolTip)
        self.sellButton.bind(DGG.EXIT, self.hideToolTip)

    def updateSkillId(self, skillId):
        SkillButton.SkillButton.updateSkillId(self, skillId)
        if not hasattr(self, 'sellButton'):
            return None

        if skillId == InventoryType.DefenseCannonEmpty:
            self.sellButton['state'] = DGG.DISABLED
            self.sellButton.hide()
            if skillId == InventoryType.DefenseCannonEmpty:
                self.setShowIcon(False)

        else:
            self.sellButton['state'] = DGG.NORMAL
            self.sellButton.show()
            self.setShowIcon(True)

    def createToolTip(self):
        if self.toolTipBox:
            return None

        self.label = DirectLabel(parent=None,
                                 relief=None,
                                 text=PLocalizer.SellButton,
                                 text_align=TextNode.ALeft,
                                 text_scale=PiratesGuiGlobals.TextScaleLarge,
                                 text_fg=PiratesGuiGlobals.TextFG2,
                                 text_wordwrap=12)
        height = -self.label.getHeight()
        width = self.label.getWidth()
        toolTipScale = 2.5
        self.toolTipBox = None
        self.toolTipBox = BorderFrame(parent=self.sellButton,
                                      frameSize=(-0.01, width, height,
                                                 0.050000000000000003),
                                      scale=toolTipScale,
                                      pos=(-(width * toolTipScale * 0.5), 0,
                                           height * toolTipScale * 2.25),
                                      state=DGG.DISABLED)
        self.label.reparentTo(self.toolTipBox)

    def showToolTip(self, event):
        self.createToolTip()

    def hideToolTip(self, event):
        if self.toolTipBox:
            self.toolTipBox.destroy()
            self.toolTipBox = None

    def onSellClick(self):
        messenger.send('onSellClick', [self.skillId])
Exemplo n.º 38
0
class ChestTray(GuiTray.GuiTray):
    __module__ = __name__
    WantClothingPage = base.config.GetBool('want-clothing-page', 0)
    WantTitlesPage = base.config.GetBool(
        'want-land-infamy', 0) or base.config.GetBool('want-sea-infamy', 0)

    def __init__(self, parent, parentMgr, **kw):
        GuiTray.GuiTray.__init__(self, parent, 0.6, 0.12, **kw)
        self.initialiseoptions(ChestTray)
        self.setBin('gui-fixed', 0)
        self.state = 0
        self.buttonsParent = self.attachNewNode(
            ModelNode('ChestTray.buttonsParent'), sort=1)
        self.stickyButtonsParent = self.attachNewNode(
            ModelNode('ChestTray.stickyButtonsParent'), sort=1)
        self.stickyButtonsParent.setPos(0, 0, 0.02)
        self.buttons = {}
        self.buildShowHideButtonsIvals()
        self.openSfx = loadSfx(SoundGlobals.SFX_GUI_OPEN_SEACHEST)
        self.openSfx.setVolume(0.4)
        self.closeSfx = loadSfx(SoundGlobals.SFX_GUI_CLOSE_SEACHEST)
        self.closeSfx.setVolume(0.4)
        gui = loader.loadModel('models/gui/toplevel_gui')
        gui_main = loader.loadModel('models/gui/gui_main')
        helpPos = (-0.26, 0, 0.06)
        helpDelay = 0
        self.buttonImage = gui.find('**/topgui_icon_box')
        self.buttonImageIn = gui.find('**/topgui_icon_box_in')
        self.buttonColors = (VBase4(0.7, 0.7, 0.7,
                                    1), VBase4(0.8, 0.8, 0.8,
                                               1), VBase4(1.0, 1.0, 1.0, 1),
                             VBase4(0.6, 0.6, 0.6, 1))
        self.currentButtonIn = None
        self.highlightButtons = [
            'guiMgrToggleMap', 'guiMgrToggleWeapons', 'guiMgrToggleQuest',
            'guiMgrToggleLevels', 'guiMgrToggleShips', 'guiMgrToggleTreasures',
            'guiMgrToggleLookout', 'guiMgrToggleInventory',
            'guiMgrToggleTitles'
        ]
        buttonOptions = {
            'image': self.buttonImage,
            'geom': None,
            'relief': None,
            'frameSize': (0, 0.12, 0, 0.12),
            'image_scale': 0.47,
            'image_pos': (0.06, 0, 0.06),
            'image0_color': self.buttonColors[0],
            'image1_color': self.buttonColors[1],
            'image2_color': self.buttonColors[2],
            'image3_color': self.buttonColors[3],
            'geom_scale': 0.12,
            'geom_pos': (0.06, 0, 0.06),
            'command': self.togglePanel
        }
        extraHeight = 0
        if self.WantTitlesPage:
            extraHeight = 0.12
        buttonOptions['geom'] = gui.find('**/friend_button_over')
        buttonOptions['geom_scale'] = 0.12
        self.socialButton = GuiButton(parent=self.buttonsParent,
                                      hotkeys=['f', 'shift-f'],
                                      hotkeyLabel='F',
                                      helpText=PLocalizer.SocialButtonHelp,
                                      helpPos=helpPos,
                                      helpDelay=helpDelay,
                                      extraArgs=['guiMgrToggleSocial'],
                                      pos=(0.01, 0, 1.16 + extraHeight),
                                      **buttonOptions)
        self.buttons['guiMgrToggleSocial'] = self.socialButton
        buttonOptions['geom'] = gui.find('**/compass_small_button_open_over')
        buttonOptions['geom_scale'] = 0.09
        self.radarButton = GuiButton(parent=self.buttonsParent,
                                     hotkeys=['c', 'shift-c'],
                                     hotkeyLabel='C',
                                     helpText=PLocalizer.RadarButtonHelp,
                                     helpPos=helpPos,
                                     helpDelay=helpDelay,
                                     extraArgs=['guiMgrToggleRadar'],
                                     pos=(0.01, 0, 1.04 + extraHeight),
                                     **buttonOptions)
        self.buttons['guiMgrToggleRadar'] = self.radarButton
        buttonPosZ = 0.88
        buttonHeight = 0.12
        if self.WantTitlesPage:
            buttonPosZ += buttonHeight
        buttonOptions['geom'] = gui_main.find('**/world_map_icon')
        buttonOptions['geom_scale'] = 0.095
        self.mapButton = GuiButton(parent=self.buttonsParent,
                                   hotkeys=['m', 'shift-m'],
                                   hotkeyLabel='M',
                                   helpText=PLocalizer.MapButtonHelp,
                                   helpPos=helpPos,
                                   helpDelay=helpDelay,
                                   extraArgs=['guiMgrToggleMap'],
                                   pos=(0.01, 0, buttonPosZ),
                                   **buttonOptions)
        self.buttons['guiMgrToggleMap'] = self.mapButton
        buttonPosZ -= buttonHeight
        self.highlightButton('guiMgrToggleMap')
        buttonOptions['geom'] = (gui.find('**/treasure_chest_closed_over'), )
        buttonOptions['geom_scale'] = 0.12
        self.bagButton = GuiButton(parent=self.buttonsParent,
                                   hotkeys=['i', 'shift-i'],
                                   hotkeyLabel='I',
                                   helpText=PLocalizer.SocialButtonHelp,
                                   helpPos=helpPos,
                                   helpDelay=helpDelay,
                                   extraArgs=['guiMgrToggleInventory'],
                                   pos=(0.01, 0, buttonPosZ),
                                   **buttonOptions)
        self.buttons['guiMgrToggleInventory'] = self.bagButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_weapons')
        buttonOptions['geom_scale'] = 0.18
        self.weaponButton = GuiButton(parent=self.buttonsParent,
                                      hotkeys=['y', 'shift-y'],
                                      hotkeyLabel='Y',
                                      helpText=PLocalizer.WeaponButtonHelp,
                                      helpPos=helpPos,
                                      helpDelay=helpDelay,
                                      extraArgs=['guiMgrToggleWeapons'],
                                      pos=(0.01, 0, buttonPosZ),
                                      **buttonOptions)
        self.buttons['guiMgrToggleWeapons'] = self.weaponButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_skills')
        buttonOptions['geom_scale'] = 0.18
        self.levelButton = GuiButton(parent=self.buttonsParent,
                                     hotkeys=['k', 'shift-k'],
                                     hotkeyLabel='K',
                                     helpText=PLocalizer.SkillButtonHelp,
                                     helpPos=helpPos,
                                     helpDelay=helpDelay,
                                     extraArgs=['guiMgrToggleLevels'],
                                     pos=(0.01, 0, buttonPosZ),
                                     **buttonOptions)
        self.buttons['guiMgrToggleLevels'] = self.levelButton
        buttonPosZ -= buttonHeight
        if self.WantClothingPage:
            buttonOptions['geom'] = gui.find('**/topgui_icon_clothing')
            buttonOptions['geom_scale'] = 0.17
            self.clothingButton = GuiButton(
                parent=self.buttonsParent,
                helpText=PLocalizer.ClothingButtonHelp,
                helpPos=helpPos,
                helpDelay=helpDelay,
                extraArgs=['guiMgrToggleClothing'],
                pos=(0.01, 0, buttonPosZ),
                **buttonOptions)
            self.buttons['guiMgrToggleClothing'] = self.clothingButton
            buttonPosZ -= buttonHeight
        if self.WantTitlesPage:
            buttonOptions['geom'] = gui.find('**/topgui_infamy_frame')
            buttonOptions['geom_scale'] = 0.2
            self.titlesButton = GuiButton(parent=self.buttonsParent,
                                          hotkeys=['b', 'shift-b'],
                                          hotkeyLabel='B',
                                          helpText=PLocalizer.TitlesButtonHelp,
                                          helpPos=helpPos,
                                          helpDelay=helpDelay,
                                          extraArgs=['guiMgrToggleTitles'],
                                          pos=(0.01, 0, buttonPosZ),
                                          **buttonOptions)
            self.buttons['guiMgrToggleTitles'] = self.titlesButton
            buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_ship')
        buttonOptions['geom_scale'] = 0.2
        self.shipsButton = GuiButton(parent=self.buttonsParent,
                                     hotkeys=['h', 'shift-h'],
                                     hotkeyLabel='H',
                                     helpText=PLocalizer.ShipsButtonHelp,
                                     helpPos=helpPos,
                                     helpDelay=helpDelay,
                                     extraArgs=['guiMgrToggleShips'],
                                     pos=(0.01, 0, buttonPosZ),
                                     **buttonOptions)
        self.buttons['guiMgrToggleShips'] = self.shipsButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_journal')
        buttonOptions['geom_scale'] = 0.18
        self.questButton = GuiButton(parent=self.buttonsParent,
                                     hotkeys=['j', 'shift-j'],
                                     hotkeyLabel='J',
                                     helpText=PLocalizer.QuestButtonHelp,
                                     helpPos=helpPos,
                                     helpDelay=helpDelay,
                                     extraArgs=['guiMgrToggleQuest'],
                                     pos=(0.01, 0, buttonPosZ),
                                     **buttonOptions)
        self.buttons['guiMgrToggleQuest'] = self.questButton
        buttonPosZ -= buttonHeight
        self.lookoutButtonNormal = gui.find('**/telescope_button')
        self.lookoutButtonLight = gui.find('**/telescope_button_over')
        self.lookoutButtonSearch3o = gui.find('**/lookout_icon_over_03')
        buttonOptions['geom'] = None
        self.lookoutButton = GuiButton(parent=self.buttonsParent,
                                       hotkeys=['l', 'shift-l'],
                                       hotkeyLabel='L',
                                       helpText=PLocalizer.LookoutButtonHelp,
                                       helpPos=helpPos,
                                       helpDelay=helpDelay,
                                       extraArgs=['guiMgrToggleLookout'],
                                       pos=(0.01, 0, buttonPosZ),
                                       **buttonOptions)
        self.buttons['guiMgrToggleLookout'] = self.lookoutButton
        buttonPosZ -= buttonHeight
        self.lookoutButtonImage = OnscreenImage(
            parent=self.stickyButtonsParent,
            image=self.lookoutButtonLight,
            scale=0.3,
            pos=(0.065, 0.0, 0.215))
        self.lookoutButtonImage.sourceImage = self.lookoutButtonLight
        buttonOptions['geom'] = gui.find('**/topgui_icon_main_menu')
        buttonOptions['geom_scale'] = 0.18
        self.mainMenuButton = GuiButton(
            parent=self.buttonsParent,
            hotkeys=[PiratesGlobals.OptionsHotkey, 'escape'],
            hotkeyLabel='F7',
            helpText=PLocalizer.QuestButtonHelp,
            helpPos=helpPos,
            helpDelay=helpDelay,
            extraArgs=['guiMgrToggleMainMenu'],
            pos=(0.01, 0, buttonPosZ),
            **buttonOptions)
        self.buttons['guiMgrToggleMainMenu'] = self.mainMenuButton
        buttonPosZ -= buttonHeight
        self.chestButtonClosed = (gui.find('**/treasure_chest_closed'),
                                  gui.find('**/treasure_chest_closed'),
                                  gui.find('**/treasure_chest_closed_over'))
        self.chestButtonOpen = gui.find('**/treasure_chest_open_over')
        self.chestButton = GuiButton(command=self.toggle,
                                     parent=self,
                                     relief=None,
                                     image=self.chestButtonClosed,
                                     image_scale=0.15,
                                     image_pos=(0.05, 0, 0.06),
                                     scale=1.2)
        self.chestHotkeyText = DirectLabel(
            parent=self.chestButton,
            relief=None,
            text='Tab',
            text_align=TextNode.ARight,
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_pos=(0.11, 0.0),
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_font=PiratesGlobals.getPirateBoldOutlineFont(),
            textMayChange=1)
        self.buttonsParent.hide()
        self.buttonsParent.setPos(0.2, 0, 0.14)
        self.stickyButtonsParent.hide()
        self.stickyButtonsParent.setPos(0.2, 0, 0.14)
        gui.removeNode()
        return

    def destroy(self):
        self.showButtonsIval.pause()
        del self.showButtonsIval
        self.hideButtonsIval.pause()
        del self.hideButtonsIval
        self.buttonsParent.removeNode()
        del self.buttonsParent
        self.stickyButtonsParent.removeNode()
        del self.stickyButtonsParent
        for button in self.buttons:
            self.buttons[button].destroy()
            self.buttons[button] = None

        del self.buttons
        self.bagButton = None
        self.radarButton = None
        self.lookoutButton = None
        self.mapButton = None
        self.shipsButton = None
        self.titlesButton = None
        self.mainMenuButton = None
        self.socialButton = None
        self.levelButton = None
        self.chestButton = None
        self.questButton = None
        self.weaponButton = None
        loader.unloadSfx(self.openSfx)
        loader.unloadSfx(self.closeSfx)
        del self.openSfx
        del self.closeSfx
        GuiTray.GuiTray.destroy(self)
        return

    def highlightButton(self, button):
        def changeButtonImage(button, image):
            button['image'] = image
            button['image0_color'] = self.buttonColors[0]
            button['image1_color'] = self.buttonColors[1]
            button['image2_color'] = self.buttonColors[2]
            button['image3_color'] = self.buttonColors[3]

        if self.currentButtonIn:
            changeButtonImage(self.buttons[self.currentButtonIn],
                              self.buttonImage)
        self.currentButtonIn = button
        changeButtonImage(self.buttons[self.currentButtonIn],
                          self.buttonImageIn)

    def togglePanel(self, message, args=None):
        if localAvatar.getInventory() == None:
            return
        if message in self.highlightButtons:
            self.highlightButton(message)
        messenger.send(message, [args])
        return

    def toggle(self):
        if not self.isHidden():
            messenger.send(PiratesGlobals.SeaChestHotkey)
            if localAvatar.guiMgr.questPage:
                chestPanel = localAvatar.guiMgr.chestPanel
                if chestPanel.currPageIndex:
                    currPage = chestPanel.pages[chestPanel.currPageIndex]

    def isOpen(self):
        return self.state

    def showButtons(self):
        if self.hideButtonsIval.isPlaying():
            self.hideButtonsIval.finish()
        self.showButtonsIval.start()

    def hideButtons(self):
        if self.showButtonsIval.isPlaying():
            self.showButtonsIval.finish()
        for button in self.buttons:
            self.buttons[button].hideDetails()

        self.hideButtonsIval.start()

    def slideOpen(self):
        if not self.state:
            self.openSfx.play()
        self.state = 1
        self.chestButton['image'] = self.chestButtonOpen
        self.showButtons()
        if localAvatar.guiMgr.questPage:
            chestPanel = localAvatar.guiMgr.chestPanel
            if chestPanel.currPageIndex:
                currPage = chestPanel.pages[chestPanel.currPageIndex]

    def slideClose(self):
        if self.state:
            self.closeSfx.play()
        self.state = 0
        self.chestButton['image'] = self.chestButtonClosed
        self.hideButtons()

    def buildShowHideButtonsIvals(self, includeSticky=True):
        showSequence = Sequence(Func(self.buttonsParent.show))
        showParallel = Parallel(
            LerpPosInterval(self.buttonsParent,
                            0.2,
                            pos=Point3(0, 0, 0.14),
                            startPos=self.buttonsParent.getPos,
                            blendType='easeOut'))
        if includeSticky:
            showSequence.append(Func(self.stickyButtonsParent.show))
            showParallel.append(
                LerpPosInterval(self.stickyButtonsParent,
                                0.2,
                                pos=Point3(0, 0, 0.14),
                                startPos=self.stickyButtonsParent.getPos,
                                blendType='easeOut'))
        showSequence.append(showParallel)
        self.showButtonsIval = showSequence
        hideParallel = Parallel(
            LerpPosInterval(self.buttonsParent,
                            0.2,
                            pos=Point3(0.2, 0, 0.14),
                            startPos=self.buttonsParent.getPos,
                            blendType='easeIn'))
        hideSequence = Sequence(hideParallel, Func(self.buttonsParent.hide))
        if includeSticky:
            hideSequence.append(Func(self.stickyButtonsParent.hide))
            hideParallel.append(
                LerpPosInterval(self.stickyButtonsParent,
                                0.2,
                                pos=Point3(0.2, 0, 0.14),
                                startPos=self.stickyButtonsParent.getPos,
                                blendType='easeIn'))
        hideSequence.append(hideParallel)
        self.hideButtonsIval = hideSequence

    def hideChestButton(self):
        self.chestButton.hide()

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

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

        self.localStatusPanel = self.playerStatusPanels[
            self.LocalAvatarGuiIndex]
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32
        currentMoney = self.table.getPlayerChips()
        x_increment = 0.24
        self.moneyDisplay = DirectLabel(
            parent=self.menu,
            relief=None,
            pos=(-0.3 + x_increment, 0, 0.075),
            geom=goldCoin,
            geom_scale=(scale, scale, scale),
            geom_pos=(0, 0, 0),
            text='%s' % currentMoney,
            text_align=TextNode.ALeft,
            text_scale=0.04,
            text_pos=(0.05, -0.01),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=1,
            scale=1.1)
        self.accept(
            InventoryGlobals.getCategoryQuantChangeMsg(
                localAvatar.getInventoryId(), InventoryType.ItemTypeMoney),
            self.setMoney)
        this = self
        identifier = 0
        this.sfxArray = []
        this.shuffleIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_SHUFFLE)
        ]
        identifier += 1
        this.startDealIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_01)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_02)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_03)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_04)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_05)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_06)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_07)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_08)
        ]
        identifier += 1
        this.totalDealIdentifiers = identifier - this.startDealIdentifier
        this.foldIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FOLD)
        ]
        identifier += 1
        this.flipIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FLIP)
        ]
        identifier += 1
        this.pickupIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_PICKUP)
        ]
        identifier += 1
        this.checkIdentifier = identifier
        check = loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHECK)
        check.setVolume(0.5)
        this.sfxArray = this.sfxArray + [check]
        identifier += 1
        this.betIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_BET)
        ]
        identifier += 1
        this.collectIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_COLLECT)
        ]
        identifier += 1
        this.allInIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_ALL)
        ]
        identifier += 1
        return
Exemplo n.º 40
0
 def __init__(self, parent, parentMgr, **kw):
     GuiTray.GuiTray.__init__(self, parent, 0.6, 0.12, **kw)
     self.initialiseoptions(ChestTray)
     self.setBin('gui-fixed', 0)
     self.state = 0
     self.buttonsParent = self.attachNewNode(
         ModelNode('ChestTray.buttonsParent'), sort=1)
     self.stickyButtonsParent = self.attachNewNode(
         ModelNode('ChestTray.stickyButtonsParent'), sort=1)
     self.stickyButtonsParent.setPos(0, 0, 0.02)
     self.buttons = {}
     self.buildShowHideButtonsIvals()
     self.openSfx = loadSfx(SoundGlobals.SFX_GUI_OPEN_SEACHEST)
     self.openSfx.setVolume(0.4)
     self.closeSfx = loadSfx(SoundGlobals.SFX_GUI_CLOSE_SEACHEST)
     self.closeSfx.setVolume(0.4)
     gui = loader.loadModel('models/gui/toplevel_gui')
     gui_main = loader.loadModel('models/gui/gui_main')
     helpPos = (-0.26, 0, 0.06)
     helpDelay = 0
     self.buttonImage = gui.find('**/topgui_icon_box')
     self.buttonImageIn = gui.find('**/topgui_icon_box_in')
     self.buttonColors = (VBase4(0.7, 0.7, 0.7,
                                 1), VBase4(0.8, 0.8, 0.8,
                                            1), VBase4(1.0, 1.0, 1.0, 1),
                          VBase4(0.6, 0.6, 0.6, 1))
     self.currentButtonIn = None
     self.highlightButtons = [
         'guiMgrToggleMap', 'guiMgrToggleWeapons', 'guiMgrToggleQuest',
         'guiMgrToggleLevels', 'guiMgrToggleShips', 'guiMgrToggleTreasures',
         'guiMgrToggleLookout', 'guiMgrToggleInventory',
         'guiMgrToggleTitles'
     ]
     buttonOptions = {
         'image': self.buttonImage,
         'geom': None,
         'relief': None,
         'frameSize': (0, 0.12, 0, 0.12),
         'image_scale': 0.47,
         'image_pos': (0.06, 0, 0.06),
         'image0_color': self.buttonColors[0],
         'image1_color': self.buttonColors[1],
         'image2_color': self.buttonColors[2],
         'image3_color': self.buttonColors[3],
         'geom_scale': 0.12,
         'geom_pos': (0.06, 0, 0.06),
         'command': self.togglePanel
     }
     extraHeight = 0
     if self.WantTitlesPage:
         extraHeight = 0.12
     buttonOptions['geom'] = gui.find('**/friend_button_over')
     buttonOptions['geom_scale'] = 0.12
     self.socialButton = GuiButton(parent=self.buttonsParent,
                                   hotkeys=['f', 'shift-f'],
                                   hotkeyLabel='F',
                                   helpText=PLocalizer.SocialButtonHelp,
                                   helpPos=helpPos,
                                   helpDelay=helpDelay,
                                   extraArgs=['guiMgrToggleSocial'],
                                   pos=(0.01, 0, 1.16 + extraHeight),
                                   **buttonOptions)
     self.buttons['guiMgrToggleSocial'] = self.socialButton
     buttonOptions['geom'] = gui.find('**/compass_small_button_open_over')
     buttonOptions['geom_scale'] = 0.09
     self.radarButton = GuiButton(parent=self.buttonsParent,
                                  hotkeys=['c', 'shift-c'],
                                  hotkeyLabel='C',
                                  helpText=PLocalizer.RadarButtonHelp,
                                  helpPos=helpPos,
                                  helpDelay=helpDelay,
                                  extraArgs=['guiMgrToggleRadar'],
                                  pos=(0.01, 0, 1.04 + extraHeight),
                                  **buttonOptions)
     self.buttons['guiMgrToggleRadar'] = self.radarButton
     buttonPosZ = 0.88
     buttonHeight = 0.12
     if self.WantTitlesPage:
         buttonPosZ += buttonHeight
     buttonOptions['geom'] = gui_main.find('**/world_map_icon')
     buttonOptions['geom_scale'] = 0.095
     self.mapButton = GuiButton(parent=self.buttonsParent,
                                hotkeys=['m', 'shift-m'],
                                hotkeyLabel='M',
                                helpText=PLocalizer.MapButtonHelp,
                                helpPos=helpPos,
                                helpDelay=helpDelay,
                                extraArgs=['guiMgrToggleMap'],
                                pos=(0.01, 0, buttonPosZ),
                                **buttonOptions)
     self.buttons['guiMgrToggleMap'] = self.mapButton
     buttonPosZ -= buttonHeight
     self.highlightButton('guiMgrToggleMap')
     buttonOptions['geom'] = (gui.find('**/treasure_chest_closed_over'), )
     buttonOptions['geom_scale'] = 0.12
     self.bagButton = GuiButton(parent=self.buttonsParent,
                                hotkeys=['i', 'shift-i'],
                                hotkeyLabel='I',
                                helpText=PLocalizer.SocialButtonHelp,
                                helpPos=helpPos,
                                helpDelay=helpDelay,
                                extraArgs=['guiMgrToggleInventory'],
                                pos=(0.01, 0, buttonPosZ),
                                **buttonOptions)
     self.buttons['guiMgrToggleInventory'] = self.bagButton
     buttonPosZ -= buttonHeight
     buttonOptions['geom'] = gui.find('**/topgui_icon_weapons')
     buttonOptions['geom_scale'] = 0.18
     self.weaponButton = GuiButton(parent=self.buttonsParent,
                                   hotkeys=['y', 'shift-y'],
                                   hotkeyLabel='Y',
                                   helpText=PLocalizer.WeaponButtonHelp,
                                   helpPos=helpPos,
                                   helpDelay=helpDelay,
                                   extraArgs=['guiMgrToggleWeapons'],
                                   pos=(0.01, 0, buttonPosZ),
                                   **buttonOptions)
     self.buttons['guiMgrToggleWeapons'] = self.weaponButton
     buttonPosZ -= buttonHeight
     buttonOptions['geom'] = gui.find('**/topgui_icon_skills')
     buttonOptions['geom_scale'] = 0.18
     self.levelButton = GuiButton(parent=self.buttonsParent,
                                  hotkeys=['k', 'shift-k'],
                                  hotkeyLabel='K',
                                  helpText=PLocalizer.SkillButtonHelp,
                                  helpPos=helpPos,
                                  helpDelay=helpDelay,
                                  extraArgs=['guiMgrToggleLevels'],
                                  pos=(0.01, 0, buttonPosZ),
                                  **buttonOptions)
     self.buttons['guiMgrToggleLevels'] = self.levelButton
     buttonPosZ -= buttonHeight
     if self.WantClothingPage:
         buttonOptions['geom'] = gui.find('**/topgui_icon_clothing')
         buttonOptions['geom_scale'] = 0.17
         self.clothingButton = GuiButton(
             parent=self.buttonsParent,
             helpText=PLocalizer.ClothingButtonHelp,
             helpPos=helpPos,
             helpDelay=helpDelay,
             extraArgs=['guiMgrToggleClothing'],
             pos=(0.01, 0, buttonPosZ),
             **buttonOptions)
         self.buttons['guiMgrToggleClothing'] = self.clothingButton
         buttonPosZ -= buttonHeight
     if self.WantTitlesPage:
         buttonOptions['geom'] = gui.find('**/topgui_infamy_frame')
         buttonOptions['geom_scale'] = 0.2
         self.titlesButton = GuiButton(parent=self.buttonsParent,
                                       hotkeys=['b', 'shift-b'],
                                       hotkeyLabel='B',
                                       helpText=PLocalizer.TitlesButtonHelp,
                                       helpPos=helpPos,
                                       helpDelay=helpDelay,
                                       extraArgs=['guiMgrToggleTitles'],
                                       pos=(0.01, 0, buttonPosZ),
                                       **buttonOptions)
         self.buttons['guiMgrToggleTitles'] = self.titlesButton
         buttonPosZ -= buttonHeight
     buttonOptions['geom'] = gui.find('**/topgui_icon_ship')
     buttonOptions['geom_scale'] = 0.2
     self.shipsButton = GuiButton(parent=self.buttonsParent,
                                  hotkeys=['h', 'shift-h'],
                                  hotkeyLabel='H',
                                  helpText=PLocalizer.ShipsButtonHelp,
                                  helpPos=helpPos,
                                  helpDelay=helpDelay,
                                  extraArgs=['guiMgrToggleShips'],
                                  pos=(0.01, 0, buttonPosZ),
                                  **buttonOptions)
     self.buttons['guiMgrToggleShips'] = self.shipsButton
     buttonPosZ -= buttonHeight
     buttonOptions['geom'] = gui.find('**/topgui_icon_journal')
     buttonOptions['geom_scale'] = 0.18
     self.questButton = GuiButton(parent=self.buttonsParent,
                                  hotkeys=['j', 'shift-j'],
                                  hotkeyLabel='J',
                                  helpText=PLocalizer.QuestButtonHelp,
                                  helpPos=helpPos,
                                  helpDelay=helpDelay,
                                  extraArgs=['guiMgrToggleQuest'],
                                  pos=(0.01, 0, buttonPosZ),
                                  **buttonOptions)
     self.buttons['guiMgrToggleQuest'] = self.questButton
     buttonPosZ -= buttonHeight
     self.lookoutButtonNormal = gui.find('**/telescope_button')
     self.lookoutButtonLight = gui.find('**/telescope_button_over')
     self.lookoutButtonSearch3o = gui.find('**/lookout_icon_over_03')
     buttonOptions['geom'] = None
     self.lookoutButton = GuiButton(parent=self.buttonsParent,
                                    hotkeys=['l', 'shift-l'],
                                    hotkeyLabel='L',
                                    helpText=PLocalizer.LookoutButtonHelp,
                                    helpPos=helpPos,
                                    helpDelay=helpDelay,
                                    extraArgs=['guiMgrToggleLookout'],
                                    pos=(0.01, 0, buttonPosZ),
                                    **buttonOptions)
     self.buttons['guiMgrToggleLookout'] = self.lookoutButton
     buttonPosZ -= buttonHeight
     self.lookoutButtonImage = OnscreenImage(
         parent=self.stickyButtonsParent,
         image=self.lookoutButtonLight,
         scale=0.3,
         pos=(0.065, 0.0, 0.215))
     self.lookoutButtonImage.sourceImage = self.lookoutButtonLight
     buttonOptions['geom'] = gui.find('**/topgui_icon_main_menu')
     buttonOptions['geom_scale'] = 0.18
     self.mainMenuButton = GuiButton(
         parent=self.buttonsParent,
         hotkeys=[PiratesGlobals.OptionsHotkey, 'escape'],
         hotkeyLabel='F7',
         helpText=PLocalizer.QuestButtonHelp,
         helpPos=helpPos,
         helpDelay=helpDelay,
         extraArgs=['guiMgrToggleMainMenu'],
         pos=(0.01, 0, buttonPosZ),
         **buttonOptions)
     self.buttons['guiMgrToggleMainMenu'] = self.mainMenuButton
     buttonPosZ -= buttonHeight
     self.chestButtonClosed = (gui.find('**/treasure_chest_closed'),
                               gui.find('**/treasure_chest_closed'),
                               gui.find('**/treasure_chest_closed_over'))
     self.chestButtonOpen = gui.find('**/treasure_chest_open_over')
     self.chestButton = GuiButton(command=self.toggle,
                                  parent=self,
                                  relief=None,
                                  image=self.chestButtonClosed,
                                  image_scale=0.15,
                                  image_pos=(0.05, 0, 0.06),
                                  scale=1.2)
     self.chestHotkeyText = DirectLabel(
         parent=self.chestButton,
         relief=None,
         text='Tab',
         text_align=TextNode.ARight,
         text_scale=PiratesGuiGlobals.TextScaleSmall,
         text_pos=(0.11, 0.0),
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text_font=PiratesGlobals.getPirateBoldOutlineFont(),
         textMayChange=1)
     self.buttonsParent.hide()
     self.buttonsParent.setPos(0.2, 0, 0.14)
     self.stickyButtonsParent.hide()
     self.stickyButtonsParent.setPos(0.2, 0, 0.14)
     gui.removeNode()
     return
Exemplo n.º 41
0
    def __init__(self, table):
        DirectFrame.__init__(self, relief=None)
        self.initialiseoptions(BlackjackTableGUI)
        self.table = table
        self.destroyed = False
        self.maxHandCards = 14
        self.playerStatusPanels = []
        for i in range(self.table.NumSeats + 1):
            statusPanel = BlackjackStatusPanel(self.maxHandCards)
            statusPanel.setName('playerHand-%s' % i)
            pos = self.HandPos[i]
            statusPanel.setPos(pos)
            self.playerStatusPanels.append(statusPanel)

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

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

        self.bidAmount = 2
        default_value = 0.0
        x = 0.0
        y = -0.25
        label = PLocalizer.BlackjackBid
        resolution = 1.0
        self.bidSlider = self.create_slider(bid_update_function, default_value,
                                            x, y, resolution, label, self.menu)
        x = -0.36
        y = 0.1775
        x_increment = 0.24
        text = PLocalizer.PokerCheat1
        button = GuiButton(parent=self.menu,
                           command=self.cardSwapButtonSelection,
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.Cheat1])
        self.cheat1Button = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        text = PLocalizer.PokerCheat2
        button = GuiButton(parent=self.menu,
                           command=self.cardSwapButtonSelection,
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.Cheat2])
        self.cheat2Button = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        self.hideCheatButtons()
        self.disableAllPlayButtons()
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32
        currentMoney = localAvatar.getInventory().getGoldInPocket()
        self.moneyDisplay = DirectLabel(
            parent=self.menu,
            relief=None,
            pos=(-0.3 + x_increment / 2.0, 0, 0.075),
            geom=goldCoin,
            geom_scale=(scale, scale, scale),
            geom_pos=(0, 0, 0),
            text='%s' % currentMoney,
            text_align=TextNode.ALeft,
            text_scale=0.035,
            text_pos=(0.045, -0.01),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=1,
            scale=1.1)
        self.accept(
            InventoryGlobals.getCategoryQuantChangeMsg(
                localAvatar.getInventoryId(), InventoryType.ItemTypeMoney),
            self.setMoney)
        this = self
        identifier = 0
        this.sfxArray = []
        this.hitIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_HIT)
        ]
        identifier = identifier + 1
        self.hands = []
        self.splitCardsArray = []
        self.canSplit = False
        self.canDoubleDown = False
        self.bid = False
        return
Exemplo n.º 42
0
class RepairGameGUI(DirectFrame):
    completeSound = None
    guiDownSound = None
    guiUpSound = None
    shipRepairMusic = None

    def __init__(self, repairGame):
        DirectFrame.__init__(self, parent=base.a2dBackground, relief=None)
        self.repairGame = repairGame
        base.loadingScreen.beginStep('Sound', 1, 10)
        self._initSound()
        base.loadingScreen.endStep('Sound')
        base.loadingScreen.beginStep('GUI', 1, 43)
        self._initGUI()
        base.loadingScreen.endStep('GUI')
        self.accept('clientLogout', self.handleExitGame)
        if base.localAvatar.guiMgr.seaChestActive:
            base.localAvatar.guiMgr.hideSeaChest()

        if base.localAvatar.guiMgr.minimap:
            base.localAvatar.guiMgr.hideMinimap()

        self.accept('seachestOpened', self.handleExitGame)
        self.accept('avatarDetailsOpened', self.handleExitGame)
        self.accept('minimapOpened', self.handleExitGame)
        self.setBin('fixed', 30)
        self.setZ(-0.20000000000000001)
        base.loadingScreen.beginStep('Intervals')
        self._initIntervals()
        base.loadingScreen.endStep('Intervals')

    def _initSound(self):
        if not self.completeSound:
            RepairGameGUI.completeSound = loadSfx(
                SoundGlobals.SFX_MINIGAME_REPAIR_GENERAL_CYCLECOMPLETE)
            RepairGameGUI.guiDownSound = loadSfx(
                SoundGlobals.SFX_MINIGAME_REPAIR_GENERAL_GUIDOWN)
            RepairGameGUI.guiUpSound = loadSfx(
                SoundGlobals.SFX_MINIGAME_REPAIR_GENERAL_GUIUP)
            RepairGameGUI.guiDownSound.setVolume(0.5)
            RepairGameGUI.guiUpSound.setVolume(0.5)
            RepairGameGUI.shipRepairMusic = [
                SoundGlobals.MUSIC_PERFORMERS_02,
                SoundGlobals.MUSIC_PERFORMERS_07,
                SoundGlobals.MUSIC_PERFORMERS_09
            ]

        base.musicMgr.request(random.choice(self.shipRepairMusic),
                              priority=1,
                              volume=0.5)

    def _initGUI(self):
        self.model = loader.loadModel('models/gui/pir_m_gui_srp_main')
        self.repairGamePicker = RepairGamePickerGUI(
            self, self.repairGame, self.model.find('**/group_picker'))
        self.staticElements = GUIFactory.generateStaticElements(
            self.model.getChild(0), self)
        self.textElements = {}
        self.textElements['title'] = DirectLabel(
            text='',
            text_fg=(1.0, 1.0, 1.0, 1.0),
            text_shadow=(0.0, 0.0, 0.0, 1.0),
            scale=(0.087499999999999994, 0.087499999999999994,
                   0.087499999999999994),
            pos=(0.0, 0.0, 0.91000000000000003),
            relief=None,
            textMayChange=1,
            text_font=PiratesGlobals.getPirateFont(),
            parent=self.staticElements['bg'])
        self.textElements['tutorial'] = DirectLabel(
            text='',
            text_fg=(1.0, 1.0, 1.0, 1.0),
            text_shadow=(0.0, 0.0, 0.0, 1.0),
            text_wordwrap=14,
            scale=(0.044999999999999998, 0.044999999999999998,
                   0.044999999999999998),
            pos=(0.0, 0.0, 0.79500000000000004),
            relief=None,
            textMayChange=1,
            text_font=PiratesGlobals.getPirateFont(),
            parent=self.staticElements['bg'])
        self.textElements['level'] = DirectLabel(
            text='',
            text_fg=(1.0, 1.0, 1.0, 1.0),
            scale=(0.052499999999999998, 0.052499999999999998,
                   0.052499999999999998),
            pos=(0.315, 0.0, 0.69999999999999996),
            relief=None,
            textMayChange=1,
            text_align=TextNode.ARight,
            text_font=PiratesGlobals.getPirateFont(),
            parent=self.staticElements['bg'])
        self.textElements['level'].stash()
        self.textElements['idleMessage'] = DirectLabel(
            text='',
            text_fg=(1.0, 1.0, 1.0, 1.0),
            text_shadow=(0.0, 0.0, 0.0, 1.0),
            text_wordwrap=15,
            scale=(0.087499999999999994, 0.087499999999999994,
                   0.087499999999999994),
            pos=(0.0, 0.0, 0.0),
            relief=None,
            textMayChange=1,
            text_font=PiratesGlobals.getPirateFont(),
            parent=self.staticElements['bg'])
        self.textElements['cycleCompleteMessage'] = DirectLabel(
            text='',
            text_fg=(1.0, 1.0, 1.0, 1.0),
            text_shadow=(0.0, 0.0, 0.0, 1.0),
            text_wordwrap=20,
            scale=(0.087499999999999994, 0.087499999999999994,
                   0.087499999999999994),
            pos=(0.0, 0.0, 0.0),
            relief=None,
            textMayChange=1,
            text_font=PiratesGlobals.getPirateFont(),
            parent=self.staticElements['bg'])
        self.closeButton = GuiButton(
            image=(self.model.find('**/esc_button/idle'),
                   self.model.find('**/esc_button/over'),
                   self.model.find('**/esc_button/over'),
                   self.model.find('**/esc_button/idle')),
            image_scale=(0.75, 0.75, 0.75),
            image_pos=(0.074999999999999997, 0, 0.080000000000000002),
            hotkeys=['Escape'],
            hotkeyLabel=PLocalizer.Minigame_Repair_Leave_Game_Text,
            pos=(-0.40000000000000002, 0.0, 0.01),
            parent=base.a2dBottomRight,
            command=self.handleExitGame)
        self.closeButton.setBin('background', -90)
        self.model.removeNode()
        del self.model

    def setPickerOutroStartPos(self):
        self.pickerOutroLerp.setStartPos(self.repairGamePicker.getPos())

    def setBGOutroStartPos(self):
        self.bgOutroLerp.setStartPos(self.staticElements['bg'].getPos())

    def _initIntervals(self):
        self.bgIntroLerp = LerpPosInterval(
            self.staticElements['bg'],
            duration=1.0,
            pos=self.staticElements['bg'].getPos(),
            startPos=(0.0, 0.0, 2.0))
        self.pickerIntroLerp = LerpPosInterval(
            self.repairGamePicker,
            duration=1.0,
            pos=self.repairGamePicker.getPos(),
            startPos=(0.0, 0.0, -1.0))
        self.introSequence = Sequence(
            Func(self.repairGamePicker.setEnabled, False),
            Parallel(Sequence(Wait(0.25), Func(self.guiDownSound.play)),
                     self.bgIntroLerp, self.pickerIntroLerp),
            Func(self.repairGamePicker.setEnabled, True),
            Func(self.repairGame.gameFSM.request, 'Idle'),
            name='RepairGame.introSequence')
        self.pickerOutroLerp = LerpPosInterval(
            self.repairGamePicker,
            duration=1.0,
            startPos=self.repairGamePicker.getPos(),
            pos=(0.0, 0.0, -1.0))
        self.bgOutroLerp = LerpPosInterval(
            self.staticElements['bg'],
            duration=1.0,
            startPos=self.repairGamePicker.getPos(),
            pos=(0.0, 0.0, 2.0))
        self.outroSequence = Sequence(
            Func(self.repairGamePicker.stashTab),
            Func(self.closeButton.stash),
            Parallel(Func(self.guiUpSound.play),
                     Func(self.setPickerOutroStartPos),
                     Func(self.setBGOutroStartPos), self.pickerOutroLerp,
                     self.bgOutroLerp),
            Func(self.repairGame.cleanup),
            name='RepairGame.outroSequence')
        self.cycleCompleteSequence = Sequence(
            Func(self.showCycleCompleteMessage),
            Func(self.repairGamePicker.stashTab),
            Wait(self.getCycleCompleteWaitTime()),
            Func(self.completeSound.play),
            Func(self.hideCycleCompleteMessage),
            LerpPosInterval(self.repairGamePicker,
                            duration=0.5,
                            pos=self.repairGamePicker.getPos() - (0, 0, 1.0)),
            Func(self.repairGame.resetMincroGameProgress),
            LerpPosInterval(self.repairGamePicker,
                            duration=0.5,
                            pos=self.repairGamePicker.getPos()),
            Func(self.repairGame.gameFSM.request, 'Idle'),
            name='RepairGame.cycleCompleteSequence')
        self.shakeSequence = Sequence(name='RepairGameGUI.shakeSequence')

    def handleExitGame(self):
        messenger.send('escape')

    def getCycleCompleteWaitTime(self):
        if self.repairGame.location == ON_LAND:
            return 5.5
        else:
            return 1.5

    def showCycleCompleteMessage(self):
        if self.repairGame.location == ON_LAND:
            tpMgr = TextPropertiesManager.getGlobalPtr()
            tpGold = TextProperties()
            tpGold.setTextColor(0.97999999999999998, 0.76000000000000001, 0, 1)
            tpMgr.setProperties('gold', tpGold)
            completionTime = self.repairGame.getCycleCompleteTime()
            seconds = completionTime % 60
            minutes = int(completionTime / 60.0)
            if minutes == 0:
                time = '\x1gold\x1%i %s\x2' % (
                    seconds, PLocalizer.Minigame_Repair_Seconds)
            elif seconds < 10:
                time = '\x1gold\x1%i:0%i %s\x2' % (
                    minutes, seconds, PLocalizer.Minigame_Repair_Minutes)
            else:
                time = '\x1gold\x1%i:%i %s\x2' % (
                    minutes, seconds, PLocalizer.Minigame_Repair_Minutes)
            goldAmount = self.repairGame.getReward(localAvatar.doId)
            goldBonus = self.repairGame.getGoldBonus()
            if goldBonus:
                reward = PLocalizer.Minigame_Repair_GoldBonus % (
                    str(goldAmount), str(goldBonus))
            else:
                reward = PLocalizer.Minigame_Repair_Gold % str(goldAmount)
            text = PLocalizer.Minigame_Repair_BenchOutro % (time, reward)
            self.textElements['cycleCompleteMessage'].setPos(
                0.0, 0.0, 0.34999999999999998)
        else:
            text = PLocalizer.Minigame_Repair_ShipOutro
            self.textElements['cycleCompleteMessage'].setPos(
                0.0, 0.0, 0.14999999999999999)
        self.textElements['cycleCompleteMessage']['text'] = text
        self.textElements['cycleCompleteMessage'].setText()

    def hideCycleCompleteMessage(self):
        self.textElements['cycleCompleteMessage']['text'] = ''
        self.textElements['cycleCompleteMessage'].setText()

    def showIdleMessage(self):
        if self.repairGame.location == ON_LAND:
            text = PLocalizer.Minigame_Repair_BenchIntro
            self.textElements['idleMessage'].setPos(0.0, 0.0,
                                                    0.34999999999999998)
        else:
            text = PLocalizer.Minigame_Repair_ShipIntro
            self.textElements['idleMessage'].setPos(0.0, 0.0,
                                                    0.17499999999999999)
        self.textElements['idleMessage']['text'] = text
        self.textElements['idleMessage'].setText()

    def hideIdleMessage(self):
        self.textElements['idleMessage']['text'] = ''
        self.textElements['idleMessage'].setText()

    def onShipDamaged(self, wasGrapeshot=False):
        if wasGrapeshot:
            shakeDelta = 0.050000000000000003
            randomX = random.random() * 2 * shakeDelta - shakeDelta
            randomZ = random.random() * 2 * shakeDelta - shakeDelta
            if self.shakeSequence.isPlaying():
                self.shakeSequence.finish()

            self.shakeSequence = Parallel(
                Sequence(
                    LerpColorScaleInterval(
                        self,
                        duration=0.5,
                        colorScale=(1.0, 0.20000000000000001,
                                    0.20000000000000001, 1.0)),
                    LerpColorScaleInterval(
                        self,
                        duration=RepairGlobals.Common.guiShakeCooldownTime /
                        2.0,
                        colorScale=(1.0, 1.0, 1.0, 1.0))),
                Sequence(
                    LerpPosInterval(self,
                                    duration=0.10000000000000001,
                                    pos=self.getPos() -
                                    (randomX, 0.0, randomZ)),
                    LerpPosInterval(self,
                                    duration=0.20000000000000001,
                                    pos=self.getPos() +
                                    (randomX, 0.0, randomZ)),
                    LerpPosInterval(self,
                                    duration=0.10000000000000001,
                                    pos=self.getPos()),
                    Wait(RepairGlobals.Common.guiShakeCooldownTime)),
                name='RepairGameGUI.shakeSequence')
            self.shakeSequence.start()
        else:
            shakeDelta = 0.025000000000000001
            randomX = random.random() * 2 * shakeDelta - shakeDelta
            randomZ = random.random() * 2 * shakeDelta - shakeDelta
            if not self.shakeSequence.isPlaying():
                self.shakeSequence = Sequence(
                    LerpPosInterval(self,
                                    duration=0.10000000000000001,
                                    pos=self.getPos() -
                                    (randomX, 0.0, randomZ)),
                    LerpPosInterval(self,
                                    duration=0.20000000000000001,
                                    pos=self.getPos() +
                                    (randomX, 0.0, randomZ)),
                    LerpPosInterval(self,
                                    duration=0.10000000000000001,
                                    pos=self.getPos()),
                    Wait(RepairGlobals.Common.guiShakeCooldownTime),
                    name='RepairGameGUI.shakeSequence')
                self.shakeSequence.start()

    def setTutorial(self, game, index=None):
        text = PLocalizer.Minigame_Tutorials[game]
        if index is not None:
            text = text[index]

        self.textElements['tutorial']['text'] = text
        self.textElements['tutorial'].setText()

    def clearTutorial(self):
        self.textElements['tutorial']['text'] = ''
        self.textElements['tutorial'].setText()

    def setRepairTitle(self):
        self.setTitle('repair')

    def setTitle(self, game):
        text = (PLocalizer.Minigame_Repair_Names[game], )
        self.textElements['title']['text'] = text
        self.textElements['title'].setText()

    def clearTitle(self):
        self.textElements['title']['text'] = ''
        self.textElements['title'].setText()

    def setDifficulty(self, difficulty):
        self.textElements['level'][
            'text'] = PLocalizer.Minigame_Repair_Level % str(difficulty + 1)
        self.textElements['level'].setText()

    def setReward(self, reward):
        self.currentReward = reward

    def setGames(self, gameList):
        self.repairGamePicker.setGames(gameList)

    def resetGames(self):
        self.repairGamePicker.setEnabled(True)

    def setProgress(self, gameIndex, percent):
        self.repairGamePicker.setProgress(gameIndex, percent)

    def updatePirateNamesPerMincrogame(self, avIds2CurrentGameIndex):
        self.repairGamePicker.updatePirateNamesPerMincrogame(
            avIds2CurrentGameIndex)

    def destroy(self):
        self.ignore('clientLogout')
        self.ignore('seachestOpened')
        self.ignore('avatarDetailsOpened')
        self.ignore('minimapOpened')
        self.introSequence.clearToInitial()
        self.outroSequence.clearToInitial()
        self.cycleCompleteSequence.clearToInitial()
        self.shakeSequence.clearToInitial()
        del self.introSequence
        del self.outroSequence
        del self.cycleCompleteSequence
        del self.shakeSequence
        self.closeButton.destroy()
        self.closeButton.removeNode()
        del self.closeButton
        GUIFactory.destroyDirectGUIDict(self.staticElements)
        del self.staticElements
        self.repairGamePicker.destroy()
        del self.repairGamePicker
        self.removeNode()
Exemplo n.º 43
0
class ModalStackMessage(StackMessage):
    
    def __init__(self, parent = None, **kwargs):
        StackMessage.__init__(self, parent, **None)
        self.initialiseoptions(ModalStackMessage)
        self.doneFunc = None
        self.fadeTime = 0
        self.setupButtons()

    
    def destroy(self, autoDestroy = 1):
        self.doneFunc = None
        if self['buttonStyle'] == OTPDialog.YesNo:
            self.yesButton.destroy()
            self.noButton.destroy()
        elif self['buttonStyle'] == OTPDialog.CancelOnly:
            self.cancelButton.destroy()
        elif self['buttonStyle'] == OTPDialog.TwoChoice:
            self.boardButton.destroy()
            self.cancelButton.destroy()
        
        StackMessage.destroy(self, autoDestroy)

    
    def setupButtons(self):
        if self['buttonStyle'] == OTPDialog.YesNo:
            self.yesButton = GuiButton(parent = self, image_scale = (0.22, 0.22, 0.14999999999999999), pos = (0.27500000000000002, 0, -0.10000000000000001), text = PLocalizer.DialogYes, command = self.handleYes)
            self.noButton = GuiButton(parent = self, image_scale = (0.22, 0.22, 0.14999999999999999), pos = (0.55000000000000004, 0, -0.10000000000000001), text = PLocalizer.DialogNo, command = self.handleNo)
            self.adjustFrameForButtons()
        elif self['buttonStyle'] == OTPDialog.CancelOnly:
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
            self.cancelButton = DirectButton(parent = self, relief = None, image = (lookoutUI.find('**/lookout_close_window'), lookoutUI.find('**/lookout_close_window_down'), lookoutUI.find('**/lookout_close_window_over'), lookoutUI.find('**/lookout_close_window_disabled')), pos = (0.75, 0, -0.050000000000000003), scale = 0.12, command = self.handleCancel)
        elif self['buttonStyle'] == OTPDialog.TwoChoice:
            self.boardButton = GuiButton(parent = self, image_scale = (0.14999999999999999, 0.22, 0.14999999999999999), pos = (0.55000000000000004, 0, -0.10000000000000001), text = PLocalizer.BoardShip, command = self.handleYes)
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
            self.cancelButton = DirectButton(parent = self, relief = None, image = (lookoutUI.find('**/lookout_close_window'), lookoutUI.find('**/lookout_close_window_down'), lookoutUI.find('**/lookout_close_window_over'), lookoutUI.find('**/lookout_close_window_disabled')), pos = (0.75, 0, -0.050000000000000003), scale = 0.12, command = self.handleCancel)
            self['frameSize'] = (self['frameSize'][0], self['frameSize'][1], self['frameSize'][2] + 0.01, self['frameSize'][3])
            self.adjustFrameForButtons()
        

    
    def adjustFrameForButtons(self):
        zOffset = self['frameSize'][2]
        self['frameSize'] = (self['frameSize'][0], self['frameSize'][1], zOffset - 0.059999999999999998, self['frameSize'][3])
        if self['buttonStyle'] == OTPDialog.YesNo:
            self.yesButton.setZ(zOffset)
            self.noButton.setZ(zOffset)
        elif self['buttonStyle'] == OTPDialog.TwoChoice:
            self.boardButton.setZ(zOffset)
        

    
    def _ModalStackMessage__removeIval(self):
        self.ival.pause()
        self.ival = None

    
    def createIval(self, fadeTime, doneFunc = None):
        StackMessage.createIval(self, fadeTime, doneFunc)
        self.fadeTime = fadeTime
        self.doneFunc = doneFunc
        return self.ival

    
    def messageDone(self, quick = False):
        if self.ival:
            self.ival.pause()
        
        if quick:
            fadeTime = 0
        else:
            fadeTime = self.fadeTime
        baseColor = Vec4(1)
        baseTransp = VBase4(baseColor[0], baseColor[1], baseColor[2], 0)
        self.ival = Sequence(LerpColorScaleInterval(self, fadeTime, baseTransp))
        if self.doneFunc:
            self.ival.append(Func(self.doneFunc))
        

    
    def handleNo(self):
        if self['noCallback']:
            self['noCallback']()
        
        self.messageDone()

    
    def handleYes(self):
        if self['yesCallback']:
            self['yesCallback']()
        
        self.messageDone()

    
    def handleCancel(self):
        if self['cancelCallback']:
            self['cancelCallback']()
        
        self.messageDone()
class AmmoSkillButton(SkillButton.SkillButton):
    
    def __init__(self, skillId, slotId, callback, quantity = 0, skillRank = 0, showQuantity = False, showHelp = False, showRing = False, hotkey = None, name = '', showIcon = True, showLock = False, rechargeSkillId = False, assocAmmo = []):
        if skillId in [
            InventoryType.DefenseCannonRoundShot,
            InventoryType.DefenseCannonEmpty]:
            showQuantity = False
        
        if not Freebooter.getPaidStatus(base.localAvatar.doId) and slotId >= CannonDefenseGlobals.FREEBOOTER_MAX_AMMO_SLOTS:
            showLock = True
        
        SkillButton.SkillButton.__init__(self, skillId, callback, quantity, skillRank, showQuantity, showHelp, showRing, hotkey, name, showIcon, showLock, rechargeSkillId, assocAmmo)
        self.toggleFrame['image_scale'] = 0.55000000000000004
        self.toolTipBox = None
        self.slotId = slotId
        self._initButtons()
        self.updateSkillId(skillId)

    
    def _initButtons(self):
        self.sellButtonModel = loader.loadModel('models/gui/pir_m_gui_can_buttonSell')
        self.sellButton = GuiButton(parent = self, image = (self.sellButtonModel.find('**/idle'), self.sellButtonModel.find('**/idle'), self.sellButtonModel.find('**/over')), image_scale = 1, scale = 0.40000000000000002, sortOrder = 100, pos = (0, 0, -0.125), command = self.onSellClick)
        self.sellButton.bind(DGG.ENTER, self.showToolTip)
        self.sellButton.bind(DGG.EXIT, self.hideToolTip)

    
    def updateSkillId(self, skillId):
        SkillButton.SkillButton.updateSkillId(self, skillId)
        if not hasattr(self, 'sellButton'):
            return None
        
        if skillId == InventoryType.DefenseCannonEmpty:
            self.sellButton['state'] = DGG.DISABLED
            self.sellButton.hide()
            if skillId == InventoryType.DefenseCannonEmpty:
                self.setShowIcon(False)
            
        else:
            self.sellButton['state'] = DGG.NORMAL
            self.sellButton.show()
            self.setShowIcon(True)

    
    def createToolTip(self):
        if self.toolTipBox:
            return None
        
        self.label = DirectLabel(parent = None, relief = None, text = PLocalizer.SellButton, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 12)
        height = -self.label.getHeight()
        width = self.label.getWidth()
        toolTipScale = 2.5
        self.toolTipBox = None
        self.toolTipBox = BorderFrame(parent = self.sellButton, frameSize = (-0.01, width, height, 0.050000000000000003), scale = toolTipScale, pos = (-(width * toolTipScale * 0.5), 0, height * toolTipScale * 2.25), state = DGG.DISABLED)
        self.label.reparentTo(self.toolTipBox)

    
    def showToolTip(self, event):
        self.createToolTip()

    
    def hideToolTip(self, event):
        if self.toolTipBox:
            self.toolTipBox.destroy()
            self.toolTipBox = None
        

    
    def onSellClick(self):
        messenger.send('onSellClick', [
            self.skillId])
Exemplo n.º 45
0
class PVPCompletePanel(BorderFrame):
    SUMMARY_PAGE = 1
    DETAILS_PAGE = 2

    def __init__(self, name, pvp):
        self.width = PiratesGuiGlobals.PVPCompletePanelWidth
        self.height = PiratesGuiGlobals.PVPCompletePanelHeight
        BorderFrame.__init__(self,
                             frameSize=(self.width * 0.15, self.width * 0.85,
                                        self.height * 0.82, self.height),
                             modelName='pir_m_gui_frm_subframe',
                             imageColorScale=VBase4(0.75, 0.75, 0.95, 0.75))
        self.secondLayer = BorderFrame(
            parent=self,
            relief=None,
            frameSize=(self.width * 0.15, self.width * 0.85,
                       self.height * 0.82, self.height),
            modelName='pir_m_gui_frm_subframe',
            imageColorScale=VBase4(0.75, 0.75, 0.9, 0.75))
        self.initialiseoptions(PVPCompletePanel)
        self.endButton = GuiButton(parent=self,
                                   text=PLocalizer.PVPExit,
                                   command=pvp.requestPVPLeave,
                                   pos=(1.25, 0, 0.1),
                                   image=GuiButton.redGenericButton,
                                   image_scale=0.6)
        self.endButton.setBin('gui-popup', 0)
        self.name = name
        self.title = DirectLabel(parent=self,
                                 relief=None,
                                 text=name,
                                 text_align=TextNode.ACenter,
                                 text_scale=0.07,
                                 text_fg=PiratesGuiGlobals.TextFG1,
                                 text_shadow=PiratesGuiGlobals.TextShadow,
                                 textMayChange=1,
                                 pos=(1.25, 0, 1.62))
        if pvp.hasTeams():
            team1Score = '0'
            team2Score = '0'
            for stat in pvp.scoreboardHolder.getItemList():
                if stat['Team'] == 1:
                    team1Score = stat['Score']
                elif stat['Team'] == 2:
                    team2Score = stat['Score']

            self.team1ScoreLabel = DirectLabel(
                parent=self,
                relief=None,
                text=PLocalizer.PVPTeamScore % (1, team1Score),
                text_align=TextNode.ACenter,
                text_scale=0.04,
                text_fg=PVPGlobals.getTeamColor(1),
                text_shadow=PiratesGuiGlobals.TextShadow,
                textMayChange=1,
                pos=(1.05, 0, 1.55))
            self.team2ScoreLabel = DirectLabel(
                parent=self,
                relief=None,
                text=PLocalizer.PVPTeamScore % (2, team2Score),
                text_align=TextNode.ACenter,
                text_scale=0.04,
                text_fg=PVPGlobals.getTeamColor(2),
                text_shadow=PiratesGuiGlobals.TextShadow,
                textMayChange=1,
                pos=(1.45, 0, 1.55))
        self.outcome = DirectLabel(parent=self,
                                   relief=None,
                                   text='',
                                   text_align=TextNode.ACenter,
                                   text_scale=0.06,
                                   text_fg=PiratesGuiGlobals.TextFG1,
                                   text_shadow=PiratesGuiGlobals.TextShadow,
                                   textMayChange=1,
                                   pos=(1.25, 0, 1.45))
        if pvp.hasTeams():
            if team1Score > team2Score:
                self.outcome['text_fg'] = PVPGlobals.getTeamColor(1)
            elif team2Score > team1Score:
                self.outcome['text_fg'] = PVPGlobals.getTeamColor(2)
        self.borderTwo = BorderFrame(
            parent=self,
            relief=None,
            frameSize=(self.width * 0.15, self.width * 0.85, 0,
                       self.height * 0.8),
            modelName='pir_m_gui_frm_subframe',
            imageColorScale=VBase4(0.75, 0.75, 0.9, 0.75))
        self.borderTwoSecondLayer = BorderFrame(
            parent=self.borderTwo,
            relief=None,
            frameSize=(self.width * 0.15, self.width * 0.85, 0,
                       self.height * 0.8),
            modelName='pir_m_gui_frm_subframe',
            imageColorScale=VBase4(0.75, 0.75, 0.9, 0.75))
        self.two = ScoreFrame(PiratesGuiGlobals.PVPCompletePageWidth - 1.0,
                              PiratesGuiGlobals.PVPCompletePageHeight,
                              pvp.statsHolder,
                              0,
                              sortOrder=2)
        self.two.reparentTo(self.borderTwo)
        self.two.setPos(0.45, 0, -0.15)
        self.two.setup()
        self.game = pvp
        return

    def setOutcome(self, outcome):
        self.outcome['text'] = outcome

    def destroy(self):
        self.borderTwoSecondLayer.destroy()
        self.borderTwoSecondLayer = None
        self.borderTwo.destroy()
        self.borderTwo = None
        self.two.destroy()
        self.two = None
        self.secondLayer.destroy()
        self.secondLater = None
        self.game = None
        BorderFrame.destroy(self)
        return
Exemplo n.º 46
0
    def __init__(self, name, pvp):
        self.width = PiratesGuiGlobals.PVPCompletePanelWidth
        self.height = PiratesGuiGlobals.PVPCompletePanelHeight
        BorderFrame.__init__(self,
                             frameSize=(self.width * 0.14999999999999999,
                                        self.width * 0.84999999999999998,
                                        self.height * 0.81999999999999995,
                                        self.height),
                             modelName='pir_m_gui_frm_subframe',
                             imageColorScale=VBase4(0.75, 0.75,
                                                    0.94999999999999996, 0.75))
        self.secondLayer = BorderFrame(
            parent=self,
            relief=None,
            frameSize=(self.width * 0.14999999999999999,
                       self.width * 0.84999999999999998,
                       self.height * 0.81999999999999995, self.height),
            modelName='pir_m_gui_frm_subframe',
            imageColorScale=VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
        self.initialiseoptions(PVPCompletePanel)
        self.endButton = GuiButton(parent=self,
                                   text=PLocalizer.PVPExit,
                                   command=pvp.requestPVPLeave,
                                   pos=(1.25, 0, 0.10000000000000001),
                                   image=GuiButton.redGenericButton,
                                   image_scale=0.59999999999999998)
        self.endButton.setBin('gui-popup', 0)
        self.name = name
        self.title = DirectLabel(parent=self,
                                 relief=None,
                                 text=name,
                                 text_align=TextNode.ACenter,
                                 text_scale=0.070000000000000007,
                                 text_fg=PiratesGuiGlobals.TextFG1,
                                 text_shadow=PiratesGuiGlobals.TextShadow,
                                 textMayChange=1,
                                 pos=(1.25, 0, 1.6200000000000001))
        if pvp.hasTeams():
            team1Score = '0'
            team2Score = '0'
            for stat in pvp.scoreboardHolder.getItemList():
                if stat['Team'] == 1:
                    team1Score = stat['Score']
                    continue
                if stat['Team'] == 2:
                    team2Score = stat['Score']
                    continue

            self.team1ScoreLabel = DirectLabel(
                parent=self,
                relief=None,
                text=PLocalizer.PVPTeamScore % (1, team1Score),
                text_align=TextNode.ACenter,
                text_scale=0.040000000000000001,
                text_fg=PVPGlobals.getTeamColor(1),
                text_shadow=PiratesGuiGlobals.TextShadow,
                textMayChange=1,
                pos=(1.05, 0, 1.55))
            self.team2ScoreLabel = DirectLabel(
                parent=self,
                relief=None,
                text=PLocalizer.PVPTeamScore % (2, team2Score),
                text_align=TextNode.ACenter,
                text_scale=0.040000000000000001,
                text_fg=PVPGlobals.getTeamColor(2),
                text_shadow=PiratesGuiGlobals.TextShadow,
                textMayChange=1,
                pos=(1.45, 0, 1.55))

        self.outcome = DirectLabel(parent=self,
                                   relief=None,
                                   text='',
                                   text_align=TextNode.ACenter,
                                   text_scale=0.059999999999999998,
                                   text_fg=PiratesGuiGlobals.TextFG1,
                                   text_shadow=PiratesGuiGlobals.TextShadow,
                                   textMayChange=1,
                                   pos=(1.25, 0, 1.45))
        if pvp.hasTeams():
            if team1Score > team2Score:
                self.outcome['text_fg'] = PVPGlobals.getTeamColor(1)
            elif team2Score > team1Score:
                self.outcome['text_fg'] = PVPGlobals.getTeamColor(2)

        self.borderTwo = BorderFrame(
            parent=self,
            relief=None,
            frameSize=(self.width * 0.14999999999999999,
                       self.width * 0.84999999999999998, 0,
                       self.height * 0.80000000000000004),
            modelName='pir_m_gui_frm_subframe',
            imageColorScale=VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
        self.borderTwoSecondLayer = BorderFrame(
            parent=self.borderTwo,
            relief=None,
            frameSize=(self.width * 0.14999999999999999,
                       self.width * 0.84999999999999998, 0,
                       self.height * 0.80000000000000004),
            modelName='pir_m_gui_frm_subframe',
            imageColorScale=VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
        self.two = ScoreFrame(PiratesGuiGlobals.PVPCompletePageWidth - 1.0,
                              PiratesGuiGlobals.PVPCompletePageHeight,
                              pvp.statsHolder,
                              0,
                              sortOrder=2)
        self.two.reparentTo(self.borderTwo)
        self.two.setPos(0.45000000000000001, 0, -0.14999999999999999)
        self.two.setup()
        self.game = pvp
 def destroy(self):
     GuiButton.destroy(self)
Exemplo n.º 48
0
    def __init__(self, w, h, locationId=LocationIds.PORT_ROYAL_ISLAND):
        GuiPanel.GuiPanel.__init__(self, '', w, h, True)
        self.card = loader.loadModel(
            'models/gui/pir_m_gui_fsh_legendaryScreen')
        self.storyImageCard = loader.loadModel(
            'models/minigames/pir_m_gam_fsh_legendaryGui')
        self.UICompoments = {}
        self.setPos(-1.1499999999999999, 0.0, -0.59999999999999998)
        self['geom'] = self.card.find('**/background')
        self['geom_pos'] = (0.57999999999999996, 0.0, 0.63)
        self['geom_scale'] = (0.94999999999999996, 0.0, 0.84999999999999998)
        self.coinImage = OnscreenImage(parent=self,
                                       image=self.card.find('**/coin'),
                                       scale=0.90000000000000002,
                                       hpr=(0, 0, 0),
                                       pos=(0.84999999999999998, 0,
                                            0.84999999999999998))
        self.titleTextNode = TextNode('legendPanelTitle')
        self.titleTextNode.setText(PLocalizer.LegendSelectionGui['panelTitle'])
        self.titleTextNode.setFont(PiratesGlobals.getPirateFont())
        self.titleTextNode.setTextColor(0.87, 0.81999999999999995,
                                        0.54000000000000004,
                                        0.90000000000000002)
        self.titleTextNodePath = NodePath(self.titleTextNode)
        self.titleTextNodePath.setPos(0.65000000000000002, 0.0, 1.2)
        self.titleTextNodePath.setScale(0.070000000000000007)
        self.titleTextNodePath.reparentTo(self)
        self.introTextNode = TextNode('legendaryIntroTextNode')
        self.introTextNode.setText(
            PLocalizer.LegendSelectionGui['legendIntro'])
        self.introTextNode.setWordwrap(14.0)
        self.introTextNode.setTextColor(0.90000000000000002,
                                        0.80000000000000004,
                                        0.46999999999999997,
                                        0.90000000000000002)
        self.introTextNodePath = NodePath(self.introTextNode)
        self.introTextNodePath.setPos(0.59999999999999998, 0.0, 0.5)
        self.introTextNodePath.setScale(0.042000000000000003)
        self.introTextNodePath.reparentTo(self)
        self.buttonRootNode = NodePath('button_RootNode')
        self.buttonRootNode.reparentTo(self)
        self.buttonRootNode.setPos(-0.080000000000000002, 0.0,
                                   1.1499999999999999)
        self.iconCard = loader.loadModel('models/gui/treasure_gui')
        self.legendSelectionButtons = {}
        btnGeom = (self.card.find('**/fishButton/idle'),
                   self.card.find('**/fishButton/idle'),
                   self.card.find('**/fishButton/over'))
        for i in range(len(FishingGlobals.legendaryFishData)):
            fishName = FishingGlobals.legendaryFishData[i]['name']
            fishId = FishingGlobals.legendaryFishData[i]['id']
            assetsKey = CollectionMap.Assets[fishId]
            pos_x = 0.29999999999999999
            pos_z = 0.0 - i * 0.25
            button = GuiButton(
                parent=self.buttonRootNode,
                text=(fishName, fishName, fishName, fishName),
                text0_fg=(0.42999999999999999, 0.28999999999999998, 0.19, 1.0),
                text1_fg=(0.42999999999999999, 0.28999999999999998, 0.19, 1.0),
                text2_fg=(0.42999999999999999, 0.28999999999999998, 0.19, 1.0),
                text3_fg=(0.42999999999999999, 0.28999999999999998, 0.19, 1.0),
                text_scale=0.035000000000000003,
                text_pos=(0.037999999999999999, -0.0050000000000000001),
                pos=(pos_x, 0, pos_z),
                hpr=(0, 0, 0),
                scale=1.5,
                image=btnGeom,
                image_pos=(0, 0, 0),
                image_scale=0.69999999999999996,
                sortOrder=2,
                command=self.buttonClickHandle,
                extraArgs=[fishId, assetsKey, locationId])
            button.icon = OnscreenImage(parent=button,
                                        image=self.iconCard.find('**/%s*' %
                                                                 assetsKey),
                                        scale=0.34999999999999998,
                                        hpr=(0, 0, 0),
                                        pos=(-0.123, 0, 0.0050000000000000001))

        self.legendPanel = GuiPanel.GuiPanel('', 2.6000000000000001,
                                             1.8999999999999999, True)
        self.legendPanel.setPos(-1.3, 0.0, -0.94999999999999996)
        self.legendPanel.background = OnscreenImage(
            parent=self.legendPanel,
            scale=(2.3999999999999999, 0, 1.8),
            image=self.storyImageCard.find(
                '**/pir_t_gui_fsh_posterBackground'),
            hpr=(0, 0, 0),
            pos=(1.3, 0, 0.94999999999999996))
        self.legendPanel.storyImage = OnscreenImage(
            parent=self.legendPanel,
            scale=1,
            image=self.card.find('**/coin'),
            hpr=(0, 0, 0),
            pos=(1.8, 0, 1))
        self.storyTextNode = TextNode('storyTextNode')
        self.storyTextNode.setText('')
        self.storyTextNode.setWordwrap(19.0)
        self.storyTextNode.setTextColor(0.23000000000000001,
                                        0.089999999999999997,
                                        0.029999999999999999, 1.0)
        self.storyTextNodePath = NodePath(self.storyTextNode)
        self.storyTextNodePath.setPos(0.33000000000000002, 0.0,
                                      1.6699999999999999)
        self.storyTextNodePath.setScale(0.050000000000000003)
        self.storyTextNodePath.reparentTo(self.legendPanel)
        self.callBack = None
        self.legendPanel.hide()
Exemplo n.º 49
0
 def destroy(self):
     GuiButton.destroy(self)
Exemplo n.º 50
0
class ModalStackMessage(StackMessage):
    
    def __init__(self, parent = None, **kwargs):
        StackMessage.__init__(self, parent, **kwargs)
        self.initialiseoptions(ModalStackMessage)
        self.doneFunc = None
        self.fadeTime = 0
        self.setupButtons()

    
    def destroy(self, autoDestroy = 1):
        self.doneFunc = None
        if self['buttonStyle'] == OTPDialog.YesNo:
            self.yesButton.destroy()
            self.noButton.destroy()
        elif self['buttonStyle'] == OTPDialog.CancelOnly:
            self.cancelButton.destroy()
        elif self['buttonStyle'] == OTPDialog.TwoChoice:
            self.boardButton.destroy()
            self.cancelButton.destroy()
        
        StackMessage.destroy(self, autoDestroy)

    
    def setupButtons(self):
        if self['buttonStyle'] == OTPDialog.YesNo:
            self.yesButton = GuiButton(parent = self, image_scale = (0.22, 0.22, 0.14999999999999999), pos = (0.27500000000000002, 0, -0.10000000000000001), text = PLocalizer.DialogYes, command = self.handleYes)
            self.noButton = GuiButton(parent = self, image_scale = (0.22, 0.22, 0.14999999999999999), pos = (0.55000000000000004, 0, -0.10000000000000001), text = PLocalizer.DialogNo, command = self.handleNo)
            self.adjustFrameForButtons()
        elif self['buttonStyle'] == OTPDialog.CancelOnly:
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
            self.cancelButton = DirectButton(parent = self, relief = None, image = (lookoutUI.find('**/lookout_close_window'), lookoutUI.find('**/lookout_close_window_down'), lookoutUI.find('**/lookout_close_window_over'), lookoutUI.find('**/lookout_close_window_disabled')), pos = (0.75, 0, -0.050000000000000003), scale = 0.12, command = self.handleCancel)
        elif self['buttonStyle'] == OTPDialog.TwoChoice:
            self.boardButton = GuiButton(parent = self, image_scale = (0.14999999999999999, 0.22, 0.14999999999999999), pos = (0.55000000000000004, 0, -0.10000000000000001), text = PLocalizer.BoardShip, command = self.handleYes)
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
            self.cancelButton = DirectButton(parent = self, relief = None, image = (lookoutUI.find('**/lookout_close_window'), lookoutUI.find('**/lookout_close_window_down'), lookoutUI.find('**/lookout_close_window_over'), lookoutUI.find('**/lookout_close_window_disabled')), pos = (0.75, 0, -0.050000000000000003), scale = 0.12, command = self.handleCancel)
            self['frameSize'] = (self['frameSize'][0], self['frameSize'][1], self['frameSize'][2] + 0.01, self['frameSize'][3])
            self.adjustFrameForButtons()
        

    
    def adjustFrameForButtons(self):
        zOffset = self['frameSize'][2]
        self['frameSize'] = (self['frameSize'][0], self['frameSize'][1], zOffset - 0.059999999999999998, self['frameSize'][3])
        if self['buttonStyle'] == OTPDialog.YesNo:
            self.yesButton.setZ(zOffset)
            self.noButton.setZ(zOffset)
        elif self['buttonStyle'] == OTPDialog.TwoChoice:
            self.boardButton.setZ(zOffset)
        

    
    def _ModalStackMessage__removeIval(self):
        self.ival.pause()
        self.ival = None

    
    def createIval(self, fadeTime, doneFunc = None):
        StackMessage.createIval(self, fadeTime, doneFunc)
        self.fadeTime = fadeTime
        self.doneFunc = doneFunc
        return self.ival

    
    def messageDone(self, quick = False):
        if self.ival:
            self.ival.pause()
        
        if quick:
            fadeTime = 0
        else:
            fadeTime = self.fadeTime
        baseColor = Vec4(1)
        baseTransp = VBase4(baseColor[0], baseColor[1], baseColor[2], 0)
        self.ival = Sequence(LerpColorScaleInterval(self, fadeTime, baseTransp))
        if self.doneFunc:
            self.ival.append(Func(self.doneFunc))
        

    
    def handleNo(self):
        if self['noCallback']:
            self['noCallback']()
        
        self.messageDone()

    
    def handleYes(self):
        if self['yesCallback']:
            self['yesCallback']()
        
        self.messageDone()

    
    def handleCancel(self):
        if self['cancelCallback']:
            self['cancelCallback']()
        
        self.messageDone()
Exemplo n.º 51
0
 def __init__(self, gameObject=None):
     base.loadingScreen.beginStep('LegendaryGameGUI', 4, 20)
     self.gameObject = gameObject
     self.guiImage = loader.loadModel(
         'models/minigames/pir_m_gam_fsh_legendaryGui')
     self.UICompoments = {}
     self.uiBaseNode = NodePath('baseNode')
     self.uiBaseNode.reparentTo(aspect2d)
     self.uiBaseNode.show()
     self.leftBaseNode = NodePath('leftBaseNode')
     self.leftBaseNode.reparentTo(base.a2dLeftCenter)
     self.leftBaseNode.show()
     self.fishActor = None
     self.actorAnim = {}
     self.scaleSize = {
         InventoryType.Collection_Set11_Part1: 0.059999999999999998,
         InventoryType.Collection_Set11_Part2: 0.055,
         InventoryType.Collection_Set11_Part3: 0.12,
         InventoryType.Collection_Set11_Part4: 0.086999999999999994,
         InventoryType.Collection_Set11_Part5: 0.080000000000000002
     }
     self.meterFrame = DirectFrame(
         parent=self.leftBaseNode,
         frameSize=(-0.29999999999999999, 0.29999999999999999, -1.0, 0.0),
         frameColor=(1.0, 1.0, 1.0, 0.0),
         relief=None,
         state=DGG.DISABLED,
         pos=(1.0, 0.0, -0.45000000000000001),
         hpr=(0, 0, 0),
         scale=(1.3, 0.0, 1.3),
         image=self.guiImage.find('**/pir_t_gui_fsh_meter'),
         image_scale=(0.20000000000000001, 0.0, 0.80000000000000004),
         image_pos=(0, 0, 0),
         text='',
         textMayChange=1,
         text_scale=PiratesGuiGlobals.TextScaleTitleLarge,
         text_pos=(-0.55000000000000004, 0.10000000000000001),
         text_shadow=PiratesGuiGlobals.TextShadow)
     self.UICompoments['meterFrame'] = self.meterFrame
     self.fishingRod = DirectFrame(
         parent=self.meterFrame,
         frameSize=(-0.29999999999999999, 0.29999999999999999, -1.0, 0.0),
         relief=None,
         state=DGG.DISABLED,
         pos=FishingGlobals.fishingRodScreenPosition,
         image=self.guiImage.find('**/pir_t_gui_fsh_fullRod'),
         image_scale=(1.0, 0.0, 0.125),
         image_pos=(0.20000000000000001, 0, 0))
     self.fishingRod.setR(FishingGlobals.fishingRodInitSlope)
     self.UICompoments['fishingRod'] = self.fishingRod
     base.loadingScreen.tick()
     self.fishingHandleBaseFrame = DirectFrame(
         parent=self.uiBaseNode,
         frameSize=(-0.29999999999999999, 0.29999999999999999, -1.5, 1.5),
         frameColor=(1.0, 1.0, 1.0, 0.0),
         relief=None,
         state=DGG.DISABLED,
         pos=(0.0, 0.0, 0.0),
         hpr=(0, 0, 0),
         scale=(0.71999999999999997, 0.0, 0.71999999999999997),
         image=self.guiImage.find('**/pir_t_gui_fsh_partialRod'),
         image_scale=(3.7999999999999998, 0.0, 1.8999999999999999),
         image_pos=(0, 0, 0),
         image_hpr=(0.0, 0.0, 0))
     self.fishingHandleBaseFrame.hide()
     self.UICompoments[
         'fishingHandleBaseFrame'] = self.fishingHandleBaseFrame
     self.fishingHandle = DirectFrame(
         parent=self.fishingHandleBaseFrame,
         frameSize=(-0.080000000000000002, 0.080000000000000002,
                    -0.20000000000000001, 0.20000000000000001),
         relief=None,
         state=DGG.DISABLED,
         pos=(-0.10000000000000001, 0.0, -0.050000000000000003),
         hpr=(0, 0, 0),
         image=self.guiImage.find('**/pir_t_gui_fsh_handleArm'),
         image_scale=(1.0, 0.0, 1.0),
         image_pos=(-0.042000000000000003, 0, -0.115),
         image_hpr=(0.0, 0.0, 0))
     self.UICompoments['fishingHandle'] = self.fishingHandle
     self.arrowImage = DirectFrame(
         parent=self.fishingHandleBaseFrame,
         frameSize=(-0.40000000000000002, 0.40000000000000002,
                    -0.40000000000000002, 0.40000000000000002),
         relief=None,
         state=DGG.DISABLED,
         pos=(0.0, 0.0, 0.0),
         hpr=(0, 0, 0),
         scale=(1.2, 0.0, 1.2),
         image=self.guiImage.find('**/pir_t_gui_fsh_arrow'),
         image_scale=(1.0, 0.0, 1.0),
         image_pos=(0.0, 0, 0.0),
         image_hpr=(0.0, 0.0, 0.0))
     self.arrowImage.hide()
     self.UICompoments['arrowImage'] = self.arrowImage
     btnGeom = (self.guiImage.find('**/pir_t_gui_fsh_handle'),
                self.guiImage.find('**/pir_t_gui_fsh_handle'),
                self.guiImage.find('**/pir_t_gui_fsh_handleOn'))
     self.fishingHandleButton = GuiButton(pos=(-0.29999999999999999, 0,
                                               -0.55000000000000004),
                                          hpr=(0, 0, 0),
                                          scale=0.45000000000000001,
                                          image=btnGeom,
                                          image_pos=(0, 0, 0),
                                          image_scale=1.0,
                                          sortOrder=2)
     self.fishingHandleButton.bind(DGG.B1PRESS, self.handleButtonClicked)
     self.fishingHandleButton.reparentTo(self.fishingHandle)
     self.UICompoments['fishingHandleButton'] = self.fishingHandleButton
     self.fishingHandleBaseFrame.setTransparency(TransparencyAttrib.MAlpha)
     self.meterFrame.setTransparency(TransparencyAttrib.MAlpha)
     self.lineOneTransitTextNode = TextNode('lineOneTransitText')
     self.lineOneTransitTextNode.setFont(PiratesGlobals.getPirateFont())
     self.lineOneTransitTextNode.setText('')
     self.lineOneTransitTextNode.setAlign(TextNode.ACenter)
     self.lineOneTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
     self.lineOneTransitTextNodePath = NodePath(self.lineOneTransitTextNode)
     self.lineOneTransitTextNodePath.setPos(0.0, 0.0, -0.80000000000000004)
     self.lineOneTransitTextNodePath.setScale(0.34999999999999998,
                                              0.34999999999999998,
                                              0.34999999999999998)
     self.lineOneTransitTextNodePath.reparentTo(self.uiBaseNode)
     self.lineOneTransitTextNodePath.hide()
     self.UICompoments[
         'lineOneTransitText'] = self.lineOneTransitTextNodePath
     self.lineTwoTransitTextNode = TextNode('lineTwoTransitText')
     self.lineTwoTransitTextNode.setFont(PiratesGlobals.getPirateFont())
     self.lineTwoTransitTextNode.setText('')
     self.lineTwoTransitTextNode.setAlign(TextNode.ACenter)
     self.lineTwoTransitTextNode.setTextColor(1.0, 1.0, 1.0, 0.5)
     self.lineTwoTransitTextNodePath = NodePath(self.lineTwoTransitTextNode)
     self.lineTwoTransitTextNodePath.setPos(-0.40000000000000002, 0.0,
                                            -0.94999999999999996)
     self.lineTwoTransitTextNodePath.setScale(0.12, 0.12, 0.12)
     self.lineTwoTransitTextNodePath.reparentTo(self.uiBaseNode)
     self.lineTwoTransitTextNodePath.hide()
     self.UICompoments[
         'lineTwoTransitText'] = self.lineTwoTransitTextNodePath
     base.loadingScreen.tick()
     self.test_guiImage = loader.loadModel('models/gui/toplevel_gui')
     self.buttonIcon = (
         self.test_guiImage.find('**/treasure_chest_closed'),
         self.test_guiImage.find('**/treasure_chest_closed'),
         self.test_guiImage.find('**/treasure_chest_closed_over'))
     self.winImagePanel = GuiPanel.GuiPanel('', 2.6000000000000001,
                                            1.8999999999999999, True)
     self.winImagePanel.setPos(-1.3, 0.0, -0.94999999999999996)
     self.winImagePanel.reparentTo(self.uiBaseNode)
     self.winImagePanel.background = OnscreenImage(
         parent=self.winImagePanel,
         scale=(2.3999999999999999, 0, 1.8),
         image=self.guiImage.find('**/pir_t_gui_fsh_posterBackground'),
         hpr=(0, 0, 0),
         pos=(1.3, 0, 0.94999999999999996))
     self.winImagePanel.setBin('gui-popup', -4)
     self.winTitleTextNode = TextNode('winTitleTextNode')
     self.winTitleTextNode.setText('Congratulations!')
     self.winTitleTextNode.setAlign(TextNode.ACenter)
     self.winTitleTextNode.setFont(PiratesGlobals.getPirateFont())
     self.winTitleTextNode.setTextColor(0.23000000000000001,
                                        0.089999999999999997,
                                        0.029999999999999999, 1.0)
     self.winTitleTextNodePath = NodePath(self.winTitleTextNode)
     self.winTitleTextNodePath.setPos(1.3500000000000001, 0.0,
                                      1.6699999999999999)
     self.winTitleTextNodePath.setScale(0.17999999999999999)
     self.winTitleTextNodePath.reparentTo(self.winImagePanel)
     self.wholeStoryTextNode = TextNode('storyTextNode')
     self.wholeStoryTextNode.setText('')
     self.wholeStoryTextNode.setWordwrap(19.0)
     self.wholeStoryTextNode.setTextColor(0.23000000000000001,
                                          0.089999999999999997,
                                          0.029999999999999999, 1.0)
     self.wholeStoryTextNodePath = NodePath(self.wholeStoryTextNode)
     self.wholeStoryTextNodePath.setPos(0.33000000000000002, 0.0,
                                        1.6399999999999999)
     self.wholeStoryTextNodePath.setScale(0.050000000000000003)
     self.wholeStoryTextNodePath.reparentTo(self.winImagePanel)
     self.winImagePanel.closeButton[
         'command'] = self.closeDialogGotNextState
     self.winImagePanel.closeButton['extraArgs'] = [
         'winImagePanel', 'FarewellLegendaryFish', False
     ]
     self.UICompoments['winImagePanel'] = self.winImagePanel
     self.winImagePanel.hide()
     self.luiCloseDialogSequence = Sequence()
     self.arrowImageRotationInterval = LerpHprInterval(
         self.arrowImage, 2.2000000000000002,
         self.arrowImage.getHpr() + Point3(0.0, 0.0, 280.0),
         self.arrowImage.getHpr())
     self.luiArrowRotatingSequence = Sequence(
         Func(self.showGui, ['arrowImage']),
         Parallel(Func(self.arrowImageRotationInterval.start),
                  Wait(2.2000000000000002)),
         Func(self.hideGui, ['arrowImage']),
         Func(self.arrowImage.setHpr,
              self.arrowImage.getHpr() + Point3(0.0, 0.0, 5.0)),
         name=self.gameObject.distributedFishingSpot.uniqueName(
             'luiArrowRotatingSequence'))
     self.lineOneColorChange = LerpColorScaleInterval(
         self.lineOneTransitTextNodePath,
         FishingGlobals.legendaryTransitionTextDuration,
         (1.0, 1.0, 1.0, 0.0), (1.0, 1.0, 1.0, 1.0),
         blendType='easeOut')
     self.lineOnePosChange = LerpPosInterval(
         self.lineOneTransitTextNodePath,
         FishingGlobals.legendaryTransitionTextDuration,
         (0.0, 0.0, -0.20000000000000001), (0.0, 0.0, -0.80000000000000004),
         blendType='easeOut')
     self.lineTwoCholorChange = LerpColorScaleInterval(
         self.lineTwoTransitTextNodePath,
         FishingGlobals.legendaryTransitionTextDuration,
         (1.0, 1.0, 1.0, 1.0), (1.0, 1.0, 1.0, 1.0),
         blendType='easeOut')
     self.lineTwoPosChange = LerpPosInterval(
         self.lineTwoTransitTextNodePath,
         FishingGlobals.legendaryTransitionTextDuration,
         (0.0, 0.0, -0.32000000000000001), (0.0, 0.0, -0.94999999999999996),
         blendType='easeOut')
     self.transitionTextMovingSequence = Sequence(
         Func(self.lineOneTransitTextNodePath.show),
         Func(self.lineTwoTransitTextNodePath.show),
         Parallel(self.lineOnePosChange, self.lineTwoPosChange,
                  self.lineOneColorChange, self.lineTwoCholorChange),
         Func(self.lineOneTransitTextNodePath.hide),
         Func(self.lineTwoTransitTextNodePath.hide),
         name=self.gameObject.distributedFishingSpot.uniqueName(
             'transitionTextMovingSequence'))
     self.meterFadeInInterval = Sequence(
         Func(self.meterFrame.show),
         LerpColorScaleInterval(
             self.meterFrame,
             FishingGlobals.legendaryTransitionTextDuration,
             colorScale=(1.0, 1.0, 1.0, 1.0),
             startColorScale=(1.0, 1.0, 1.0, 0.0),
             blendType='easeOut'),
         name='FadeInLegendaryMeter')
     self.meterFadeOutInterval = Sequence(LerpColorScaleInterval(
         self.meterFrame,
         FishingGlobals.legendaryTransitionTextDuration,
         colorScale=(1.0, 1.0, 1.0, 0.0),
         startColorScale=(1.0, 1.0, 1.0, 1.0),
         blendType='easeOut'),
                                          Func(self.meterFrame.hide),
                                          name='FadeOutLegendaryMeter')
     self.rodFadeInInterval = Sequence(
         Func(self.fishingHandleBaseFrame.show),
         LerpColorScaleInterval(
             self.fishingHandleBaseFrame,
             FishingGlobals.legendaryTransitionTextDuration,
             colorScale=(1.0, 1.0, 1.0, 1.0),
             startColorScale=(1.0, 1.0, 1.0, 0.0),
             blendType='easeOut'),
         name='FadeInLegendaryRodInterface')
     self.rodFadeOutInterval = Sequence(
         LerpColorScaleInterval(
             self.fishingHandleBaseFrame,
             FishingGlobals.legendaryTransitionTextDuration,
             colorScale=(1.0, 1.0, 1.0, 0.0),
             startColorScale=(1.0, 1.0, 1.0, 1.0),
             blendType='easeOut'),
         Func(self.fishingHandleBaseFrame.hide),
         name='FadeOutLegendaryRodInterface')
     base.loadingScreen.tick()
     smallScale = self.fishingHandleButton['scale']
     bigScale = self.fishingHandleButton['scale'] * 1.2
     self.buttonGrowUpInterval = LerpScaleInterval(self.fishingHandleButton,
                                                   1.0, bigScale,
                                                   smallScale)
     self.luiFightTransitSequence = Sequence(
         Parallel(Func(self.fishingHandleBaseFrame.show),
                  Func(self.meterFadeOutInterval.start),
                  Func(self.rodFadeInInterval.start),
                  Func(self.buttonGrowUpInterval.start)),
         Wait(1.0),
         Func(self.meterFrame.hide),
         name=self.gameObject.distributedFishingSpot.uniqueName(
             'luiFightTransitSequence'))
     self.luiReelTransitSequence = Sequence(
         Parallel(Func(self.fishingHandleBaseFrame.show),
                  Func(self.meterFadeOutInterval.start),
                  Func(self.rodFadeInInterval.start)),
         Wait(1.0),
         Func(self.meterFrame.hide),
         name=self.gameObject.distributedFishingSpot.uniqueName(
             'luiReelTransitSequence'))
     self.luiStruggleTransitSequence = Sequence(
         Parallel(Func(self.meterFrame.show), Func(self.resetFishingRod),
                  self.meterFadeInInterval, self.rodFadeOutInterval),
         Wait(1.0),
         Func(self.fishingHandleBaseFrame.hide),
         name=self.gameObject.distributedFishingSpot.uniqueName(
             'luiStruggleTransitSequence'))
     self.meterFadeOutInterval.start()
     self.rodFadeOutInterval.start()
     self.hideAllGUI()
     base.loadingScreen.endStep('LegendaryGameGUI')
class RepairGameGUI(DirectFrame):
    completeSound = None
    guiDownSound = None
    guiUpSound = None
    shipRepairMusic = None
    
    def __init__(self, repairGame):
        DirectFrame.__init__(self, parent = base.a2dBackground, relief = None)
        self.repairGame = repairGame
        base.loadingScreen.beginStep('Sound', 1, 10)
        self._initSound()
        base.loadingScreen.endStep('Sound')
        base.loadingScreen.beginStep('GUI', 1, 43)
        self._initGUI()
        base.loadingScreen.endStep('GUI')
        self.accept('clientLogout', self.handleExitGame)
        if base.localAvatar.guiMgr.seaChestActive:
            base.localAvatar.guiMgr.hideSeaChest()
        
        if base.localAvatar.guiMgr.minimap:
            base.localAvatar.guiMgr.hideMinimap()
        
        self.accept('seachestOpened', self.handleExitGame)
        self.accept('avatarDetailsOpened', self.handleExitGame)
        self.accept('minimapOpened', self.handleExitGame)
        self.setBin('fixed', 30)
        self.setZ(-0.20000000000000001)
        base.loadingScreen.beginStep('Intervals')
        self._initIntervals()
        base.loadingScreen.endStep('Intervals')

    
    def _initSound(self):
        if not self.completeSound:
            RepairGameGUI.completeSound = loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_GENERAL_CYCLECOMPLETE)
            RepairGameGUI.guiDownSound = loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_GENERAL_GUIDOWN)
            RepairGameGUI.guiUpSound = loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_GENERAL_GUIUP)
            RepairGameGUI.guiDownSound.setVolume(0.5)
            RepairGameGUI.guiUpSound.setVolume(0.5)
            RepairGameGUI.shipRepairMusic = [
                SoundGlobals.MUSIC_PERFORMERS_02,
                SoundGlobals.MUSIC_PERFORMERS_07,
                SoundGlobals.MUSIC_PERFORMERS_09]
        
        base.musicMgr.request(random.choice(self.shipRepairMusic), priority = 1, volume = 0.5)

    
    def _initGUI(self):
        self.model = loader.loadModel('models/gui/pir_m_gui_srp_main')
        self.repairGamePicker = RepairGamePickerGUI(self, self.repairGame, self.model.find('**/group_picker'))
        self.staticElements = GUIFactory.generateStaticElements(self.model.getChild(0), self)
        self.textElements = { }
        self.textElements['title'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.91000000000000003), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
        self.textElements['tutorial'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 14, scale = (0.044999999999999998, 0.044999999999999998, 0.044999999999999998), pos = (0.0, 0.0, 0.79500000000000004), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
        self.textElements['level'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), scale = (0.052499999999999998, 0.052499999999999998, 0.052499999999999998), pos = (0.315, 0.0, 0.69999999999999996), relief = None, textMayChange = 1, text_align = TextNode.ARight, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
        self.textElements['level'].stash()
        self.textElements['idleMessage'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 15, scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.0), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
        self.textElements['cycleCompleteMessage'] = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_wordwrap = 20, scale = (0.087499999999999994, 0.087499999999999994, 0.087499999999999994), pos = (0.0, 0.0, 0.0), relief = None, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), parent = self.staticElements['bg'])
        self.closeButton = GuiButton(image = (self.model.find('**/esc_button/idle'), self.model.find('**/esc_button/over'), self.model.find('**/esc_button/over'), self.model.find('**/esc_button/idle')), image_scale = (0.75, 0.75, 0.75), image_pos = (0.074999999999999997, 0, 0.080000000000000002), hotkeys = [
            'Escape'], hotkeyLabel = PLocalizer.Minigame_Repair_Leave_Game_Text, pos = (-0.40000000000000002, 0.0, 0.01), parent = base.a2dBottomRight, command = self.handleExitGame)
        self.closeButton.setBin('background', -90)
        self.model.removeNode()
        del self.model

    
    def setPickerOutroStartPos(self):
        self.pickerOutroLerp.setStartPos(self.repairGamePicker.getPos())

    
    def setBGOutroStartPos(self):
        self.bgOutroLerp.setStartPos(self.staticElements['bg'].getPos())

    
    def _initIntervals(self):
        self.bgIntroLerp = LerpPosInterval(self.staticElements['bg'], duration = 1.0, pos = self.staticElements['bg'].getPos(), startPos = (0.0, 0.0, 2.0))
        self.pickerIntroLerp = LerpPosInterval(self.repairGamePicker, duration = 1.0, pos = self.repairGamePicker.getPos(), startPos = (0.0, 0.0, -1.0))
        self.introSequence = Sequence(Func(self.repairGamePicker.setEnabled, False), Parallel(Sequence(Wait(0.25), Func(self.guiDownSound.play)), self.bgIntroLerp, self.pickerIntroLerp), Func(self.repairGamePicker.setEnabled, True), Func(self.repairGame.gameFSM.request, 'Idle'), name = 'RepairGame.introSequence')
        self.pickerOutroLerp = LerpPosInterval(self.repairGamePicker, duration = 1.0, startPos = self.repairGamePicker.getPos(), pos = (0.0, 0.0, -1.0))
        self.bgOutroLerp = LerpPosInterval(self.staticElements['bg'], duration = 1.0, startPos = self.repairGamePicker.getPos(), pos = (0.0, 0.0, 2.0))
        self.outroSequence = Sequence(Func(self.repairGamePicker.stashTab), Func(self.closeButton.stash), Parallel(Func(self.guiUpSound.play), Func(self.setPickerOutroStartPos), Func(self.setBGOutroStartPos), self.pickerOutroLerp, self.bgOutroLerp), Func(self.repairGame.cleanup), name = 'RepairGame.outroSequence')
        self.cycleCompleteSequence = Sequence(Func(self.showCycleCompleteMessage), Func(self.repairGamePicker.stashTab), Wait(self.getCycleCompleteWaitTime()), Func(self.completeSound.play), Func(self.hideCycleCompleteMessage), LerpPosInterval(self.repairGamePicker, duration = 0.5, pos = self.repairGamePicker.getPos() - (0, 0, 1.0)), Func(self.repairGame.resetMincroGameProgress), LerpPosInterval(self.repairGamePicker, duration = 0.5, pos = self.repairGamePicker.getPos()), Func(self.repairGame.gameFSM.request, 'Idle'), name = 'RepairGame.cycleCompleteSequence')
        self.shakeSequence = Sequence(name = 'RepairGameGUI.shakeSequence')

    
    def handleExitGame(self):
        messenger.send('escape')

    
    def getCycleCompleteWaitTime(self):
        if self.repairGame.location == ON_LAND:
            return 5.5
        else:
            return 1.5

    
    def showCycleCompleteMessage(self):
        if self.repairGame.location == ON_LAND:
            tpMgr = TextPropertiesManager.getGlobalPtr()
            tpGold = TextProperties()
            tpGold.setTextColor(0.97999999999999998, 0.76000000000000001, 0, 1)
            tpMgr.setProperties('gold', tpGold)
            completionTime = self.repairGame.getCycleCompleteTime()
            seconds = completionTime % 60
            minutes = int(completionTime / 60.0)
            if minutes == 0:
                time = 'gold %i %s' % (seconds, PLocalizer.Minigame_Repair_Seconds)
            elif seconds < 10:
                time = 'gold %i:0%i %s' % (minutes, seconds, PLocalizer.Minigame_Repair_Minutes)
            else:
                time = 'gold %i:%i %s' % (minutes, seconds, PLocalizer.Minigame_Repair_Minutes)
            goldAmount = self.repairGame.getReward(localAvatar.doId)
            goldBonus = self.repairGame.getGoldBonus()
            if goldBonus:
                reward = PLocalizer.Minigame_Repair_GoldBonus % (str(goldAmount), str(goldBonus))
            else:
                reward = PLocalizer.Minigame_Repair_Gold % str(goldAmount)
            text = PLocalizer.Minigame_Repair_BenchOutro % (time, reward)
            self.textElements['cycleCompleteMessage'].setPos(0.0, 0.0, 0.34999999999999998)
        else:
            text = PLocalizer.Minigame_Repair_ShipOutro
            self.textElements['cycleCompleteMessage'].setPos(0.0, 0.0, 0.14999999999999999)
        self.textElements['cycleCompleteMessage']['text'] = text
        self.textElements['cycleCompleteMessage'].setText()

    
    def hideCycleCompleteMessage(self):
        self.textElements['cycleCompleteMessage']['text'] = ''
        self.textElements['cycleCompleteMessage'].setText()

    
    def showIdleMessage(self):
        if self.repairGame.location == ON_LAND:
            text = PLocalizer.Minigame_Repair_BenchIntro
            self.textElements['idleMessage'].setPos(0.0, 0.0, 0.34999999999999998)
        else:
            text = PLocalizer.Minigame_Repair_ShipIntro
            self.textElements['idleMessage'].setPos(0.0, 0.0, 0.17499999999999999)
        self.textElements['idleMessage']['text'] = text
        self.textElements['idleMessage'].setText()

    
    def hideIdleMessage(self):
        self.textElements['idleMessage']['text'] = ''
        self.textElements['idleMessage'].setText()

    
    def onShipDamaged(self, wasGrapeshot = False):
        if wasGrapeshot:
            shakeDelta = 0.050000000000000003
            randomX = random.random() * 2 * shakeDelta - shakeDelta
            randomZ = random.random() * 2 * shakeDelta - shakeDelta
            if self.shakeSequence.isPlaying():
                self.shakeSequence.finish()
            
            self.shakeSequence = Parallel(Sequence(LerpColorScaleInterval(self, duration = 0.5, colorScale = (1.0, 0.20000000000000001, 0.20000000000000001, 1.0)), LerpColorScaleInterval(self, duration = RepairGlobals.Common.guiShakeCooldownTime / 2.0, colorScale = (1.0, 1.0, 1.0, 1.0))), Sequence(LerpPosInterval(self, duration = 0.10000000000000001, pos = self.getPos() - (randomX, 0.0, randomZ)), LerpPosInterval(self, duration = 0.20000000000000001, pos = self.getPos() + (randomX, 0.0, randomZ)), LerpPosInterval(self, duration = 0.10000000000000001, pos = self.getPos()), Wait(RepairGlobals.Common.guiShakeCooldownTime)), name = 'RepairGameGUI.shakeSequence')
            self.shakeSequence.start()
        else:
            shakeDelta = 0.025000000000000001
            randomX = random.random() * 2 * shakeDelta - shakeDelta
            randomZ = random.random() * 2 * shakeDelta - shakeDelta
            if not self.shakeSequence.isPlaying():
                self.shakeSequence = Sequence(LerpPosInterval(self, duration = 0.10000000000000001, pos = self.getPos() - (randomX, 0.0, randomZ)), LerpPosInterval(self, duration = 0.20000000000000001, pos = self.getPos() + (randomX, 0.0, randomZ)), LerpPosInterval(self, duration = 0.10000000000000001, pos = self.getPos()), Wait(RepairGlobals.Common.guiShakeCooldownTime), name = 'RepairGameGUI.shakeSequence')
                self.shakeSequence.start()
            

    
    def setTutorial(self, game, index = None):
        text = PLocalizer.Minigame_Tutorials[game]
        if index is not None:
            text = text[index]
        
        self.textElements['tutorial']['text'] = text
        self.textElements['tutorial'].setText()

    
    def clearTutorial(self):
        self.textElements['tutorial']['text'] = ''
        self.textElements['tutorial'].setText()

    
    def setRepairTitle(self):
        self.setTitle('repair')

    
    def setTitle(self, game):
        text = (PLocalizer.Minigame_Repair_Names[game],)
        self.textElements['title']['text'] = text
        self.textElements['title'].setText()

    
    def clearTitle(self):
        self.textElements['title']['text'] = ''
        self.textElements['title'].setText()

    
    def setDifficulty(self, difficulty):
        self.textElements['level']['text'] = PLocalizer.Minigame_Repair_Level % str(difficulty + 1)
        self.textElements['level'].setText()

    
    def setReward(self, reward):
        self.currentReward = reward

    
    def setGames(self, gameList):
        self.repairGamePicker.setGames(gameList)

    
    def resetGames(self):
        self.repairGamePicker.setEnabled(True)

    
    def setProgress(self, gameIndex, percent):
        self.repairGamePicker.setProgress(gameIndex, percent)

    
    def updatePirateNamesPerMincrogame(self, avIds2CurrentGameIndex):
        self.repairGamePicker.updatePirateNamesPerMincrogame(avIds2CurrentGameIndex)

    
    def destroy(self):
        self.ignore('clientLogout')
        self.ignore('seachestOpened')
        self.ignore('avatarDetailsOpened')
        self.ignore('minimapOpened')
        self.introSequence.clearToInitial()
        self.outroSequence.clearToInitial()
        self.cycleCompleteSequence.clearToInitial()
        self.shakeSequence.clearToInitial()
        del self.introSequence
        del self.outroSequence
        del self.cycleCompleteSequence
        del self.shakeSequence
        self.closeButton.destroy()
        self.closeButton.removeNode()
        del self.closeButton
        GUIFactory.destroyDirectGUIDict(self.staticElements)
        del self.staticElements
        self.repairGamePicker.destroy()
        del self.repairGamePicker
        self.removeNode()