def _initVisuals(self): RepairMincroGame._initVisuals(self) self.setBin('fixed', 36) self.model = loader.loadModel('models/gui/pir_m_gui_srp_sawing_main') sawModel = self.model.find('**/saw') sawModel.setR(193) sawModel.setPos(0.9, 0.0, -0.165) sawModel.setBin('gui-popup', 0) self.sawButton = RepairSaw(parent=self, clickDownCommand=self.sawAttachedToMouse, clickUpCommand=self.sawRemovedFromMouse, geom=sawModel, text_pos=(0.2, -0.3), text_fg=(1, 0, 0, 1), scale=(0.3, 0.3, 0.3), relief=None, pressEffect=0, frameSize=(-0.05, 1.05, -0.3, 0.05), rolloverSound=None, clickSound=None) self.sawingLine = RepairSawingLine(self, self.config.sawlineLineThickness, self.config.sawlineColor, self.config.sawlineLinespawnDist) self.progressDescriptionLabel = DirectLabel( text=PLocalizer.Minigame_Repair_Sawing_Description, text_fg=(1.0, 1.0, 1.0, 1.0), text_pos=(0.0, 0.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_font=PiratesGlobals.getPirateFont(), text_align=TextNode.ARight, relief=None, scale=(0.08, 0.08, 0.08), pos=(-0.2, 0.0, 0.5), parent=self) self.progressLabel = DirectLabel( text=PLocalizer.Minigame_Repair_Sawing_Thresholds[3], text_fg=(1.0, 1.0, 1.0, 1.0), text_pos=(0.0, 0.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_font=PiratesGlobals.getPirateFont(), text_align=TextNode.ALeft, relief=None, scale=(0.08, 0.08, 0.08), pos=(-0.18, 0.0, 0.5), parent=self) self.boardDestroyedLabel = DirectLabel( text=PLocalizer.Minigame_Repair_Sawing_Board_Destroyed, text_fg=(1.0, 0.0, 0.0, 1.0), text_pos=(0.0, 0.0), text_font=PiratesGlobals.getPirateFont(), text_shadow=(0.0, 0.0, 0.0, 1.0), relief=None, scale=(0.1, 0.1, 0.1), pos=(0.0, 0.0, 0.1), parent=self) self.boardDestroyedLabel.setBin('fixed', 38) self.boardDestroyedLabel.stash() return
def __init__(self): DirectObject.DirectObject.__init__(self) self.event = None self.sfx = None self.text = DirectLabel(parent=render2d, relief=None, text='', text_align=TextNode.ACenter, text_scale=0.055, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, text_font=PiratesGlobals.getPirateFont(), pos=(0, 0, -0.90000000000000002), sortOrder=80) self.confirmButton = DialogButton(parent=base.a2dBottomRight, pos=(-0.14999999999999999, 0, 0.095000000000000001), text=PLocalizer.MakeAPirateNext, text_scale=0.050000000000000003, text_pos=(0.040000000000000001, -0.017999999999999999), text_fg=PiratesGuiGlobals.TextFG2, textMayChange=1, command=self.advancePageNumber, sortOrder=90, buttonStyle=DialogButton.YES) self.EscText = DirectLabel(parent=render2d, relief=None, text='', text_align=TextNode.ALeft, text_scale=0.055, text_fg=PiratesGuiGlobals.TextFG9, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, text_font=PiratesGlobals.getPirateFont(), pos=(-0.92000000000000004, 0, 0.88), sortOrder=80) base.transitions.loadLetterbox() self.text.setScale(aspect2d, 1) self.accept('aspectRatioChanged', self.text.setScale, [aspect2d, 1]) self.text.hide() self.confirmButton.hide() self.EscText.hide() self.fader = None self.subtitleParent = render2d.attachNewNode(PGTop('subtitleParent')) self.subtitleParent.node().setMouseWatcher(base.mouseWatcherNode) self._Subtitler__chatPageNumber = None self._Subtitler__chatPages = None self._Subtitler__chatMessage = None self._Subtitler__chatPages = [] self._Subtitler__optionButtons = [] self.specialButtonImage = None self.clearTextOverride = False
def _initVisuals(self): self.visual = self.attachNewNode('RepairNail.visual') self.nailModel.find('**/nail_collision').setPos(0.0, -35.0, 0.0) self.nailModel.setScale(1.5) self.nailModel.find('**/nail_collision').setCollideMask( NAIL_COLLIDE_MASK) self.nailModel.find('**/nail_collision').setPythonTag('nail', self) self.nailModel.find('**/nail_collision').hide() self.nailModel.reparentTo(self.visual) self.nailModel.find('**/nail_model').setHpr(0.0, 20.0, 0.0) self.nailModel.setDepthTest(True) self.nailModel.setDepthWrite(True) self.shadow = self.nailModel.find('**/shadow') self.shadow.reparentTo(self) self.shadow.setPos(0.0, -0.04, 0.02) self.shadow.setDepthTest(True) self.shadow.setDepthWrite(True) self.shadow.setScale(2.0) self.shadow.setTransparency(1) self.shadow.setSa(0.6) self.resultLabel = DirectLabel( text='', relief=None, text_fg=(1.0, 1.0, 1.0, 1.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_font=PiratesGlobals.getPirateFont(), scale=(0.05, 0.05, 0.05), pos=(0.0, 0.0, -0.09), parent=self) return
def __init__(self, title, doneCallback, siegeTeam=0): ShipSelectionPanel.__init__( self, title, doneCallback, pages=[self.OWN, self.FRIEND, self.CREW, self.GUILD, self.PUBLIC]) self.initialiseoptions(ShipDeployPanel) self._siegeTeam = siegeTeam if localAvatar.style.getTutorial( ) < PiratesGlobals.TUT_GOT_SHIP and localAvatar.getCurrentIsland( ) != QuestConstants.LocationIds.PORT_ROYAL_ISLAND: text = PLocalizer.DinghyNeedFirstShip % PLocalizer.LocationNames[ QuestConstants.LocationIds.PORT_ROYAL_ISLAND] else: text = PLocalizer.DinghyNeedShip self.noShipHint = DirectLabel(parent=self, relief=None, text=text, text_font=PiratesGlobals.getPirateFont(), text_scale=0.08, text_fg=PiratesGuiGlobals.TextFG1, text_wordwrap=10, textMayChange=1, pos=(0.55, 0, 0.8)) return
def __init__(self, panelName, gameTitle, instructions): BorderFrame.__init__(self, parent=base.a2dBottomCenter, frameSize=(-1, 1, 0, 0.3), pos=(0, 0, 0.5), modelName='pir_m_gui_frm_subframe', imageColorScale=VBase4(0.75, 0.75, 0.9, 0.75)) self.initialiseoptions(PVPRulesPanel) self.secondLayer = BorderFrame(parent=self, frameSize=(-1, 1, 0, 0.3), modelName='pir_m_gui_frm_subframe', imageColorScale=VBase4( 0.75, 0.75, 0.9, 0.75)) self.gameTitle = gameTitle self.instructions = instructions self.gameTitleText = DirectLabel( parent=self, relief=None, text=self.gameTitle, text_scale=0.06, text_align=TextNode.ALeft, text_font=PiratesGlobals.getPirateFont(), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), pos=(-0.96, 0, 0.23)) self.instructionsText = DirectLabel(parent=self, relief=None, text=self.instructions, text_scale=0.05, text_align=TextNode.ALeft, text_wordwrap=40, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), pos=(-0.96, 0, 0.14)) return
def begin(self, npc, dialogId): DialogProcess.begin(self, npc, dialogId) self.animationIval = None self.dialogAnimSet = [] self.defaultAnim = None self.dialogBox = loader.loadModel('models/gui/pir_m_gui_frm_questChat') self.dialogBox.reparentTo(aspect2d) self.dialogBox.setScale(25.5) self.dialogBox.setPos(-0.47999999999999998, 0, -0.57999999999999996) self.dialogBox.find('**/pointer_right').hide() self.dialogBox.find('**/pointer_none').hide() self.dialogBox.setBin('gui-fixed', 0) self.nametagLabel = DirectLabel( parent=aspect2d, relief=None, text=localAvatar.getName(), text_font=PiratesGlobals.getPirateFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG8, text_scale=0.055, pos=(-0.59999999999999998, 0, -0.44)) self.nametagLabel.setBin('gui-fixed', 1) dialogStr = self._PlayerDialog__getDialogText() + '\x07' self.dialogAnimSet = self._PlayerDialog__getDialogEmotes() localAvatar.guiMgr.dialogSubtitler.setPageChat(dialogStr) self._PlayerDialog__playAnimation(0) if localAvatar.guiMgr.dialogSubtitler.getNumChatPages() == 1: self._PlayerDialog__handleNextChatPage(0, 0) else: self.accept('nextChatPage', self._PlayerDialog__handleNextChatPage) self.accept('doneChatPage', self.end)
def _initVisuals(self): self.countDownLabel = DirectLabel( text=self.startText, text_fg=(1.0, 1.0, 1.0, 1.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_font=PiratesGlobals.getPirateFont(), scale=(0.16, 0.16, 0.16), pos=(0.0, 0.0, 0.15), parent=self, relief=None, textMayChange=1) self.countDownLabel.setBin('fixed', 37) self.winLabel = DirectLabel( text=PLocalizer.Minigame_Repair_Win, text_fg=(1.0, 1.0, 1.0, 1.0), text_font=PiratesGlobals.getPirateFont(), text_shadow=(0.0, 0.0, 0.0, 1.0), scale=(0.16, 0.16, 0.16), pos=RepairGlobals.Common.youWinPos[self.name], relief=None, parent=self) self.winLabel.setBin('fixed', 37) self.winLabel.stash() self.scoreLabel = DirectLabel( text=PLocalizer.Minigame_Repair_Win, text_fg=(1.0, 1.0, 1.0, 1.0), text_font=PiratesGlobals.getPirateFont(), text_shadow=(0.0, 0.0, 0.0, 1.0), scale=(0.1, 0.1, 0.1), pos=RepairGlobals.Common.scorePos[self.name], relief=None, parent=self) self.scoreLabel.setBin('fixed', 37) self.scoreLabel.stash() self.postWinLabel = DirectLabel( text=PLocalizer.Minigame_Repair_Pick_New_Game, text_fg=(1.0, 1.0, 1.0, 1.0), text_font=PiratesGlobals.getPirateFont(), text_shadow=(0.0, 0.0, 0.0, 1.0), scale=(0.14, 0.14, 0.14), pos=RepairGlobals.Common.youWinPos[self.name], relief=None, textMayChange=1, parent=self.repairGame.gui) self.postWinLabel.setBin('fixed', 37) self.postWinLabel.stash() return
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 _initGUI(self): self.secondsLabel = DirectLabel( text='', text_fg=(1.0, 1.0, 1.0, 1.0), text_font=PiratesGlobals.getPirateFont(), scale=(0.089999999999999997, 0.089999999999999997, 0.089999999999999997), relief=None, textMayChange=1, parent=self)
def _initVisuals(self): RepairMincroGame._initVisuals(self) self.model = loader.loadModel( 'models/gui/pir_m_gui_srp_careening_main') self.board = self.model.find('**/hull') self.board.reparentTo(self) self.board.setScale(1.0) self.board.setPos(-0.12, 0.0, 0.19) self.brush = self.model.find('**/brushCursor') self.brush.reparentTo(aspect2d) self.brush.stash() barnacleGeom = [ self.model.find('**/barnacles/barnacle0'), self.model.find('**/barnacles/barnacle1'), self.model.find('**/barnacles/barnacle2') ] self.barnacles = [] for i in range(self.config.barnacleCountRange[1]): bGeom = barnacleGeom[random.randint(0, 1)].copyTo( NodePath('barnacle%i' % i)) bGeom.setBin('fixed', 36) if random.random() < self.config.mossPercentage: mGeom = barnacleGeom[2].copyTo(NodePath('moss')) mGeom.reparentTo(bGeom) mGeom.setPos(random.uniform(0, self.config.mossPosVariance), 0.0, random.uniform(0, self.config.mossPosVariance)) mGeom.setBin('fixed', 35) b = RepairBarnacle('barnacle%i' % i, bGeom) b.reparentTo(self) self.barnacles.append(b) b.stash() self.scrubPowerMeter = self.model.find('**/scrubMeter') self.scrubMeterBackground = self.model.find('**/scrubMeterBackground') self.scrubMeterBackground.setBin('fixed', 32) self.scrubMeterBar = self.model.find('**/scrubMeterBar') self.scrubMeterBar.setBin('fixed', 33) self.scrubMeterFrame = self.model.find('**/scrubMeterFrame') self.scrubMeterFrame.setBin('fixed', 34) self.scrubPowerMeter.reparentTo(self) self.scrubPowerMeter.setPos(0.68000000000000005, 0.0, 0.20000000000000001) self.scrubPowerMeter.setSz(1.25) self.pushLabel = DirectLabel( text=PLocalizer.Minigame_Repair_Careening_Power, pos=(0.68000000000000005, 0.0, -0.27000000000000002), text_fg=(1.0, 1.0, 1.0, 1.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_font=PiratesGlobals.getPirateFont(), scale=(0.080000000000000002, 0.080000000000000002, 0.080000000000000002), parent=self, relief=None)
def initLureHelpText(self): self.helpTextNode = TextNode('fishBitingIcon') self.helpTextNodePath = NodePath(self.helpTextNode) self.helpTextNodePath.setPos(0.0, 0.0, 0.69999999999999996) self.helpTextNode.setText(' ') self.helpTextNode.setAlign(TextNode.ACenter) self.helpTextNode.setFont(PiratesGlobals.getPirateFont()) self.helpTextNode.setTextColor(1.0, 1.0, 1.0, 1.0) self.helpTextNodePath.reparentTo(self) self.helpTextNodePath.setBillboardPointEye() self.helpTextNodePath.setBin('fishingGame', 10) self.helpTextNodePath.hide()
def initLureHelpText(self): self.helpTextNode = TextNode("fishBitingIcon") self.helpTextNodePath = NodePath(self.helpTextNode) self.helpTextNodePath.setPos(0.0, 0.0, 0.69999999999999996) self.helpTextNode.setText(" ") self.helpTextNode.setAlign(TextNode.ACenter) self.helpTextNode.setFont(PiratesGlobals.getPirateFont()) self.helpTextNode.setTextColor(1.0, 1.0, 1.0, 1.0) self.helpTextNodePath.reparentTo(self) self.helpTextNodePath.setBillboardPointEye() self.helpTextNodePath.setBin("fishingGame", 10) self.helpTextNodePath.hide()
def __init__(self, panelNumber, numOfPanels, **kw): DirectFrame.__init__(self) self.hide() self.panelNumber = panelNumber self.numOfPanels = numOfPanels self.playerLbls = [] self.shipsSunkTotalslbl = [] self.damageTotalslbl = [] self.accuracyTotalslbl = [] self.shotsFiredTotalslbl = [] self.headingfont = PiratesGlobals.getPirateOutlineFont() self.bodyfont = PiratesGlobals.getPirateFont() self.highlightPlayerColor = PiratesGuiGlobals.TextFG4
def __init__(self, panelNumber, numOfPanels, **kw): DirectFrame.__init__(self, **kw) self.hide() self.panelNumber = panelNumber self.numOfPanels = numOfPanels self.playerLbls = [] self.shipsSunkTotalslbl = [] self.damageTotalslbl = [] self.accuracyTotalslbl = [] self.shotsFiredTotalslbl = [] self.headingfont = PiratesGlobals.getPirateOutlineFont() self.bodyfont = PiratesGlobals.getPirateFont() self.highlightPlayerColor = PiratesGuiGlobals.TextFG4
def displayStepChoices(self): DialogDict = DialogDict import pirates.quest.DialogTree self.choiceLabels = [] self.choiceButtons = [] gui = loader.loadModel('models/gui/compass_main') choiceIcon = gui.find('**/icon_sphere') for i in range(len(self.choices)): index = 0 process = DialogDict.get(self.npc.getUniqueId()).get( self.dialogId).get(self.choices[i])[index] while not isinstance(process, PlayerDialog): index += 1 process = DialogDict.get(self.npc.getUniqueId()).get( self.dialogId).get(self.choices[i])[index] while not process.avCanParticipate(localAvatar): index += 1 process = DialogDict.get(self.npc.getUniqueId()).get( self.dialogId).get(self.choices[i])[index] if process.avCanParticipate(localAvatar) and isinstance( process, PlayerDialog): choiceButton = GuiButton.GuiButton( parent=aspect2d, relief=None, text=self._StepChoice__getDialogChoiceText( self.choices[i], index), text_font=PiratesGlobals.getPirateFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_wordwrap=None, text_align=TextNode.ALeft, text_scale=0.055, text0_fg=PiratesGuiGlobals.TextFG2, text1_fg=PiratesGuiGlobals.TextFG8, text2_fg=PiratesGuiGlobals.TextFG8, text3_fg=PiratesGuiGlobals.TextFG9, image=choiceIcon, image_scale=0.29999999999999999, image_pos=(-0.050000000000000003, 0, 0.0070000000000000001), geom=None, pos=(-1.1499999999999999, 0, -0.47999999999999998 - i * 0.074999999999999997), command=self.buttonClicked, extraArgs=[self.choices[i]]) choiceButton.setBin('gui-fixed', 1) choiceButton.bind(DGG.ENTER, self.highlightIcon, extraArgs=[i]) choiceButton.bind(DGG.EXIT, self.unhighlightIcon, extraArgs=[i]) self.choiceButtons.append(choiceButton) continue
def load(self, parent=None): self.frame = BorderFrame(parent=parent, frameSize=(-0.55000000000000004, 0.55000000000000004, -0.125, 0.125), pos=(0, 0, -0.14999999999999999)) self.panelTitleText = DirectLabel( parent=self.frame, relief=None, text=self.panelTitle, text_scale=0.070000000000000007, text_align=TextNode.ACenter, text_font=PiratesGlobals.getPirateFont(), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), pos=(0, 0, 0.025000000000000001)) self.instructionsText = DirectLabel(parent=self.frame, relief=None, text=self.instructions, text_scale=0.050000000000000003, text_align=TextNode.ACenter, text_wordwrap=40, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), pos=(0, 0, -0.029999999999999999)) self.frame.stash() self.openSfx = loadSfx(SoundGlobals.SFX_GUI_SHOW_PANEL) self.showPanelIval = Sequence( Wait(2.0), Func(self.frame.unstash), Func(base.playSfx, self.openSfx), LerpPosInterval(self.frame, 0.5, Point3(0, 0, -0.14999999999999999), startPos=Point3(0, 0, 0.5), blendType='easeOut'), Wait(self.duration), LerpPosInterval(self.frame, 0.5, Point3(0, 0, 0.5), startPos=Point3(0, 0, -0.14999999999999999), blendType='easeOut'), Func(self.frame.stash))
def initializeNametag3d(self): Avatar.initializeNametag3d(self) self.nametag3d.setColorScaleOff(100) self.nametag3d.setLightOff() self.nametag3d.setFogOff() self.nametag3d.setZ(self.scale) self.nametag3d.setH(self.getGeomNode().getH()) self.nametag.setFont(PiratesGlobals.getPirateFont()) return 0 # TODO: fix iconNodePath self.iconNodePath = self.nametag.getNameIcon() if self.iconNodePath.isEmpty(): self.notify.warning('empty iconNodePath in initializeNametag3d') return 0 if not self.nameText: self.nameText = OnscreenText(fg = Vec4(1, 1, 1, 1), bg = Vec4(0, 0, 0, 0), scale = 1.1000000000000001, align = TextNode.ACenter, mayChange = 1, font = PiratesGlobals.getPirateBoldOutlineFont()) self.nameText.reparentTo(self.iconNodePath) self.nameText.setTransparency(TransparencyAttrib.MDual, 2) self.nameText.setColorScaleOff(100) self.nameText.setLightOff() self.nameText.setFogOff() self.nameTag3dInitialized()
def __init__(self, name, nodePath, offset, text, stencilId, scale=0.025000000000000001, *args, **kwargs): Billboard.__init__(self, name, nodePath, *args, **kwargs) self.setBin('fixed', 110) self.scale = scale self.textNode = OnscreenText(text=text, fg=Vec4(0, 0, 0, 1), scale=scale, shadow=Vec4(0, 0, 0, 0), mayChange=True, font=PiratesGlobals.getPirateFont()) self.textNode.detachNode() sNode = self.attachNewNode('stencil') sNode.setY(-offset) self.textNode.instanceTo(sNode) sNode.setDepthTest(False)
from pirates.uberdog.UberDogGlobals import InventoryType from pirates.quest.QuestDetailGUI import QuestDetailBase from pirates.piratesgui import GameGui from pirates.audio import SoundGlobals from pirates.audio.SoundGlobals import loadSfx from pirates.inventory import InventoryUIRewardsContainer from pirates.inventory import ItemGlobals tpMgr = TextPropertiesManager.getGlobalPtr() questRewardComplete = TextProperties() questRewardComplete.setTextColor(0.29999999999999999, 0.69999999999999996, 0.25, 1) questRewardComplete.setGlyphScale(1.2) tpMgr.setProperties('questRewardComplete', questRewardComplete) questRewardTitle = TextProperties() questRewardTitle.setSmallCaps(1) questRewardTitle.setFont(PiratesGlobals.getPirateFont()) questRewardTitle.setTextColor(*PiratesGuiGlobals.TextFG26) questRewardTitle.setShadowColor(*PiratesGuiGlobals.TextFG0) tpMgr.setProperties('questRewardTitle', questRewardTitle) class QuestRewardGUI(QuestDetailBase): def __init__(self, quest, rewards): self.width = 1 self.rewards = rewards QuestDetailBase.__init__(self, parent=base.a2dBottomRight, pos=(0.59999999999999998, 0, 0.52000000000000002), text_fg=PiratesGuiGlobals.TextFG0) self.initialiseoptions(QuestRewardGUI)
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, w = 9.0, h = 6.0, trial = False, lock = True): self.width = w self.height = h self.imageFocus = 0 self.hasEmbedded = hasEmbedded self.trial = trial if not self.trial: self.questIdReporting = 'None_Provided' self._TrialNonPayerPanel__fader = None DirectFrame.__init__(self, relief = DGG.RIDGE, state = DGG.NORMAL, frameColor = Vec4(0.0, 0.0, 0.0, 0.69999999999999996), borderWidth = PiratesGuiGlobals.BorderWidth, frameSize = (0, self.width, 0, self.height), pos = (-4.5, 0, -3.0), sortOrder = 999) self.initialiseoptions(TrialNonPayerPanel) if not self.trial: gui2 = loader.loadModel('models/gui/gui_main').find('**/velvetrope_top') geom = gui2.find('**/background') self.imageOne = DirectFrame(parent = self, relief = None, image = geom, image_scale = (1, 1, 0.94999999999999996), scale = 0.40000000000000002, pos = (4.4500000000000002, 0, 3.1000000000000001)) geom = gui2.find('**/frame') geom.getChild(0).stash() self.imageTwo = DirectFrame(parent = self.imageOne, relief = None, image = geom, scale = 1.0, pos = (0, 0, 0)) self.titleText = DirectLabel(parent = self.imageOne, relief = None, text = PLocalizer.VR_FeaturePopTitle, text_align = TextNode.ACenter, text_scale = 0.20000000000000001, text_fg = PiratesGuiGlobals.TextFG16, text_font = PiratesGlobals.getPirateFont(), text_shadow = PiratesGuiGlobals.TextShadow, pos = (0, 0, 0.20000000000000001)) self.fullText = DirectLabel(parent = self.imageOne, relief = None, text = PLocalizer.VR_FeaturePopLongText, text_align = TextNode.ACenter, text_scale = 0.10000000000000001, text_fg = PiratesGuiGlobals.TextFG16, text_font = PiratesGlobals.getInterfaceFont(), pos = (0, 0, -0.10000000000000001)) upgrade_button = gui2.find('**/upgrade_button') norm_geom = upgrade_button.find('**/normal') over_geom = upgrade_button.find('**/over') down_geom = upgrade_button.find('**/down') self.upgradeButton = DirectButton(parent = self.imageOne, relief = None, geom = (norm_geom, down_geom, over_geom), pos = (0, 0, 0.050000000000000003), scale = 1, command = self.upgradeNow, text = PLocalizer.VR_FirstAddUpgrade, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getInterfaceFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_scale = 0.089999999999999997, text_pos = (0, -0.64000000000000001)) norm_geom.getChild(0).stash() over_geom.getChild(0).stash() down_geom.getChild(0).stash() self.passButton = DirectButton(parent = self.imageOne, relief = None, geom = (norm_geom, down_geom, over_geom), scale = (0.80000000000000004, 1, 0.10000000000000001), text = PLocalizer.VR_FirstAddBasic, text_fg = PiratesGuiGlobals.TextFG15, text_font = PiratesGlobals.getInterfaceFont(), text_scale = (0.125, 0.80000000000000004), text_pos = (0, -0.45000000000000001), pos = (0, 0, -0.75), command = self.dismissNow) basegeom = gui2.find('**/close_button') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.dismissButton = DirectButton(parent = self, relief = None, geom = (norm_geom, down_geom, over_geom), scale = 0.40000000000000002, pos = (4.4500000000000002, 0, 3.1000000000000001), command = self.dismissNow) else: gui2 = loader.loadModel('models/textureCards/basic_unlimited') self.imageOne = DirectFrame(parent = self, relief = None, image = gui2.find('**/but_message_panel_border'), image_scale = (1, 1, 0.94999999999999996), scale = 0.80000000000000004, pos = (4.5, 0, 3.0)) self.imageTwo = DirectFrame(parent = self.imageOne, relief = None, image = gui2.find('**/but_compass'), scale = 1.0, pos = (-0.48999999999999999, 0, 0.22)) self.titleText = DirectLabel(parent = self.imageOne, relief = None, text = PLocalizer.FirstAddTitle, text_align = TextNode.ALeft, text_scale = 0.10000000000000001, text_wordwrap = 10, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getPirateFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_pos = (0, -0.050000000000000003), pos = (-0.26000000000000001, 0, 0.28999999999999998)) self.fullText = DirectLabel(parent = self.imageOne, relief = None, text = PLocalizer.FirstAddDisplay, text_align = TextNode.ALeft, text_scale = 0.059999999999999998, text_wordwrap = 21, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getInterfaceFont(), pos = (-0.65000000000000002, 0, -0.059999999999999998)) norm_geom = gui2.find('**/but_nav') over_geom = gui2.find('**/but_nav_over') down_geom = gui2.find('**/but_nav_down') dsbl_geom = gui2.find('**/but_nav_disabled') self.upgradeButton = DirectButton(parent = self.imageOne, relief = None, geom = (norm_geom, down_geom, over_geom), pos = (0.28000000000000003, 0, -0.37), scale = 0.80000000000000004, command = self.upgradeNow, text = PLocalizer.FirstAddUpgrade, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getInterfaceFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_scale = 0.050000000000000003, text_wordwrap = 9, text_pos = (0, -0.01)) self.dismissButton = DirectButton(parent = self.imageOne, relief = None, geom = (norm_geom, down_geom, over_geom), scale = 0.80000000000000004, text = PLocalizer.FirstAddBasic, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getInterfaceFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_scale = 0.050000000000000003, text_pos = (0, -0.01), pos = (-0.28000000000000003, 0, -0.37), text_wordwrap = 9, command = self.dismissNow) self.setBin('gui-popup', 0)
def _initVisuals(self): RepairMincroGame._initVisuals(self) self.model = loader.loadModel('models/gui/pir_m_gui_srp_pumping_main') self.visual = self.attachNewNode('visual') self.visual.setPos(-0.25, 0.0, 0.074999999999999997) goalTopLoc = self.model.find('**/locator_top') goalTopLoc.reparentTo(self.visual) goalBottomLoc = self.model.find('**/locator_bottom') goalBottomLoc.reparentTo(self.visual) self.goalPositions = (goalBottomLoc.getPos(self), goalTopLoc.getPos(self)) self.greatLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pumping_Great, text_fg = (0.20000000000000001, 0.80000000000000004, 0.29999999999999999, 1.0), text_pos = (0.0, 0.59999999999999998), text_align = TextNode.ACenter, text_font = PiratesGlobals.getPirateFont(), relief = None, text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.46500000000000002, 0.0, 0.0), parent = self) self.failLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pumping_Fail, text_fg = (0.80000000000000004, 0.20000000000000001, 0.29999999999999999, 1.0), text_pos = (0.0, 0.59999999999999998), text_align = TextNode.ARight, text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), relief = None, scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.625, 0.0, 0.0), parent = self) self.shipBackground = self.model.find('**/static_ship_background') self.shipBackground.reparentTo(self.visual) self.waterMeter = self.model.find('**/sprite_waterBottom') self.waterMeter.reparentTo(self.visual) self.waterTop = self.model.find('**/sprite_waterTop') self.waterTop.reparentTo(self.visual) self.waterMeterTopLoc = self.waterMeter.find('**/locator_topOfShipWater') self.pumpBackground = self.model.find('**/pumpBackground') self.pumpBackground.reparentTo(self.visual) self.pumpWaterTop = self.model.find('**/sprite_pumpWaterTop') self.pumpWaterTop.reparentTo(self.visual) self.pumpWaterBottom = self.model.find('**/sprite_pumpWaterBottom') self.pumpWaterBottom.reparentTo(self.visual) self.pumpWaterTopLoc = self.pumpWaterBottom.find('**/locator_topOfPumpWater') self.pumpHandle = self.model.find('**/sprite_handle') self.pumpHandle.reparentTo(self.visual) self.pumpBar = self.model.find('**/static_pump') self.pumpBar.reparentTo(self.visual) self.goalBox = self.model.find('**/sprite_clickField') self.goalBox.reparentTo(self.visual) self.goalBox.setTransparency(1) self.enableGoalBox() self.pumpLine = self.model.find('**/sprite_bar') self.pumpLine.reparentTo(self.visual) self.ghostLine = self.visual.attachNewNode('ghostLine') self.pumpLine.getChild(0).copyTo(self.ghostLine) self.ghostLine.setScale(self.pumpLine.getScale()) self.ghostLine.setColor(1.0, 0.20000000000000001, 0.20000000000000001, 1.0) self.shipForground = self.model.find('**/static_ship_foreground') self.shipForground.reparentTo(self.visual) cm = CardMaker('cardMaker') cm.setFrame(-0.33000000000000002, 0.33000000000000002, 0.0, 1.0) self.goalBox.setZ(self.goalPositions[TOP].getZ()) self.goalBoxStartScale = self.goalBox.getSz() self.enableGoalBox() self.pumpWaterUpLerp = LerpFunc(self.setPumpWater, fromData = -0.10000000000000001, toData = 1.0, duration = 0.5) self.pumpWaterDownLerp = LerpFunc(self.setPumpWater, fromData = 1.0, toData = -0.10000000000000001, duration = 0.5) self.model.removeNode() del self.model
def _initVisuals(self): RepairMincroGame._initVisuals(self) self.model = loader.loadModel('models/gui/pir_m_gui_srp_pumping_main') self.visual = self.attachNewNode('visual') self.visual.setPos(-0.25, 0.0, 0.074999999999999997) goalTopLoc = self.model.find('**/locator_top') goalTopLoc.reparentTo(self.visual) goalBottomLoc = self.model.find('**/locator_bottom') goalBottomLoc.reparentTo(self.visual) self.goalPositions = (goalBottomLoc.getPos(self), goalTopLoc.getPos(self)) self.greatLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pumping_Great, text_fg = (0.20000000000000001, 0.80000000000000004, 0.29999999999999999, 1.0), text_pos = (0.0, 0.59999999999999998), text_align = TextNode.ACenter, text_font = PiratesGlobals.getPirateFont(), relief = None, text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.46500000000000002, 0.0, 0.0), parent = self) self.failLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pumping_Fail, text_fg = (0.80000000000000004, 0.20000000000000001, 0.29999999999999999, 1.0), text_pos = (0.0, 0.59999999999999998), text_align = TextNode.ARight, text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), relief = None, scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.625, 0.0, 0.0), parent = self) self.shipBackground = self.model.find('**/static_ship_background') self.shipBackground.reparentTo(self.visual) self.waterMeter = self.model.find('**/sprite_waterBottom') self.waterMeter.reparentTo(self.visual) self.waterTop = self.model.find('**/sprite_waterTop') self.waterTop.reparentTo(self.visual) self.waterMeterTopLoc = self.waterMeter.find('**/locator_topOfShipWater') self.pumpBackground = self.model.find('**/pumpBackground') self.pumpBackground.reparentTo(self.visual) self.pumpWaterTop = self.model.find('**/sprite_pumpWaterTop') self.pumpWaterTop.reparentTo(self.visual) self.pumpWaterBottom = self.model.find('**/sprite_pumpWaterBottom') self.pumpWaterBottom.reparentTo(self.visual) self.pumpWaterTopLoc = self.pumpWaterBottom.find('**/locator_topOfPumpWater') self.pumpHandle = self.model.find('**/sprite_handle') self.pumpHandle.reparentTo(self.visual) self.pumpBar = self.model.find('**/static_pump') self.pumpBar.reparentTo(self.visual) self.goalBox = self.model.find('**/sprite_clickField') self.goalBox.reparentTo(self.visual) self.goalBox.setTransparency(1) self.enableGoalBox() self.pumpLine = self.model.find('**/sprite_bar') self.pumpLine.reparentTo(self.visual) self.ghostLine = self.visual.attachNewNode('ghostLine') self.pumpLine.getChild(0).copyTo(self.ghostLine) self.ghostLine.setScale(self.pumpLine.getScale()) self.ghostLine.setColor(1.0, 0.20000000000000001, 0.20000000000000001, 1.0) self.shipForground = self.model.find('**/static_ship_foreground') self.shipForground.reparentTo(self.visual) cm = CardMaker('cardMaker') cm.setFrame(-0.33000000000000002, 0.33000000000000002, 0.0, 1.0) self.goalBox.setZ(self.goalPositions[TOP].getZ()) self.goalBoxStartScale = self.goalBox.getSz() self.enableGoalBox() self.pumpWaterUpLerp = LerpFunc(self.setPumpWater, fromData = -0.10000000000000001, toData = 1.0, duration = 0.5) self.pumpWaterDownLerp = LerpFunc(self.setPumpWater, fromData = 1.0, toData = -0.10000000000000001, duration = 0.5) self.model.removeNode() del self.model
def __init__(self, parent): DirectObject.DirectObject.__init__(self) self.debugMode = config.GetInt('loading-screen') == 2 self.parent = parent self.state = False self.currScreenshot = None self.snapshot = None self.snapshotFrame = None self.snapshotFrameBasic = None self.currentTime = 0 self.analyzeMode = False self.loadScale = 1.0 self.unmappedTicks = [] self.stepInfo = {} self.accept(base.win.getWindowEvent(), self.adjustSize) self.accept('tick', self.tick) self.currStage = 'unmapped' self.stagePercent = 0 self.numObjects = 0 self.currPercent = 0.0 self.line = LineSegs() self.line.setColor((0, 0, 0, 1)) self.line.setThickness(1) self.stageLabel = None self.currNum = 0 self.overallPercent = 0 self.lastPercent = 0 self.topLock = aspect2dp.attachNewNode('topShift') self.root = self.topLock.attachNewNode('loadingScreenRoot') self.root.setZ(-1) self.root.stash() self.model = loader.loadModel( 'models/gui/pir_m_gui_gen_loadScreen.bam') self.model.setP(90) self.model.reparentTo(self.root) cm = CardMaker('backdrop') cm.setFrame(-10, 10, -10, 10) if self.debugMode: self.backdrop = self.root.attachNewNode(cm.generate()) self.backdrop.setX(-1.5) self.backdrop.setZ(-1) self.backdrop.setScale(4) self.backdrop.setColor(0.5, 0.5, 0.5, 1) cm = CardMaker('loadingBarBase') cm.setFrame(-0.90000000000000002, 0.90000000000000002, 0.10000000000000001, 0.5) self.loadingBarBacking = self.root.attachNewNode(cm.generate()) self.loadingBarRoot = self.root.attachNewNode('loadingBarRoot') cm.setName('analysisBarBase') cm.setFrame(-0.90000000000000002, 0.90000000000000002, -0.5, -0.10000000000000001) self.analysisBar = self.root.attachNewNode(cm.generate()) self.analysisBarRoot = self.root.attachNewNode('analysisBarRoot') self.analysisBar.hide() self.analysisButtons = [] self.enterToContinue = DirectLabel(parent=self.root, text='Press Shift To Continue', relief=None, text_scale=0.10000000000000001, pos=(0, 0, -0.90000000000000002), text_align=TextNode.ACenter) self.enterToContinue.hide() self.stageLabel = DirectLabel(parent=self.root, text='', relief=None, text_scale=0.10000000000000001, pos=(-1.25, 0, 0.75), text_align=TextNode.ALeft, textMayChange=1) self.tickLabel = DirectLabel(parent=self.root, text='', relief=None, text_scale=0.10000000000000001, pos=(0.75, 0, 0.75), textMayChange=1) self.overallLabel = DirectLabel(parent=self.root, text='', relief=None, text_scale=0.10000000000000001, pos=(0, 0, -0.75), textMayChange=1) else: self.backdrop = loader.loadModel( 'models/gui/pir_m_gui_gen_loadScreen') self.backdrop.reparentTo(self.root) bg = self.backdrop.find('**/expandable_bg') bg.setScale(1000, 1, 1000) bg.flattenStrong() self.backdrop.find('**/loadbar_grey').setColorScale( 0.14999999999999999, 0.14999999999999999, 0.14999999999999999, 0.10000000000000001) self.loadingBar = self.backdrop.find('**/loadbar') self.loadingBar.setColorScale(0.20000000000000001, 0.59999999999999998, 0.5, 1) self.loadingPlank = NodePathCollection() self.loadingPlank.addPath( self.backdrop.find('**/plank_loading_bar')) self.loadingPlank.addPath(self.backdrop.find('**/loadbar')) self.loadingPlank.addPath(self.backdrop.find('**/loadbar_frame')) self.loadingPlank.addPath(self.backdrop.find('**/loadbar_grey')) self.titlePlank = self.backdrop.find('**/plank_title') self.percentLabel = DirectLabel( text='0%', parent=self.root, relief=None, text_font=PiratesGlobals.getPirateFont(), text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text_scale=0.031, pos=(0, 0, -0.44450000000000001), textMayChange=1) self.loadingPlank.addPath(self.percentLabel) self.screenshot = self.backdrop.find('**/screenshot') copyGeom = self.loadingBar.find('**/+GeomNode').node().getGeom(0) format = copyGeom.getVertexData().getFormat() primitive = copyGeom.getPrimitive(0) data = GeomVertexData( self.screenshot.node().getGeom(0).getVertexData()) data.setFormat(format) writer = GeomVertexWriter(data, 'texcoord') writer.setData2f(0, 0) writer.setData2f(1, 0) writer.setData2f(1, 1) writer.setData2f(0, 1) geom = Geom(data) geom.addPrimitive(primitive) self.screenshot.node().removeGeom(0) self.screenshot.node().addGeom(geom) self.titlePlankMiddle = self.backdrop.find( '**/plank_title_middle_box') self.titlePlankLeft = self.backdrop.find('**/plank_title_left') self.titlePlankRight = self.backdrop.find('**/plank_title_right') self.loadingBarColors = [(((i % 10) / 10.0 + 0.5) / 2.0, ((i % 100) / 10 / 10.0 + 0.5) / 2.0, (i / 100 / 10.0 + 0.5) / 2.0, 1) for i in range(1000)] random.shuffle(self.loadingBarColors) self.lastUpdateTime = globalClock.getRealTime() self.locationLabel = DirectLabel( parent=self.root, relief=None, text='', text_font=PiratesGlobals.getPirateOutlineFont(), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, text_scale=PiratesGuiGlobals.TextScaleTitleJumbo * 0.69999999999999996, text_align=TextNode.ACenter, pos=(0.0, 0.0, 0.51500000000000001), textMayChange=1) self.locationText = None self.hintLabel = DirectLabel( parent=self.root, relief=None, text='', text_font=PiratesGlobals.getPirateOutlineFont(), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, text_scale=PiratesGuiGlobals.TextScaleTitleJumbo * 0.5, text_align=TextNode.ACenter, pos=(0.0, 0.0, -0.62), text_wordwrap=30, textMayChange=1) self.hintText = None self.adImage = None self.allowLiveFlatten = ConfigVariableBool('allow-live-flatten') self.title_art = [] self.tempVolume = [] self.adjustSize(base.win) gsg = base.win.getGsg() if gsg: self.root.prepareScene(gsg)
def __init__(self, name, nodePath, offset, text, stencilId, scale = 0.025000000000000001, *args, **kwargs): Billboard.__init__(self, name, nodePath, *args, **kwargs) self.setBin('fixed', 110) self.scale = scale self.textNode = OnscreenText(text = text, fg = Vec4(0, 0, 0, 1), scale = scale, shadow = Vec4(0, 0, 0, 0), mayChange = True, font = PiratesGlobals.getPirateFont()) self.textNode.detachNode() sNode = self.attachNewNode('stencil') sNode.setY(-offset) self.textNode.instanceTo(sNode) sNode.setDepthTest(False)
def _initVisuals(self): RepairMincroGame._initVisuals(self) self.model = loader.loadModel('models/gui/pir_m_gui_srp_careening_main') self.board = self.model.find('**/hull') self.board.reparentTo(self) self.board.setScale(1.0) self.board.setPos(-0.12, 0.0, 0.19) self.brush = self.model.find('**/brushCursor') self.brush.reparentTo(aspect2d) self.brush.stash() barnacleGeom = [ self.model.find('**/barnacles/barnacle0'), self.model.find('**/barnacles/barnacle1'), self.model.find('**/barnacles/barnacle2')] self.barnacles = [] for i in range(self.config.barnacleCountRange[1]): bGeom = barnacleGeom[random.randint(0, 1)].copyTo(NodePath('barnacle%i' % i)) bGeom.setBin('fixed', 36) if random.random() < self.config.mossPercentage: mGeom = barnacleGeom[2].copyTo(NodePath('moss')) mGeom.reparentTo(bGeom) mGeom.setPos(random.uniform(0, self.config.mossPosVariance), 0.0, random.uniform(0, self.config.mossPosVariance)) mGeom.setBin('fixed', 35) b = RepairBarnacle('barnacle%i' % i, bGeom) b.reparentTo(self) self.barnacles.append(b) b.stash() self.scrubPowerMeter = self.model.find('**/scrubMeter') self.scrubMeterBackground = self.model.find('**/scrubMeterBackground') self.scrubMeterBackground.setBin('fixed', 32) self.scrubMeterBar = self.model.find('**/scrubMeterBar') self.scrubMeterBar.setBin('fixed', 33) self.scrubMeterFrame = self.model.find('**/scrubMeterFrame') self.scrubMeterFrame.setBin('fixed', 34) self.scrubPowerMeter.reparentTo(self) self.scrubPowerMeter.setPos(0.68000000000000005, 0.0, 0.20000000000000001) self.scrubPowerMeter.setSz(1.25) self.pushLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Careening_Power, pos = (0.68000000000000005, 0.0, -0.27000000000000002), text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateFont(), scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), parent = self, relief = None)
def begin(self, npc, dialogId): DialogProcess.begin(self, npc, dialogId) self.animationIval = None self.dialogAnimSet = [] self.defaultAnim = None self.dialogBox = loader.loadModel('models/gui/pir_m_gui_frm_questChat') self.dialogBox.reparentTo(aspect2d) self.dialogBox.setScale(25.5) self.dialogBox.setPos(-0.47999999999999998, 0, -0.57999999999999996) self.dialogBox.find('**/pointer_right').hide() self.dialogBox.find('**/pointer_none').hide() self.dialogBox.setBin('gui-fixed', 0) self.nametagLabel = DirectLabel(parent = aspect2d, relief = None, text = localAvatar.getName(), text_font = PiratesGlobals.getPirateFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG8, text_scale = 0.055, pos = (-0.59999999999999998, 0, -0.44)) self.nametagLabel.setBin('gui-fixed', 1) dialogStr = self._PlayerDialog__getDialogText() self.dialogAnimSet = self._PlayerDialog__getDialogEmotes() localAvatar.guiMgr.dialogSubtitler.setPageChat(dialogStr) self._PlayerDialog__playAnimation(0) if localAvatar.guiMgr.dialogSubtitler.getNumChatPages() == 1: self._PlayerDialog__handleNextChatPage(0, 0) else: self.accept('nextChatPage', self._PlayerDialog__handleNextChatPage) self.accept('doneChatPage', self.end)
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 _initGUI(self): self.secondsLabel = DirectLabel(text = '', text_fg = (1.0, 1.0, 1.0, 1.0), text_font = PiratesGlobals.getPirateFont(), scale = (0.089999999999999997, 0.089999999999999997, 0.089999999999999997), relief = None, textMayChange = 1, parent = self)
def createGui(self): self.destroyGui() box = loader.loadModel('models/gui/gui_title_box').find( '**/gui_title_box_top') box.setPos(0.54000000000000004, 0, 1.3600000000000001) box.setScale(0.25) box.reparentTo(self) box.flattenStrong() if not self.charGui: self.charGui = loader.loadModel('models/gui/char_gui') self.title = DirectLabel( parent=self, relief=None, text=self.titleText, text_fg=PiratesGuiGlobals.TextFG1, text_font=PiratesGlobals.getPirateFont(), text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_shadow=PiratesGuiGlobals.TextShadow, pos=(self.width * 0.5, 0, 1.343)) self.tabBackParent = self.attachNewNode('tabBackParent') self.tabBackParent.setZ(1.1100000000000001) self.scrollFrame = DirectScrolledFrame( parent=self, relief=None, state=DGG.NORMAL, manageScrollBars=0, autoHideScrollBars=1, frameSize=(0.050000000000000003, self.width - 0.10000000000000001, 0.14000000000000001, self.height - 0.25), canvasSize=(0.050000000000000003, self.width - 0.10000000000000001, 0.14000000000000001, self.height - 0.25), verticalScroll_relief=None, verticalScroll_image=self.charGui.find('**/chargui_slider_small'), verticalScroll_frameSize=(0.0, PiratesGuiGlobals.ScrollbarSize, 0.14199999999999999, self.height - 0.26000000000000001), verticalScroll_image_scale=(self.height - 0.29999999999999999, 1, 0.75), verticalScroll_image_hpr=(0, 0, 90), verticalScroll_image_pos=(self.width - PiratesGuiGlobals.ScrollbarSize * 0.5 - 0.059999999999999998, 0, self.height * 0.46000000000000002), verticalScroll_image_color=(0.60999999999999999, 0.59999999999999998, 0.59999999999999998, 1), verticalScroll_thumb_image=( self.charGui.find('**/chargui_slider_node'), self.charGui.find('**/chargui_slider_node_down'), self.charGui.find('**/chargui_slider_node_over')), verticalScroll_thumb_relief=None, verticalScroll_thumb_image_scale=0.40000000000000002, verticalScroll_thumb_image_pos=(-0.0050000000000000001, 0, 0), verticalScroll_resizeThumb=0, horizontalScroll_relief=None) self.scrollFrame.verticalScroll.incButton.destroy() self.scrollFrame.verticalScroll.decButton.destroy() self.scrollFrame.horizontalScroll.incButton.destroy() self.scrollFrame.horizontalScroll.decButton.destroy() self.scrollFrame.horizontalScroll.hide() self.accept('press-wheel_up-%s' % self.scrollFrame.guiId, self.mouseWheelUp) self.accept('press-wheel_down-%s' % self.scrollFrame.guiId, self.mouseWheelDown) self.tabFrontParent = self.attachNewNode('tabFrontParent') self.tabFrontParent.setZ(1.1100000000000001) frameSize = (self.scrollFrame['frameSize'][0] + 0.01, self.scrollFrame['frameSize'][1] + 0.040000000000000001, self.scrollFrame['frameSize'][2] - 0.01, self.scrollFrame['frameSize'][3]) self.repackScrollFrame() self.border = BorderFrame(parent=self.scrollFrame, state=DGG.DISABLED, modelName='general_frame_f', frameSize=frameSize, borderScale=0.14999999999999999, showBackground=True, bgColorScale=VBase4(0, 0, 0, 1), sortOrder=-1) gui = loader.loadModel('models/gui/toplevel_gui') geomX = gui.find('**/generic_x') self.closeButton = GuiButton.GuiButton( parent=self, pos=(self.width / 2.0, 0, 0.070000000000000007), text=PLocalizer.TableLeave, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.035000000000000003, -0.014), textMayChange=0, geom=(geomX, ) * 4, geom_pos=(-0.059999999999999998, 0, 0), geom_scale=0.5, geom0_color=PiratesGuiGlobals.ButtonColor3[0], geom1_color=PiratesGuiGlobals.ButtonColor3[1], geom2_color=PiratesGuiGlobals.ButtonColor3[2], geom3_color=PiratesGuiGlobals.ButtonColor3[3], image3_color=(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), command=self.closePanel) self.shipBar = ShipTabBar(self.tabBackParent, self.tabFrontParent, parent=self) for t in self.pages: self.addTab(t) self.refreshTabStates()
from pirates.piratesgui import QuestTitleList from pirates.piratesgui.BlackPearlCrew import BlackPearlCrew from pirates.piratesgui import PiratesGuiGlobals from pirates.piratesbase import PiratesGlobals from pirates.uberdog.UberDogGlobals import * from pirates.piratesgui import BorderFrame from pirates.uberdog import DistributedInventoryBase import GuiButton from pirates.quest.QuestDetailGUI import QuestDetailGUI from pirates.piratesgui import PDialog from otp.otpbase import OTPGlobals from otp.otpgui import OTPDialog tpMgr = TextPropertiesManager.getGlobalPtr() questTitleMain = TextProperties() questTitleMain.setSmallCaps(1) questTitleMain.setFont(PiratesGlobals.getPirateFont()) questTitleMain.setTextColor(*PiratesGuiGlobals.TextFG26) questTitleMain.setShadowColor(*PiratesGuiGlobals.TextFG0) questTitleMain.setGlyphScale(1.3) tpMgr.setProperties('questTitleMain', questTitleMain) questTitle = TextProperties() questTitle.setSmallCaps(1) questTitle.setFont(PiratesGlobals.getPirateFont()) questTitle.setTextColor(*PiratesGuiGlobals.TextFG26) questTitle.setShadowColor(*PiratesGuiGlobals.TextFG0) questTitle.setGlyphScale(1.2) tpMgr.setProperties('questTitle', questTitle) questTitle2 = TextProperties() questTitle2.setSmallCaps(1) questTitle2.setFont(PiratesGlobals.getPirateFont()) questTitle2.setTextColor(*PiratesGuiGlobals.TextFG2)
def __init__(self, shipPage, shipId, **kwargs): self.shipPage = shipPage self.setShipId(shipId) self.timer = None self.crewDots = [] self.lBroadsideLimit = 0 self.rBroadsideLimit = 0 kwargs.setdefault('relief', None) kwargs.setdefault('frameSize', (0, self.Width, 0, self.Height)) DirectFrame.__init__(self) self.initialiseoptions(ShipPanel) gui = loader.loadModel('models/gui/toplevel_gui') chestIcon = gui.find('**/icon_crate') cannonIcon = gui.find('**/topgui_icon_ship_cannon_single') broadsideIcon = gui.find('**/topgui_icon_ship_cannon_multiple') self.bottleFrame = ShipFrameBottle(parent = self, shipId = shipId, relief = None, state = DGG.DISABLED, pos = (0.074999999999999997, 0, 0.75), scale = 0.83499999999999996) ornament = loader.loadModel('models/gui/gui_ship_window') ornament.reparentTo(self) ornament.setScale(0.29999999999999999) ornament.setPos(0.54000000000000004, 0, 0.72999999999999998) ornament.flattenStrong() self.nameLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.EmptyBottle, 2), text_fg = PiratesGuiGlobals.TextFG1, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_shadow = (0, 0, 0, 1), text_wordwrap = 30, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), pos = (0.55000000000000004, 0, 1.22)) self.classLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.EmptyBottleDesc, 1), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), text_wordwrap = 30, textMayChange = 1, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.55000000000000004, 0, 1.1799999999999999)) self.timer = PiratesTimer.PiratesTimer(showMinutes = True, mode = None, titleText = '', titleFg = '', infoText = '', cancelText = '', cancelCallback = None) self.timer.setFontColor(PiratesGuiGlobals.TextFG2) self.timer.reparentTo(self) self.timer.setPos(0.45000000000000001, 0, 0.93999999999999995) self.timer.setScale(0.59999999999999998) self.timer.stash() self.hpMeter = DirectWaitBar(parent = self, relief = DGG.RAISED, state = DGG.DISABLED, range = 1, value = 0, frameColor = (0.0, 0.0, 0.0, 0.0), barColor = (0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (0, 0.31, 0, 0.018599999999999998), text = '', text_align = TextNode.ARight, text_scale = 0.029999999999999999, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_pos = (0.29999999999999999, 0.029999999999999999), pos = (0.36099999999999999, 0.0, 0.621), scale = 1.2) hpLabel = DirectLabel(parent = self.hpMeter, relief = None, state = DGG.DISABLED, text = PLocalizer.HP, text_scale = 0.029999999999999999, text_align = TextNode.ALeft, text_pos = (0.014999999999999999, 0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) self.speedMeter = DirectWaitBar(parent = self, relief = DGG.RAISED, state = DGG.DISABLED, range = 1, value = 0, frameColor = (0.0, 0.0, 0.0, 0.0), barColor = (0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (0, 0.31, 0, 0.018599999999999998), text = '', text_align = TextNode.ARight, text_scale = 0.029999999999999999, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_pos = (0.29999999999999999, 0.029999999999999999), pos = (0.36099999999999999, 0.0, 0.55000000000000004), scale = 1.2) speedLabel = DirectLabel(parent = self.speedMeter, relief = None, state = DGG.DISABLED, text = PLocalizer.Speed, text_scale = 0.029999999999999999, text_align = TextNode.ALeft, text_pos = (0.014999999999999999, 0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) textPos = (0.0, -0.16) self.plunderLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = chestIcon, geom_scale = 0.10000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.20000000000000001, 0, 0.31)) plunderLabel = DirectLabel(parent = self.plunderLimit, relief = None, state = DGG.DISABLED, text = PLocalizer.Cargo, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_pos = (0, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) self.cannonLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = cannonIcon, geom_scale = 0.45000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.37, 0, 0.31)) cannonLabel = DirectLabel(parent = self.cannonLimit, relief = None, state = DGG.DISABLED, text = PLocalizer.Cannon, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_pos = (0, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) self.broadsideLeftLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = broadsideIcon, geom_scale = (-0.45000000000000001, 0.45000000000000001, 0.45000000000000001), text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.73999999999999999, 0, 0.31)) self.broadsideRightLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = broadsideIcon, geom_scale = 0.45000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.88500000000000001, 0, 0.31)) broadsideLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.Broadsides, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), pos = (0.81000000000000005, 0, 0.46000000000000002)) crewLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.Crew, text_scale = 0.035999999999999997, text_align = TextNode.ALeft, text_pos = (0.47499999999999998, 0.46000000000000002), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) self.crewLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = (0.56000000000000005, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont()) shipOV = base.cr.getOwnerView(self.shipId) if shipOV: self.setShipName(shipOV.name) self.setShipClass(shipOV.shipClass) self.setShipHp(shipOV.Hp, shipOV.maxHp) self.setShipSp(shipOV.Sp, shipOV.maxSp) self.setShipCrew(shipOV.crew, shipOV.maxCrew) self.setShipCargo([], shipOV.maxCargo) if hasattr(shipOV, 'cannonConfig'): self.setShipMaxCannons(shipOV.cannonConfig) self.setShipMaxLeftBroadside(shipOV.lBroadsideConfig) self.setShipMaxRightBroadside(shipOV.rBroadsideConfig) self.accept('setName-%s' % self.shipId, self.setShipName) self.accept('setShipClass-%s' % self.shipId, self.setShipClass) self.accept('setShipHp-%s' % self.shipId, self.setShipHp) self.accept('setShipSp-%s' % self.shipId, self.setShipSp) self.accept('setShipCargo-%s' % self.shipId, self.setShipCargo) self.accept('setShipCrew-%s' % self.shipId, self.setShipCrew) self.accept('setShipTimer-%s' % self.shipId, self.setShipTimer) self.accept('setHullCannonConfig-%s' % self.shipId, self.setShipMaxCannons) self.accept('setHullLeftBroadsideConfig-%s' % self.shipId, self.setShipMaxLeftBroadside) self.accept('setHullRightBroadsideConfig-%s' % self.shipId, self.setShipMaxRightBroadside) if base.config.GetBool('want-deploy-button', 0): pass 1
from pirates.piratesgui import QuestTitleList from pirates.piratesgui.BlackPearlCrew import BlackPearlCrew from pirates.piratesgui import PiratesGuiGlobals from pirates.piratesbase import PiratesGlobals from pirates.uberdog.UberDogGlobals import * from pirates.piratesgui import BorderFrame from pirates.uberdog import DistributedInventoryBase import GuiButton from pirates.quest.QuestDetailGUI import QuestDetailGUI from pirates.piratesgui import PDialog from otp.otpbase import OTPGlobals from otp.otpgui import OTPDialog tpMgr = TextPropertiesManager.getGlobalPtr() questTitleMain = TextProperties() questTitleMain.setSmallCaps(1) questTitleMain.setFont(PiratesGlobals.getPirateFont()) questTitleMain.setTextColor(*PiratesGuiGlobals.TextFG26) questTitleMain.setShadowColor(*PiratesGuiGlobals.TextFG0) questTitleMain.setGlyphScale(1.3) tpMgr.setProperties('questTitleMain', questTitleMain) questTitle = TextProperties() questTitle.setSmallCaps(1) questTitle.setFont(PiratesGlobals.getPirateFont()) questTitle.setTextColor(*PiratesGuiGlobals.TextFG26) questTitle.setShadowColor(*PiratesGuiGlobals.TextFG0) questTitle.setGlyphScale(1.2) tpMgr.setProperties('questTitle', questTitle) questTitle2 = TextProperties() questTitle2.setSmallCaps(1) questTitle2.setFont(PiratesGlobals.getPirateFont()) questTitle2.setTextColor(*PiratesGuiGlobals.TextFG2)
def __init__(self, title, doneCallback, siegeTeam = 0): ShipSelectionPanel.__init__(self, title, doneCallback, pages = [ self.OWN, self.FRIEND, self.CREW, self.GUILD, self.PUBLIC]) self.initialiseoptions(ShipDeployPanel) self._siegeTeam = siegeTeam if localAvatar.style.getTutorial() < PiratesGlobals.TUT_GOT_SHIP and localAvatar.getCurrentIsland() != QuestConstants.LocationIds.PORT_ROYAL_ISLAND: text = PLocalizer.DinghyNeedFirstShip % PLocalizer.LocationNames[QuestConstants.LocationIds.PORT_ROYAL_ISLAND] else: text = PLocalizer.DinghyNeedShip self.noShipHint = DirectLabel(parent = self, relief = None, text = text, text_font = PiratesGlobals.getPirateFont(), text_scale = 0.080000000000000002, text_fg = PiratesGuiGlobals.TextFG1, text_wordwrap = 10, textMayChange = 1, pos = (0.55000000000000004, 0, 0.80000000000000004))
def _initVisuals(self): self.visual = self.attachNewNode('RepairNail.visual') self.nailModel.find('**/nail_collision').setPos(0.0, -35.0, 0.0) self.nailModel.setScale(1.5) self.nailModel.find('**/nail_collision').setCollideMask(NAIL_COLLIDE_MASK) self.nailModel.find('**/nail_collision').setPythonTag('nail', self) self.nailModel.find('**/nail_collision').hide() self.nailModel.reparentTo(self.visual) self.nailModel.find('**/nail_model').setHpr(0.0, 20.0, 0.0) self.nailModel.setDepthTest(True) self.nailModel.setDepthWrite(True) self.shadow = self.nailModel.find('**/shadow') self.shadow.reparentTo(self) self.shadow.setPos(0.0, -0.040000000000000001, 0.02) self.shadow.setDepthTest(True) self.shadow.setDepthWrite(True) self.shadow.setScale(2.0) self.shadow.setTransparency(1) self.shadow.setSa(0.59999999999999998) self.resultLabel = DirectLabel(text = '', relief = None, text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateFont(), scale = (0.050000000000000003, 0.050000000000000003, 0.050000000000000003), pos = (0.0, 0.0, -0.089999999999999997), parent = self)
def __init__(self, category, width = 0.40000000000000002): DirectFrame.__init__(self, state = DGG.DISABLED, relief = None) self.initialiseoptions(ReputationMeterDial) self.category = category self.level = 0 self.value = 0 self.max = 0 self.masteredIval = None name = self.getCategoryName() self.changeMeter = ChangeDialMeter(parent = self, meterColor = VBase4(0.69999999999999996, 0.0, 0.0, 1), meterColor2 = VBase4(0.69999999999999996, 0.69999999999999996, 0.0, 1), baseColor = VBase4(0.10000000000000001, 0.10000000000000001, 0.10000000000000001, 1), wantCover = 0, scale = 0.45000000000000001) self.changeMeter.hide() self.meter = DialMeter(parent = self, meterColor = VBase4(0.69999999999999996, 0.0, 0.0, 1), baseColor = VBase4(0.10000000000000001, 0.10000000000000001, 0.10000000000000001, 1), wantCover = 0, scale = 0.45000000000000001) self.meter.setBackwards() self.lastLevel = None self.lastExp = None self.mastered = False self.categoryLabel = DirectLabel(parent = self, state = DGG.DISABLED, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0, 0, 0), textMayChange = 1) self.levelLabel = DirectLabel(parent = self, state = DGG.DISABLED, relief = None, text = '', text_scale = 0.080000000000000002, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_font = PiratesGlobals.getPirateFont(), pos = (-0.014999999999999999, 0, -0.080000000000000002), textMayChange = 1) logoModel = loader.loadModel('models/gui/potcLogo') guiModel = loader.loadModel('models/gui/toplevel_gui') self.valueLabel = DirectLabel(parent = self, state = DGG.DISABLED, relief = None, text = '', text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.0, 0, -0.20000000000000001), textMayChange = 1) self.levelCapScroll = DirectFrame(parent = self, relief = None, image = guiModel.find('**/main_gui_quest_scroll'), image_scale = (0.13, 1.0, 0.089999999999999997), pos = (0.0, 0.0, -0.16250000000000001)) self.levelCapScroll.hide() self.levelCapIcon = DirectFrame(parent = self, relief = None, image = logoModel.find('**/skull'), image_pos = (0.0, 0.0, 0.0), image_scale = 0.90000000000000002, pos = (-0.0275, 0.0, -0.105)) self.levelCapIcon.hide() self.levelCapScroll.setTransparency(1) self.levelCapIcon.setTransparency(1) self.valueLabel.setTransparency(1)
from pirates.reputation import ReputationGlobals from pirates.uberdog.UberDogGlobals import InventoryType from pirates.quest.QuestDetailGUI import QuestDetailBase from pirates.piratesgui import GameGui from pirates.audio import SoundGlobals from pirates.audio.SoundGlobals import loadSfx from pirates.inventory import InventoryUIRewardsContainer from pirates.inventory import ItemGlobals tpMgr = TextPropertiesManager.getGlobalPtr() questRewardComplete = TextProperties() questRewardComplete.setTextColor(0.29999999999999999, 0.69999999999999996, 0.25, 1) questRewardComplete.setGlyphScale(1.2) tpMgr.setProperties('questRewardComplete', questRewardComplete) questRewardTitle = TextProperties() questRewardTitle.setSmallCaps(1) questRewardTitle.setFont(PiratesGlobals.getPirateFont()) questRewardTitle.setTextColor(*PiratesGuiGlobals.TextFG26) questRewardTitle.setShadowColor(*PiratesGuiGlobals.TextFG0) tpMgr.setProperties('questRewardTitle', questRewardTitle) class QuestRewardGUI(QuestDetailBase): def __init__(self, quest, rewards): self.width = 1 self.rewards = rewards QuestDetailBase.__init__(self, parent = base.a2dBottomRight, pos = (0.59999999999999998, 0, 0.52000000000000002), text_fg = PiratesGuiGlobals.TextFG0) self.initialiseoptions(QuestRewardGUI) self.questComplete = DirectLabel(parent = self, relief = None, text = PLocalizer.QuestCompleted, text_fg = PiratesGuiGlobals.TextFG4, text_font = PiratesGlobals.getPirateOutlineFont(), text_shadow = (0, 0, 0, 1), pos = (-1.3200000000000001, 0, 0.13), scale = PiratesGuiGlobals.TextScaleTitleMed) gui = loader.loadModel('models/gui/toplevel_gui') gcButton = gui.find('**/treasure_w_coin*') goldCoin = gcButton.copyTo(gcButton)
def __init__(self, category, width=0.40000000000000002): DirectFrame.__init__(self, state=DGG.DISABLED, relief=None) self.initialiseoptions(ReputationMeterDial) self.category = category self.level = 0 self.value = 0 self.max = 0 self.masteredIval = None name = self.getCategoryName() self.changeMeter = ChangeDialMeter( parent=self, meterColor=VBase4(0.69999999999999996, 0.0, 0.0, 1), meterColor2=VBase4(0.69999999999999996, 0.69999999999999996, 0.0, 1), baseColor=VBase4(0.10000000000000001, 0.10000000000000001, 0.10000000000000001, 1), wantCover=0, scale=0.45000000000000001) self.changeMeter.hide() self.meter = DialMeter(parent=self, meterColor=VBase4(0.69999999999999996, 0.0, 0.0, 1), baseColor=VBase4(0.10000000000000001, 0.10000000000000001, 0.10000000000000001, 1), wantCover=0, scale=0.45000000000000001) self.meter.setBackwards() self.lastLevel = None self.lastExp = None self.mastered = False self.categoryLabel = DirectLabel( parent=self, state=DGG.DISABLED, relief=None, text=name, text_scale=PiratesGuiGlobals.TextScaleLarge, text_align=TextNode.ACenter, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text_font=PiratesGlobals.getInterfaceFont(), pos=(0, 0, 0), textMayChange=1) self.levelLabel = DirectLabel(parent=self, state=DGG.DISABLED, relief=None, text='', text_scale=0.080000000000000002, text_align=TextNode.ACenter, text_fg=PiratesGuiGlobals.TextFG2, text_font=PiratesGlobals.getPirateFont(), pos=(-0.014999999999999999, 0, -0.080000000000000002), textMayChange=1) logoModel = loader.loadModel('models/gui/potcLogo') guiModel = loader.loadModel('models/gui/toplevel_gui') self.valueLabel = DirectLabel( parent=self, state=DGG.DISABLED, relief=None, text='', text_scale=PiratesGuiGlobals.TextScaleLarge, text_align=TextNode.ACenter, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text_font=PiratesGlobals.getInterfaceFont(), pos=(0.0, 0, -0.20000000000000001), textMayChange=1) self.levelCapScroll = DirectFrame( parent=self, relief=None, image=guiModel.find('**/main_gui_quest_scroll'), image_scale=(0.13, 1.0, 0.089999999999999997), pos=(0.0, 0.0, -0.16250000000000001)) self.levelCapScroll.hide() self.levelCapIcon = DirectFrame(parent=self, relief=None, image=logoModel.find('**/skull'), image_pos=(0.0, 0.0, 0.0), image_scale=0.90000000000000002, pos=(-0.0275, 0.0, -0.105)) self.levelCapIcon.hide() self.levelCapScroll.setTransparency(1) self.levelCapIcon.setTransparency(1) self.valueLabel.setTransparency(1)
def __init__(self, shipPage, shipId, **kwargs): self.shipPage = shipPage self.emptyBottle = True self.setShipId(shipId) self.timer = None self.lBroadsideLimit = 0 self.rBroadsideLimit = 0 kwargs.setdefault("relief", None) kwargs.setdefault("frameSize", (0, self.Width, 0, self.Height)) DirectFrame.__init__(self, **None) self.initialiseoptions(ShipPanel) gui = loader.loadModel("models/gui/toplevel_gui") inventoryGui = loader.loadModel("models/gui/gui_icons_inventory") chestIcon = inventoryGui.find("**/pir_t_ico_trs_chest_01*") cannonIcon = gui.find("**/topgui_icon_ship_cannon_single") skillIcons = loader.loadModel("models/textureCards/skillIcons") broadsideId = InventoryType.CannonRoundShot ammoIconName = WeaponGlobals.getSkillIcon(broadsideId) broadsideIcon = skillIcons.find("**/%s" % ammoIconName) crewIcon = (gui.find("**/pir_t_gui_gen_friends_pirates"),) self.bottleFrame = ShipFrameBottle( parent=self, shipId=shipId, relief=None, state=DGG.DISABLED, pos=(0.074999999999999997, 0, 0.75), scale=0.83499999999999996, ) gui = loader.loadModel("models/gui/gui_ship_window") bottleImage = gui.find("**/ship_bottle") self.shipBottle = DirectLabel( parent=self.bottleFrame, relief=None, state=DGG.DISABLED, geom=bottleImage, geom_scale=0.29999999999999999, geom_pos=(0, 0, 0), pos=(0.5, 0, -0.0), ) self.nameLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottle, 2), text_fg=PiratesGuiGlobals.TextFG1, text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_align=TextNode.ACenter, text_shadow=(0, 0, 0, 1), text_wordwrap=30, textMayChange=1, text_font=PiratesGlobals.getPirateFont(), pos=(0.55000000000000004, 0, 1.22), ) self.classLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottleDesc, 1), text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ACenter, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), text_wordwrap=30, textMayChange=1, text_font=PiratesGlobals.getInterfaceFont(), pos=(0.55000000000000004, 0, 1.1799999999999999), ) self.timer = PiratesTimer.PiratesTimer( showMinutes=True, mode=None, titleText="", titleFg="", infoText="", cancelText="", cancelCallback=None ) self.timer.setFontColor(PiratesGuiGlobals.TextFG2) self.timer.reparentTo(self) self.timer.setPos(0.45000000000000001, 0, 0.93999999999999995) self.timer.setScale(0.59999999999999998) self.timer.stash() self.hpMeter = DirectWaitBar( parent=self, relief=DGG.RAISED, state=DGG.DISABLED, range=1, value=0, frameColor=(0.0, 0.0, 0.0, 0.0), barColor=(0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1), frameSize=(0, 0.31, 0, 0.018599999999999998), text="", text_align=TextNode.ARight, text_scale=0.029999999999999999, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.29999999999999999, 0.029999999999999999), pos=(0.55000000000000004, 0.0, 0.45000000000000001), scale=1.2, ) hpLabel = DirectLabel( parent=self.hpMeter, relief=None, state=DGG.DISABLED, text=PLocalizer.HP, text_scale=0.029999999999999999, text_align=TextNode.ALeft, text_pos=(0.014999999999999999, 0.029999999999999999), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.speedMeter = DirectWaitBar( parent=self, relief=DGG.RAISED, state=DGG.DISABLED, range=1, value=0, frameColor=(0.0, 0.0, 0.0, 0.0), barColor=(0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1), frameSize=(0, 0.31, 0, 0.018599999999999998), text="", text_align=TextNode.ARight, text_scale=0.029999999999999999, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.29999999999999999, 0.029999999999999999), pos=(0.55000000000000004, 0.0, 0.34999999999999998), scale=1.2, ) speedLabel = DirectLabel( parent=self.speedMeter, relief=None, state=DGG.DISABLED, text=PLocalizer.Sails, text_scale=0.029999999999999999, text_align=TextNode.ALeft, text_pos=(0.014999999999999999, 0.029999999999999999), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.customHullLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.14999999999999999, geom_pos=(0, 0, 0), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=(0, -0.070000000000000007), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.34999999999999998, 0, 0.68000000000000005), ) self.customHullLabel.hide() self.customRiggingLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.14999999999999999, geom_pos=(0, 0, 0), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=(0, -0.070000000000000007), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.75, 0, 0.68000000000000005), ) self.customRiggingLabel.hide() textPos = (0.0, -0.16) self.plunderLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.10000000000000001, geom_pos=(0, 0, -0.050000000000000003), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.20000000000000001, 0, 0.20000000000000001), ) plunderLabel = DirectLabel( parent=self.plunderLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Cargo, text_scale=0.035999999999999997, text_align=TextNode.ACenter, text_pos=(0, 0.040000000000000001), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.cannonLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=cannonIcon, geom_scale=0.45000000000000001, geom_pos=(0, 0, -0.050000000000000003), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.37, 0, 0.20000000000000001), ) cannonLabel = DirectLabel( parent=self.cannonLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Cannon, text_scale=0.035999999999999997, text_align=TextNode.ACenter, text_pos=(0, 0.040000000000000001), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.cannonLabel = cannonLabel self.broadsideLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=broadsideIcon, geom_scale=0.14999999999999999, geom_pos=(0, 0, -0.050000000000000003), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.81000000000000005, 0, 0.20000000000000001), ) broadsideLabel = DirectLabel( parent=self.broadsideLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Broadsides, text_scale=0.035999999999999997, text_align=TextNode.ACenter, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.0, 0.040000000000000001), ) self.broadsideLabel = broadsideLabel self.crewLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=crewIcon, geom_scale=0.40000000000000002, geom_pos=(0, 0, 0.10000000000000001), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.56000000000000005, 0, 0.040000000000000001), ) crewLabel = DirectLabel( parent=self.crewLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Crew, text_scale=0.035999999999999997, text_align=TextNode.ACenter, text_pos=(0.0, 0.20000000000000001), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.crewLabel = crewLabel shipOV = base.cr.getOwnerView(self.shipId) if shipOV: self.setShipName(shipOV.name) self.setShipClass(shipOV.shipClass) self.setShipHp(shipOV.Hp, shipOV.maxHp) self.setShipSp(shipOV.Sp, shipOV.maxSp) self.setShipCrew(shipOV.crew, shipOV.maxCrew) self.setShipCargo([], shipOV.maxCargo) if hasattr(shipOV, "cannonConfig"): self.setShipMaxCannons(shipOV.cannonConfig) self.setShipMaxBroadside(shipOV.lBroadsideConfig, shipOV.rBroadsideConfig) self.updateIcons() if self.emptyBottle: self.hpMeter.hide() self.speedMeter.hide() self.plunderLimit.hide() self.cannonLimit.hide() self.broadsideLimit.hide() self.crewLimit.hide() self.accept("setName-%s" % self.shipId, self.setShipName) self.accept("setShipClass-%s" % self.shipId, self.setShipClass) self.accept("setShipHp-%s" % self.shipId, self.setShipHp) self.accept("setShipSp-%s" % self.shipId, self.setShipSp) self.accept("setShipCargo-%s" % self.shipId, self.setShipCargo) self.accept("setShipCrew-%s" % self.shipId, self.setShipCrew) self.accept("setShipTimer-%s" % self.shipId, self.setShipTimer) self.accept("setHullCannonConfig-%s" % self.shipId, self.setShipMaxCannons) self.accept("setHullLeftBroadsideConfig-%s" % self.shipId, self.setShipMaxLeftBroadside) self.accept("setHullRightBroadsideConfig-%s" % self.shipId, self.setShipMaxRightBroadside) self.accept("ShipChanged-%s" % self.shipId, self.handleShipChanged) if base.config.GetBool("want-deploy-button", 0): pass 1
def createTextIcons(self): tpMgr = TextPropertiesManager.getGlobalPtr() if not tpMgr.hasGraphic("cutlassEquip"): topGui = loader.loadModel("models/gui/toplevel_gui") triangleGui = loader.loadModel("models/gui/triangle") skullGui = loader.loadModel("models/gui/chat_frame_skull") kbButton = topGui.find("**/keyboard_button") nomButton = topGui.find("**/icon_mouse") lmButton = topGui.find("**/icon_mouse_left") lmButton.setScale(4) csButton = skullGui.find("**/*skull") caButton = triangleGui.find("**/triangle") rmButton = topGui.find("**/icon_mouse_left") rmButton.setScale(4) rmButton.setHpr(180, 0, 0) jnButton = topGui.find("**/topgui_icon_journal") skButton = topGui.find("**/topgui_icon_skills") chestClosedButton = topGui.find("**/treasure_chest_closed") chestOpenButton = topGui.find("**/treasure_chest_open") cm = CardMaker("cm") tabCardRoot = NodePath("tabCardRoot") tabCard = kbButton.copyTo(kbButton) tabCard.setScale(2.0, 1, 1) tabCard.reparentTo(tabCardRoot) ctrlCardRoot = NodePath("ctrlCardRoot") ctrlCard = kbButton.copyTo(kbButton) ctrlCard.setScale(2.0, 1, 1) ctrlCard.reparentTo(ctrlCardRoot) shiftCardRoot = NodePath("shiftCardRoot") shiftCard = kbButton.copyTo(kbButton) shiftCard.setScale(2.2000000000000002, 1, 1) shiftCard.reparentTo(shiftCardRoot) escapeCardRoot = NodePath("escapeCardRoot") escapeCard = kbButton.copyTo(kbButton) escapeCard.setScale(2.0, 1, 1) escapeCard.reparentTo(escapeCardRoot) oneCardRoot = NodePath("oneCardRoot") oneCard = kbButton.copyTo(kbButton) oneCard.reparentTo(oneCardRoot) questPageCard = kbButton.copyTo(kbButton) questPageCard.setScale(1.2) skillPageCardRoot = NodePath("skillCardRoot") skillPageCard = skButton.copyTo(skButton) skillPageCard.setScale(3.0) skillPageCard.setPos(0, 0, -0.10000000000000001) skillPageCard.reparentTo(skillPageCardRoot) weapon1Card = kbButton.copyTo(kbButton) weapon2Card = kbButton.copyTo(kbButton) lookoutCard = kbButton.copyTo(kbButton) mouseCard = nomButton.copyTo(nomButton) mouseCard.setScale(2) leftClickCard = lmButton.copyTo(lmButton) leftClickCard.setScale(2) chatSkullCard = csButton.copyTo(csButton) chatSkullCard.setScale(5) chatArrowCard = caButton.copyTo(caButton) rightClickCard = rmButton.copyTo(rmButton) rightClickCard.setScale(2) moveCard = kbButton.copyTo(kbButton) skillCardRoot = NodePath("skillCardRoot") skillGui = loader.loadModel("models/textureCards/skillIcons.bam") sweep = skillGui.findTexture("tutorial_sweep") skillCard = NodePath(cm.generate()) skillCard.setTexture(sweep) skillCard.setTransparency(TransparencyAttrib.MAlpha) skillCard.setScale(1.5) skillCard.setPos(0.0, 0, -2) skillCard.reparentTo(skillCardRoot) chestClosedCard = chestClosedButton.copyTo(chestClosedButton) chestClosedCard.setScale(5) chestOpenCard = chestOpenButton.copyTo(chestOpenButton) chestOpenCard.setScale(5) journalCardRoot = NodePath("journalCardRoot") journalCard = jnButton.copyTo(jnButton) journalCard.setScale(4) journalCard.reparentTo(journalCardRoot) tabText = DirectLabel( parent=tabCardRoot, relief=None, text=PLocalizer.TabKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999), ) ctrlText = DirectLabel( parent=ctrlCardRoot, relief=None, text=PLocalizer.CtrlKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999), ) shiftText = DirectLabel( parent=shiftCardRoot, relief=None, text=PLocalizer.ShiftKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999), ) escapeText = DirectLabel( parent=escapeCardRoot, relief=None, text=PLocalizer.EscapeKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999), ) oneText = DirectLabel( parent=oneCardRoot, relief=None, text=PLocalizer.OneKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999), ) questPageText = DirectLabel( parent=questPageCard, relief=None, text=PLocalizer.QuestPageKey, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_font=PiratesGlobals.getPirateFont(), text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.050000000000000003), ) weapon1Text = DirectLabel( parent=weapon1Card, relief=None, text=PLocalizer.WeaponSlot1, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.14999999999999999), ) weapon2Text = DirectLabel( parent=weapon2Card, relief=None, text=PLocalizer.WeaponSlot2, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.14999999999999999), ) lookoutText = DirectLabel( parent=lookoutCard, relief=None, text=PLocalizer.LookoutPageKey, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.14999999999999999), ) moveText = DirectLabel( parent=moveCard, relief=None, text=PLocalizer.ForwardMoveKey, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.14999999999999999), ) tpMgr.setGraphic("tabButton", tabCardRoot) tpMgr.setGraphic("ctrlButton", ctrlCardRoot) tpMgr.setGraphic("shiftButton", shiftCardRoot) tpMgr.setGraphic("escapeButton", escapeCardRoot) tpMgr.setGraphic("oneButton", oneCardRoot) tpMgr.setGraphic("chestClosedButton", chestClosedCard) tpMgr.setGraphic("chestOpenButton", chestOpenCard) tpMgr.setGraphic("questPageButton", questPageCard) tpMgr.setGraphic("skillPageButton", skillPageCardRoot) tpMgr.setGraphic("journalButton", journalCardRoot) tpMgr.setGraphic("cutlassEquip", weapon1Card) tpMgr.setGraphic("pistolEquip", weapon2Card) tpMgr.setGraphic("mouseIcon", mouseCard) tpMgr.setGraphic("leftClick", leftClickCard) tpMgr.setGraphic("rightClick", rightClickCard) tpMgr.setGraphic("moveKeys", moveCard) tpMgr.setGraphic("skillKey", skillCardRoot) tpMgr.setGraphic("lookoutKey", lookoutCard) tpMgr.setGraphic("chatSkull", chatSkullCard) tpMgr.setGraphic("chatArrow", chatArrowCard)
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 _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 __init__(self, w=9.0, h=6.0, lock=True): self.width = w self.height = h self.imageFocus = 0 self.hasEmbedded = hasEmbedded self.questIdReporting = 'None_Provided' self._NonPayerPanel__fader = None DirectFrame.__init__(self, relief=DGG.RIDGE, state=DGG.NORMAL, frameColor=Vec4(0.0, 0.0, 0.0, 0.69999999999999996), borderWidth=PiratesGuiGlobals.BorderWidth, frameSize=(0, self.width, 0, self.height), pos=(-4.5, 0, -3.0), sortOrder=999) self.initialiseoptions(NonPayerPanel) self.configurePanel() self.gamePic = [None, None] self.gamePic[0] = DirectFrame( parent=self, relief=None, image=self.gameImage[0][0], image_scale=(1.0, 0.75, 0.75), image_pos=(0, 0, 0), pos=(4.0, 0, 3.2799999999999998), text=self.gameCaption[0][0], text_align=TextNode.ACenter, text_scale=0.055, text_pos=(0, -0.32000000000000001, 0), text_fg=PiratesGuiGlobals.TextFG1, text_font=PiratesGlobals.getPirateOutlineFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_shadowOffset=(0.10000000000000001, 0.10000000000000001), textMayChange=1) self.gamePic[1] = DirectFrame( parent=self, relief=None, image=self.gameImage[0][1], image_scale=(1.0, 0.75, 0.75), image_pos=(0, 0, 0), pos=(5.0, 0, 3.2799999999999998), text=self.gameCaption[0][1], text_align=TextNode.ACenter, text_scale=0.055, text_pos=(0, -0.32000000000000001, 0), text_fg=PiratesGuiGlobals.TextFG1, text_font=PiratesGlobals.getPirateOutlineFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_shadowOffset=(0.10000000000000001, 0.10000000000000001), textMayChange=1) gui2 = loader.loadModel('models/gui/velvetrope') gui2.find('**/go_right').hide() gui2.find('**/go_left').hide() gui2.find('**/close_button').hide() gui2.find('**/upgrade_buttomn').hide() gui2.find('**/drop_shadow_buttons').hide() if not lock: gui2.find('**/lock').hide() gui2.find('**/lock_red_halo').hide() gui2.find('**/window_hoops').hide() root = gui2.find('**/velvetrope_top') titleBorder = gui2.find('**/title_bar_08') titleBorder.reparentTo(root) self.imageOne = DirectFrame(parent=self, relief=None, geom=gui2.find('**/velvetrope_top'), geom_scale=0.40000000000000002, pos=(4.5, 0, 3.1499999999999999)) self.titleText = DirectLabel(parent=self, relief=None, text=PLocalizer.VR_AuthAccess, text_align=TextNode.ACenter, text_scale=0.074999999999999997, text_fg=PiratesGuiGlobals.TextFG1, text_font=PiratesGlobals.getPirateFont(), text_shadow=PiratesGuiGlobals.TextShadow, pos=(4.5, 0, 3.7999999999999998), textMayChange=1) self.underText = DirectLabel( parent=self, relief=None, text=self.gameHeader[0], text_align=TextNode.ACenter, text_scale=0.059999999999999998, text_wordwrap=40, text_fg=PiratesGuiGlobals.TextFG15, text_font=PiratesGlobals.getInterfaceFont(), text_shadow=PiratesGuiGlobals.TextShadow, pos=(4.5, 0, 2.7999999999999998)) self.fullText = DirectLabel( parent=self, relief=None, text=self.gameDescript[0], text_align=TextNode.ALeft, text_scale=0.044999999999999998, text_wordwrap=30, text_fg=PiratesGuiGlobals.TextFG0, text_font=PiratesGlobals.getInterfaceFont(), pos=(4.0499999999999998, 0, 2.7200000000000002)) lookoutUI = loader.loadModel('models/gui/lookout_gui') basegeom = gui2.find('**/go_right') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.scrollRight = DirectButton(parent=self, relief=None, geom=(norm_geom, down_geom, over_geom), scale=0.40000000000000002, pos=(4.5, 0, 3.1499999999999999), command=self.scrollPicsRight) basegeom = gui2.find('**/go_left') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.scrollLeft = DirectButton(parent=self, relief=None, geom=(norm_geom, down_geom, over_geom), scale=0.40000000000000002, pos=(4.5, 0, 3.1499999999999999), command=self.scrollPicsLeft) basegeom = gui2.find('**/upgrade_buttomn') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.upgradeButton = DirectButton( parent=self, relief=None, geom=(norm_geom, down_geom, over_geom), geom0_color=(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), geom1_color=(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1), geom2_color=(1, 1, 1, 1), pos=(4.9000000000000004, 0, 3.1499999999999999), geom_scale=0.40000000000000002, command=self.upgradeNow, text=PLocalizer.VR_UpgradeNow, text_fg=PiratesGuiGlobals.TextFG1, text_font=PiratesGlobals.getPirateOutlineFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_scale=0.059999999999999998, text_pos=(0, -0.76000000000000001)) self.passButton = DirectButton( parent=self, relief=None, geom=(norm_geom, down_geom, over_geom), geom0_color=(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), geom1_color=(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1), geom2_color=(1, 1, 1, 1), pos=(4.0999999999999996, 0, 3.1499999999999999), geom_scale=0.40000000000000002, command=self.continuePlayingNow, text=PLocalizer.VR_UpgradeLater, text_fg=PiratesGuiGlobals.TextFG1, text_font=PiratesGlobals.getPirateOutlineFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_scale=0.059999999999999998, text_pos=(0, -0.76000000000000001)) basegeom = gui2.find('**/close_button') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.dismissButton = DirectButton(parent=self, relief=None, geom=(norm_geom, down_geom, over_geom), scale=0.40000000000000002, pos=(4.5, 0, 3.1150000000000002), command=self.dismissNow) self.clickHereButton = DirectButton( parent=self, relief=None, pos=(4.5300000000000002, 0, 3.1499999999999999), command=self.moreInfo, text=PLocalizer.VR_Access, text0_fg=PiratesGuiGlobals.TextFG0, text1_fg=PiratesGuiGlobals.TextFG0, text2_fg=PiratesGuiGlobals.TextFG6, text_font=PiratesGlobals.getInterfaceFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_scale=0.044999999999999998, text_pos=(0, -0.63500000000000001)) self.setBin('gui-popup', 0)
def __init__(self): DirectObject.DirectObject.__init__(self) self.event = None self.sfx = None self.text = DirectLabel(parent = render2d, relief = None, text = '', text_align = TextNode.ACenter, text_scale = 0.055, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), pos = (0, 0, -0.90000000000000002), sortOrder = 80) self.confirmButton = DialogButton(parent = base.a2dBottomRight, pos = (-0.14999999999999999, 0, 0.095000000000000001), text = PLocalizer.MakeAPirateNext, text_scale = 0.050000000000000003, text_pos = (0.040000000000000001, -0.017999999999999999), text_fg = PiratesGuiGlobals.TextFG2, textMayChange = 1, command = self.advancePageNumber, sortOrder = 90, buttonStyle = DialogButton.YES) self.EscText = DirectLabel(parent = render2d, relief = None, text = '', text_align = TextNode.ALeft, text_scale = 0.055, text_fg = PiratesGuiGlobals.TextFG9, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), pos = (-0.92000000000000004, 0, 0.88), sortOrder = 80) base.transitions.loadLetterbox() self.text.setScale(aspect2d, 1) self.accept('aspectRatioChanged', self.text.setScale, [ aspect2d, 1]) self.text.hide() self.confirmButton.hide() self.EscText.hide() self.fader = None self.subtitleParent = render2d.attachNewNode(PGTop('subtitleParent')) self.subtitleParent.node().setMouseWatcher(base.mouseWatcherNode) self._Subtitler__chatPageNumber = None self._Subtitler__chatPages = None self._Subtitler__chatMessage = None self._Subtitler__chatPages = [] self._Subtitler__optionButtons = [] self.specialButtonImage = None self.clearTextOverride = False
def __init__(self, parent, gear, **kw): gui = loader.loadModel('models/gui/gui_map_window_drawer') dotcard = loader.loadModel('models/gui/toplevel_gui') self.dot = dotcard.find('**/topgui_icon_ship_hulldot_on') self.shards = {} optiondefs = (('image', gui.find('**/drawer'), None), ('image_scale', 0.32000000000000001, None), ('pos', ShardPanel.UPPOS, None), ('uppos', ShardPanel.UPPOS, None), ('downpos', ShardPanel.DOWNPOS, None), ('showtime', ShardPanel.SHOWTIME, None), ('shardSelected', self.shardSelected, None), ('inverted', False, None), ('buttonFont', PiratesGlobals.getPirateFont(), None), ('preferredShard', 0, self.setPreferredShard)) self.defineoptions(kw, optiondefs) DirectFrame.__init__(self, parent) self.initialiseoptions(ShardPanel) bounds = self.getBounds() self['frameSize'] = Vec4(bounds[0], bounds[1], bounds[2], bounds[3]) * 1.25 self.shards = {} self.popTrackerHandle = None self.stopLightButtons = {} self.textRolloverColor = Vec4(0.40000000000000002, 0.40000000000000002, 0, 1) self.textDownColor = Vec4(0.5, 0.90000000000000002, 1, 1) self.textDisabledColor = Vec4(0.80000000000000004, 0.40000000000000002, 0.40000000000000002, 1) self.textSelectedColor = Vec4(0.40000000000000002, 0.80000000000000004, 0.40000000000000002, 1) self.gear = gear self.up = True self.showIval = None self.hideIval = None self.showPop = config.GetBool('show-total-population', 0) self.teleportAll = config.GetBool('teleport-all', 0) if config.GetBool('shard-page-disable', 0): pass self.noTeleport = not (self.teleportAll) self.rotationFrame = DirectFrame(parent=self, relief=None, state=DGG.DISABLED) if self['inverted']: self.rotationFrame.setR(180) self.rotationFrame.setPos(-0.02, 0, 0.41999999999999998) self.titleLabel = DirectLabel( parent=self.rotationFrame, relief=None, text=PLocalizer.ShardActiveWorlds, text_font=PiratesGlobals.getPirateOutlineFont(), text_scale=0.080000000000000002, text_fg=PiratesGuiGlobals.TextFG2, textMayChange=0, pos=(0, 0, 0.54500000000000004)) if self['inverted']: self.titleLabel.hide() self.button = DirectButton(parent=self, relief=None, geom=gui.find('**/drawer_button_over'), geom_scale=0.32000000000000001, command=self.handleButtonPressed) if self['inverted']: self.button['frameSize'] = (-0.37, 0.34999999999999998, -0.32000000000000001, -0.11) self.currentShardLabel = DirectLabel(parent=self.rotationFrame, text='', text_font=self['buttonFont'], text_scale=0.050000000000000003, text_fg=PiratesGuiGlobals.TextFG2, textMayChange=1, pos=(0, 0, -0.23300000000000001)) if self['inverted']: self.currentShardLabel.setZ(0.60499999999999998) self.currentShardLabel.setAlphaScale(0.90000000000000002) self.shardScrolledFrame = DirectScrolledFrame( parent=self.rotationFrame, relief=1, state=DGG.NORMAL, frameColor=(1, 1, 1, 0), borderWidth=PiratesGuiGlobals.BorderWidth, frameSize=(0, 0.68500000000000005, -0.82999999999999996, -0.125), canvasSize=(0, 0, 0, 0), verticalScroll_frameColor=PiratesGuiGlobals.ScrollbarColor, verticalScroll_borderWidth=(0.0050000000000000001, 0.0050000000000000001), verticalScroll_frameSize=(0, PiratesGuiGlobals.ScrollbarSize, 0, 0), verticalScroll_thumb_frameColor=PiratesGuiGlobals.ButtonColor2, verticalScroll_incButton_frameColor=PiratesGuiGlobals.ButtonColor2, verticalScroll_decButton_frameColor=PiratesGuiGlobals.ButtonColor2, verticalScroll_scrollSize=0.096000000000000002, horizontalScroll_frameColor=PiratesGuiGlobals.ScrollbarColor, horizontalScroll_borderWidth=(0.0050000000000000001, 0.0050000000000000001), horizontalScroll_frameSize=(0, 0, 0, PiratesGuiGlobals.ScrollbarSize), horizontalScroll_thumb_frameColor=PiratesGuiGlobals.ButtonColor2, horizontalScroll_incButton_frameColor=PiratesGuiGlobals. ButtonColor2, horizontalScroll_decButton_frameColor=PiratesGuiGlobals. ButtonColor2, pos=(-0.35199999999999998, 0, 0.65600000000000003)) self.shardScrolledFrame.accept( 'press-wheel_up-%s' % self.shardScrolledFrame.guiId, self.mouseWheelUp) self.shardScrolledFrame.accept( 'press-wheel_down-%s' % self.shardScrolledFrame.guiId, self.mouseWheelDown) self.refreshShardLabels() self.accept('shardSwitchComplete', self.refreshCurrentShard)
def __init__(self, w = 9.0, h = 6.0, lock = True): self.width = w self.height = h self.imageFocus = 0 self.hasEmbedded = hasEmbedded self.questIdReporting = 'None_Provided' self._NonPayerPanel__fader = None DirectFrame.__init__(self, relief = DGG.RIDGE, state = DGG.NORMAL, frameColor = Vec4(0.0, 0.0, 0.0, 0.69999999999999996), borderWidth = PiratesGuiGlobals.BorderWidth, frameSize = (0, self.width, 0, self.height), pos = (-4.5, 0, -3.0), sortOrder = 999) self.initialiseoptions(NonPayerPanel) self.configurePanel() self.gamePic = [ None, None] self.gamePic[0] = DirectFrame(parent = self, relief = None, image = self.gameImage[0][0], image_scale = (1.0, 0.75, 0.75), image_pos = (0, 0, 0), pos = (4.0, 0, 3.2799999999999998), text = self.gameCaption[0][0], text_align = TextNode.ACenter, text_scale = 0.055, text_pos = (0, -0.32000000000000001, 0), text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getPirateOutlineFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_shadowOffset = (0.10000000000000001, 0.10000000000000001), textMayChange = 1) self.gamePic[1] = DirectFrame(parent = self, relief = None, image = self.gameImage[0][1], image_scale = (1.0, 0.75, 0.75), image_pos = (0, 0, 0), pos = (5.0, 0, 3.2799999999999998), text = self.gameCaption[0][1], text_align = TextNode.ACenter, text_scale = 0.055, text_pos = (0, -0.32000000000000001, 0), text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getPirateOutlineFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_shadowOffset = (0.10000000000000001, 0.10000000000000001), textMayChange = 1) gui2 = loader.loadModel('models/gui/velvetrope') gui2.find('**/go_right').hide() gui2.find('**/go_left').hide() gui2.find('**/close_button').hide() gui2.find('**/upgrade_buttomn').hide() gui2.find('**/drop_shadow_buttons').hide() if not lock: gui2.find('**/lock').hide() gui2.find('**/lock_red_halo').hide() gui2.find('**/window_hoops').hide() root = gui2.find('**/velvetrope_top') titleBorder = gui2.find('**/title_bar_08') titleBorder.reparentTo(root) self.imageOne = DirectFrame(parent = self, relief = None, geom = gui2.find('**/velvetrope_top'), geom_scale = 0.40000000000000002, pos = (4.5, 0, 3.1499999999999999)) self.titleText = DirectLabel(parent = self, relief = None, text = PLocalizer.VR_AuthAccess, text_align = TextNode.ACenter, text_scale = 0.074999999999999997, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getPirateFont(), text_shadow = PiratesGuiGlobals.TextShadow, pos = (4.5, 0, 3.7999999999999998), textMayChange = 1) self.underText = DirectLabel(parent = self, relief = None, text = self.gameHeader[0], text_align = TextNode.ACenter, text_scale = 0.059999999999999998, text_wordwrap = 40, text_fg = PiratesGuiGlobals.TextFG15, text_font = PiratesGlobals.getInterfaceFont(), text_shadow = PiratesGuiGlobals.TextShadow, pos = (4.5, 0, 2.7999999999999998)) self.fullText = DirectLabel(parent = self, relief = None, text = self.gameDescript[0], text_align = TextNode.ALeft, text_scale = 0.044999999999999998, text_wordwrap = 30, text_fg = PiratesGuiGlobals.TextFG0, text_font = PiratesGlobals.getInterfaceFont(), pos = (4.0499999999999998, 0, 2.7200000000000002)) lookoutUI = loader.loadModel('models/gui/lookout_gui') basegeom = gui2.find('**/go_right') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.scrollRight = DirectButton(parent = self, relief = None, geom = (norm_geom, down_geom, over_geom), scale = 0.40000000000000002, pos = (4.5, 0, 3.1499999999999999), command = self.scrollPicsRight) basegeom = gui2.find('**/go_left') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.scrollLeft = DirectButton(parent = self, relief = None, geom = (norm_geom, down_geom, over_geom), scale = 0.40000000000000002, pos = (4.5, 0, 3.1499999999999999), command = self.scrollPicsLeft) basegeom = gui2.find('**/upgrade_buttomn') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.upgradeButton = DirectButton(parent = self, relief = None, geom = (norm_geom, down_geom, over_geom), geom0_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), geom1_color = (0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1), geom2_color = (1, 1, 1, 1), pos = (4.9000000000000004, 0, 3.1499999999999999), geom_scale = 0.40000000000000002, command = self.upgradeNow, text = PLocalizer.VR_UpgradeNow, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getPirateOutlineFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_scale = 0.059999999999999998, text_pos = (0, -0.76000000000000001)) self.passButton = DirectButton(parent = self, relief = None, geom = (norm_geom, down_geom, over_geom), geom0_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), geom1_color = (0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1), geom2_color = (1, 1, 1, 1), pos = (4.0999999999999996, 0, 3.1499999999999999), geom_scale = 0.40000000000000002, command = self.continuePlayingNow, text = PLocalizer.VR_UpgradeLater, text_fg = PiratesGuiGlobals.TextFG1, text_font = PiratesGlobals.getPirateOutlineFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_scale = 0.059999999999999998, text_pos = (0, -0.76000000000000001)) basegeom = gui2.find('**/close_button') norm_geom = basegeom.find('**/normal') over_geom = basegeom.find('**/over') down_geom = basegeom.find('**/down') self.dismissButton = DirectButton(parent = self, relief = None, geom = (norm_geom, down_geom, over_geom), scale = 0.40000000000000002, pos = (4.5, 0, 3.1150000000000002), command = self.dismissNow) self.clickHereButton = DirectButton(parent = self, relief = None, pos = (4.5300000000000002, 0, 3.1499999999999999), command = self.moreInfo, text = PLocalizer.VR_Access, text0_fg = PiratesGuiGlobals.TextFG0, text1_fg = PiratesGuiGlobals.TextFG0, text2_fg = PiratesGuiGlobals.TextFG6, text_font = PiratesGlobals.getInterfaceFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_scale = 0.044999999999999998, text_pos = (0, -0.63500000000000001)) self.setBin('gui-popup', 0)
def _initVisuals(self): self.countDownLabel = DirectLabel(text = self.startText, text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateFont(), scale = (0.16, 0.16, 0.16), pos = (0.0, 0.0, 0.14999999999999999), parent = self, relief = None, textMayChange = 1) self.countDownLabel.setBin('fixed', 37) self.winLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Win, text_fg = (1.0, 1.0, 1.0, 1.0), text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.16, 0.16, 0.16), pos = RepairGlobals.Common.youWinPos[self.name], relief = None, parent = self) self.winLabel.setBin('fixed', 37) self.winLabel.stash() self.scoreLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Win, text_fg = (1.0, 1.0, 1.0, 1.0), text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.10000000000000001, 0.10000000000000001, 0.10000000000000001), pos = RepairGlobals.Common.scorePos[self.name], relief = None, parent = self) self.scoreLabel.setBin('fixed', 37) self.scoreLabel.stash() self.postWinLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pick_New_Game, text_fg = (1.0, 1.0, 1.0, 1.0), text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.14000000000000001, 0.14000000000000001, 0.14000000000000001), pos = RepairGlobals.Common.youWinPos[self.name], relief = None, textMayChange = 1, parent = self.repairGame.gui) self.postWinLabel.setBin('fixed', 37) self.postWinLabel.stash()
def __init__(self, parent, gear, **kw): gui = loader.loadModel('models/gui/gui_map_window_drawer') dotcard = loader.loadModel('models/gui/toplevel_gui') self.dot = dotcard.find('**/topgui_icon_ship_hulldot_on') self.shards = { } optiondefs = (('image', gui.find('**/drawer'), None), ('image_scale', 0.32000000000000001, None), ('pos', ShardPanel.UPPOS, None), ('uppos', ShardPanel.UPPOS, None), ('downpos', ShardPanel.DOWNPOS, None), ('showtime', ShardPanel.SHOWTIME, None), ('shardSelected', self.shardSelected, None), ('inverted', False, None), ('buttonFont', PiratesGlobals.getPirateFont(), None), ('preferredShard', 0, self.setPreferredShard)) self.defineoptions(kw, optiondefs) DirectFrame.__init__(self, parent) self.initialiseoptions(ShardPanel) bounds = self.getBounds() self['frameSize'] = Vec4(bounds[0], bounds[1], bounds[2], bounds[3]) * 1.25 self.shards = { } self.popTrackerHandle = None self.stopLightButtons = { } self.textRolloverColor = Vec4(0.40000000000000002, 0.40000000000000002, 0, 1) self.textDownColor = Vec4(0.5, 0.90000000000000002, 1, 1) self.textDisabledColor = Vec4(0.80000000000000004, 0.40000000000000002, 0.40000000000000002, 1) self.textSelectedColor = Vec4(0.40000000000000002, 0.80000000000000004, 0.40000000000000002, 1) self.gear = gear self.up = True self.showIval = None self.hideIval = None self.showPop = config.GetBool('show-total-population', 0) self.teleportAll = config.GetBool('teleport-all', 0) if config.GetBool('shard-page-disable', 0): pass self.noTeleport = not (self.teleportAll) self.rotationFrame = DirectFrame(parent = self, relief = None, state = DGG.DISABLED) if self['inverted']: self.rotationFrame.setR(180) self.rotationFrame.setPos(-0.02, 0, 0.41999999999999998) self.titleLabel = DirectLabel(parent = self.rotationFrame, relief = None, text = PLocalizer.ShardActiveWorlds, text_font = PiratesGlobals.getPirateOutlineFont(), text_scale = 0.080000000000000002, text_fg = PiratesGuiGlobals.TextFG2, textMayChange = 0, pos = (0, 0, 0.54500000000000004)) if self['inverted']: self.titleLabel.hide() self.button = DirectButton(parent = self, relief = None, geom = gui.find('**/drawer_button_over'), geom_scale = 0.32000000000000001, command = self.handleButtonPressed) if self['inverted']: self.button['frameSize'] = (-0.37, 0.34999999999999998, -0.32000000000000001, -0.11) self.currentShardLabel = DirectLabel(parent = self.rotationFrame, text = '', text_font = self['buttonFont'], text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG2, textMayChange = 1, pos = (0, 0, -0.23300000000000001)) if self['inverted']: self.currentShardLabel.setZ(0.60499999999999998) self.currentShardLabel.setAlphaScale(0.90000000000000002) self.shardScrolledFrame = DirectScrolledFrame(parent = self.rotationFrame, relief = 1, state = DGG.NORMAL, frameColor = (1, 1, 1, 0), borderWidth = PiratesGuiGlobals.BorderWidth, frameSize = (0, 0.68500000000000005, -0.82999999999999996, -0.125), canvasSize = (0, 0, 0, 0), verticalScroll_frameColor = PiratesGuiGlobals.ScrollbarColor, verticalScroll_borderWidth = (0.0050000000000000001, 0.0050000000000000001), verticalScroll_frameSize = (0, PiratesGuiGlobals.ScrollbarSize, 0, 0), verticalScroll_thumb_frameColor = PiratesGuiGlobals.ButtonColor2, verticalScroll_incButton_frameColor = PiratesGuiGlobals.ButtonColor2, verticalScroll_decButton_frameColor = PiratesGuiGlobals.ButtonColor2, verticalScroll_scrollSize = 0.096000000000000002, horizontalScroll_frameColor = PiratesGuiGlobals.ScrollbarColor, horizontalScroll_borderWidth = (0.0050000000000000001, 0.0050000000000000001), horizontalScroll_frameSize = (0, 0, 0, PiratesGuiGlobals.ScrollbarSize), horizontalScroll_thumb_frameColor = PiratesGuiGlobals.ButtonColor2, horizontalScroll_incButton_frameColor = PiratesGuiGlobals.ButtonColor2, horizontalScroll_decButton_frameColor = PiratesGuiGlobals.ButtonColor2, pos = (-0.35199999999999998, 0, 0.65600000000000003)) self.shardScrolledFrame.accept('press-wheel_up-%s' % self.shardScrolledFrame.guiId, self.mouseWheelUp) self.shardScrolledFrame.accept('press-wheel_down-%s' % self.shardScrolledFrame.guiId, self.mouseWheelDown) self.refreshShardLabels() self.accept('shardSwitchComplete', self.refreshCurrentShard)
def createTextIcons(self): tpMgr = TextPropertiesManager.getGlobalPtr() if not tpMgr.hasGraphic('cutlassEquip'): topGui = loader.loadModel('models/gui/toplevel_gui') triangleGui = loader.loadModel('models/gui/triangle') skullGui = loader.loadModel('models/gui/chat_frame_skull') kbButton = topGui.find('**/keyboard_button') nomButton = topGui.find('**/icon_mouse') lmButton = topGui.find('**/icon_mouse_left') lmButton.setScale(4) csButton = skullGui.find('**/*skull') caButton = triangleGui.find('**/triangle') rmButton = topGui.find('**/icon_mouse_left') rmButton.setScale(4) rmButton.setHpr(180, 0, 0) jnButton = topGui.find('**/topgui_icon_journal') skButton = topGui.find('**/topgui_icon_skills') chestClosedButton = topGui.find('**/treasure_chest_closed') chestOpenButton = topGui.find('**/treasure_chest_open') cm = CardMaker('cm') tabCardRoot = NodePath('tabCardRoot') tabCard = kbButton.copyTo(kbButton) tabCard.setScale(2.0, 1, 1) tabCard.reparentTo(tabCardRoot) ctrlCardRoot = NodePath('ctrlCardRoot') ctrlCard = kbButton.copyTo(kbButton) ctrlCard.setScale(2.0, 1, 1) ctrlCard.reparentTo(ctrlCardRoot) shiftCardRoot = NodePath('shiftCardRoot') shiftCard = kbButton.copyTo(kbButton) shiftCard.setScale(2.2000000000000002, 1, 1) shiftCard.reparentTo(shiftCardRoot) escapeCardRoot = NodePath('escapeCardRoot') escapeCard = kbButton.copyTo(kbButton) escapeCard.setScale(2.0, 1, 1) escapeCard.reparentTo(escapeCardRoot) oneCardRoot = NodePath('oneCardRoot') oneCard = kbButton.copyTo(kbButton) oneCard.reparentTo(oneCardRoot) questPageCard = kbButton.copyTo(kbButton) questPageCard.setScale(1.2) skillPageCardRoot = NodePath('skillCardRoot') skillPageCard = skButton.copyTo(skButton) skillPageCard.setScale(3.0) skillPageCard.setPos(0, 0, -0.10000000000000001) skillPageCard.reparentTo(skillPageCardRoot) weapon1Card = kbButton.copyTo(kbButton) weapon2Card = kbButton.copyTo(kbButton) lookoutCard = kbButton.copyTo(kbButton) mouseCard = nomButton.copyTo(nomButton) mouseCard.setScale(2) leftClickCard = lmButton.copyTo(lmButton) leftClickCard.setScale(2) chatSkullCard = csButton.copyTo(csButton) chatSkullCard.setScale(5) chatArrowCard = caButton.copyTo(caButton) rightClickCard = rmButton.copyTo(rmButton) rightClickCard.setScale(2) moveCard = kbButton.copyTo(kbButton) skillCardRoot = NodePath('skillCardRoot') skillGui = loader.loadModel('models/textureCards/skillIcons.bam') sweep = skillGui.findTexture('tutorial_sweep') skillCard = NodePath(cm.generate()) skillCard.setTexture(sweep) skillCard.setTransparency(TransparencyAttrib.MAlpha) skillCard.setScale(1.5) skillCard.setPos(0.0, 0, -2) skillCard.reparentTo(skillCardRoot) chestClosedCard = chestClosedButton.copyTo(chestClosedButton) chestClosedCard.setScale(5) chestOpenCard = chestOpenButton.copyTo(chestOpenButton) chestOpenCard.setScale(5) journalCardRoot = NodePath('journalCardRoot') journalCard = jnButton.copyTo(jnButton) journalCard.setScale(4) journalCard.reparentTo(journalCardRoot) tabText = DirectLabel(parent=tabCardRoot, relief=None, text=PLocalizer.TabKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999)) ctrlText = DirectLabel(parent=ctrlCardRoot, relief=None, text=PLocalizer.CtrlKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999)) shiftText = DirectLabel(parent=shiftCardRoot, relief=None, text=PLocalizer.ShiftKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999)) escapeText = DirectLabel(parent=escapeCardRoot, relief=None, text=PLocalizer.EscapeKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999)) oneText = DirectLabel(parent=oneCardRoot, relief=None, text=PLocalizer.OneKey, text_scale=1.0, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0.0, -0.14999999999999999)) questPageText = DirectLabel( parent=questPageCard, relief=None, text=PLocalizer.QuestPageKey, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_font=PiratesGlobals.getPirateFont(), text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.050000000000000003)) weapon1Text = DirectLabel(parent=weapon1Card, relief=None, text=PLocalizer.WeaponSlot1, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.14999999999999999)) weapon2Text = DirectLabel(parent=weapon2Card, relief=None, text=PLocalizer.WeaponSlot2, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.14999999999999999)) lookoutText = DirectLabel(parent=lookoutCard, relief=None, text=PLocalizer.LookoutPageKey, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.14999999999999999)) moveText = DirectLabel(parent=moveCard, relief=None, text=PLocalizer.ForwardMoveKey, text_scale=0.90000000000000002, text_align=TextNode.ACenter, text_fg=(0, 0, 0, 1), text_wordwrap=12, pos=(0.0, 0, -0.14999999999999999)) tpMgr.setGraphic('tabButton', tabCardRoot) tpMgr.setGraphic('ctrlButton', ctrlCardRoot) tpMgr.setGraphic('shiftButton', shiftCardRoot) tpMgr.setGraphic('escapeButton', escapeCardRoot) tpMgr.setGraphic('oneButton', oneCardRoot) tpMgr.setGraphic('chestClosedButton', chestClosedCard) tpMgr.setGraphic('chestOpenButton', chestOpenCard) tpMgr.setGraphic('questPageButton', questPageCard) tpMgr.setGraphic('skillPageButton', skillPageCardRoot) tpMgr.setGraphic('journalButton', journalCardRoot) tpMgr.setGraphic('cutlassEquip', weapon1Card) tpMgr.setGraphic('pistolEquip', weapon2Card) tpMgr.setGraphic('mouseIcon', mouseCard) tpMgr.setGraphic('leftClick', leftClickCard) tpMgr.setGraphic('rightClick', rightClickCard) tpMgr.setGraphic('moveKeys', moveCard) tpMgr.setGraphic('skillKey', skillCardRoot) tpMgr.setGraphic('lookoutKey', lookoutCard) tpMgr.setGraphic('chatSkull', chatSkullCard) tpMgr.setGraphic('chatArrow', chatArrowCard)
def load(self, parent = None): self.frame = BorderFrame(parent = parent, frameSize = (-0.55000000000000004, 0.55000000000000004, -0.125, 0.125), pos = (0, 0, -0.14999999999999999)) self.panelTitleText = DirectLabel(parent = self.frame, relief = None, text = self.panelTitle, text_scale = 0.070000000000000007, text_align = TextNode.ACenter, text_font = PiratesGlobals.getPirateFont(), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), pos = (0, 0, 0.025000000000000001)) self.instructionsText = DirectLabel(parent = self.frame, relief = None, text = self.instructions, text_scale = 0.050000000000000003, text_align = TextNode.ACenter, text_wordwrap = 40, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), pos = (0, 0, -0.029999999999999999)) self.frame.stash() self.openSfx = loadSfx(SoundGlobals.SFX_GUI_SHOW_PANEL) self.showPanelIval = Sequence(Wait(2.0), Func(self.frame.unstash), Func(base.playSfx, self.openSfx), LerpPosInterval(self.frame, 0.5, Point3(0, 0, -0.14999999999999999), startPos = Point3(0, 0, 0.5), blendType = 'easeOut'), Wait(self.duration), LerpPosInterval(self.frame, 0.5, Point3(0, 0, 0.5), startPos = Point3(0, 0, -0.14999999999999999), blendType = 'easeOut'), Func(self.frame.stash))
def displayStepChoices(self): DialogDict = DialogDict import pirates.quest.DialogTree self.choiceLabels = [] self.choiceButtons = [] gui = loader.loadModel('models/gui/compass_main') choiceIcon = gui.find('**/icon_sphere') for i in range(len(self.choices)): index = 0 process = DialogDict.get(self.npc.getUniqueId()).get(self.dialogId).get(self.choices[i])[index] while not isinstance(process, PlayerDialog): index += 1 process = DialogDict.get(self.npc.getUniqueId()).get(self.dialogId).get(self.choices[i])[index] while not process.avCanParticipate(localAvatar): index += 1 process = DialogDict.get(self.npc.getUniqueId()).get(self.dialogId).get(self.choices[i])[index] if process.avCanParticipate(localAvatar) and isinstance(process, PlayerDialog): choiceButton = GuiButton.GuiButton(parent = aspect2d, relief = None, text = self._StepChoice__getDialogChoiceText(self.choices[i], index), text_font = PiratesGlobals.getPirateFont(), text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = None, text_align = TextNode.ALeft, text_scale = 0.055, text0_fg = PiratesGuiGlobals.TextFG2, text1_fg = PiratesGuiGlobals.TextFG8, text2_fg = PiratesGuiGlobals.TextFG8, text3_fg = PiratesGuiGlobals.TextFG9, image = choiceIcon, image_scale = 0.29999999999999999, image_pos = (-0.050000000000000003, 0, 0.0070000000000000001), geom = None, pos = (-1.1499999999999999, 0, -0.47999999999999998 - i * 0.074999999999999997), command = self.buttonClicked, extraArgs = [ self.choices[i]]) choiceButton.setBin('gui-fixed', 1) choiceButton.bind(DGG.ENTER, self.highlightIcon, extraArgs = [ i]) choiceButton.bind(DGG.EXIT, self.unhighlightIcon, extraArgs = [ i]) self.choiceButtons.append(choiceButton) continue
def _initVisuals(self): RepairMincroGame._initVisuals(self) self.setBin('fixed', 36) self.model = loader.loadModel('models/gui/pir_m_gui_srp_sawing_main') sawModel = self.model.find('**/saw') sawModel.setR(193) sawModel.setPos(0.90000000000000002, 0.0, -0.16500000000000001) sawModel.setBin('gui-popup', 0) self.sawButton = RepairSaw(parent = self, clickDownCommand = self.sawAttachedToMouse, clickUpCommand = self.sawRemovedFromMouse, geom = sawModel, text_pos = (0.20000000000000001, -0.29999999999999999), text_fg = (1, 0, 0, 1), scale = (0.29999999999999999, 0.29999999999999999, 0.29999999999999999), relief = None, pressEffect = 0, frameSize = (-0.050000000000000003, 1.05, -0.29999999999999999, 0.050000000000000003), rolloverSound = None, clickSound = None) self.sawingLine = RepairSawingLine(self, self.config.sawlineLineThickness, self.config.sawlineColor, self.config.sawlineLinespawnDist) self.progressDescriptionLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Sawing_Description, text_fg = (1.0, 1.0, 1.0, 1.0), text_pos = (0.0, 0.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateFont(), text_align = TextNode.ARight, relief = None, scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.20000000000000001, 0.0, 0.5), parent = self) self.progressLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Sawing_Thresholds[3], text_fg = (1.0, 1.0, 1.0, 1.0), text_pos = (0.0, 0.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateFont(), text_align = TextNode.ALeft, relief = None, scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.17999999999999999, 0.0, 0.5), parent = self) self.boardDestroyedLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Sawing_Board_Destroyed, text_fg = (1.0, 0.0, 0.0, 1.0), text_pos = (0.0, 0.0), text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), relief = None, scale = (0.10000000000000001, 0.10000000000000001, 0.10000000000000001), pos = (0.0, 0.0, 0.10000000000000001), parent = self) self.boardDestroyedLabel.setBin('fixed', 38) self.boardDestroyedLabel.stash()
def setPanel(self, contextId, number, type, part): oldData = '%s%s%s' % (self.contextId, self.number, self.part) newData = '%s%s%s' % (contextId, number, part) if oldData == newData: return if self.titleLabels.has_key(oldData): self.titleLabels[oldData].hide() self.messageLabels[oldData].hide() self.contextId = contextId self.number = number self.part = part if self.titleLabels.has_key(newData): self.titleLabels[newData].show() self.messageLabels[newData].show() self.contextId = contextId else: title = '' message = '' if contextId == InventoryType.BuyNewShip: if number == 0: title = PLocalizer.ContextPanelTitles.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.MERCHANTL1] message = PLocalizer.ContextPanelMessages.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.MERCHANTL1] elif number == 1: title = PLocalizer.ContextPanelTitles.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.WARSHIPL1] message = PLocalizer.ContextPanelMessages.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.WARSHIPL1] elif number == 2: title = PLocalizer.ContextPanelTitles.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.INTERCEPTORL2] message = PLocalizer.ContextPanelMessages.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.INTERCEPTORL2] elif number == 3: title = PLocalizer.ContextPanelTitles.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.MERCHANTL2] message = PLocalizer.ContextPanelMessages.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.MERCHANTL2] elif number == 4: title = PLocalizer.ContextPanelTitles.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.WARSHIPL2] message = PLocalizer.ContextPanelMessages.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.WARSHIPL2] elif number == 5: title = PLocalizer.ContextPanelTitles.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.INTERCEPTORL3] message = PLocalizer.ContextPanelMessages.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.INTERCEPTORL3] elif number == 6: title = PLocalizer.ContextPanelTitles.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.MERCHANTL3] message = PLocalizer.ContextPanelMessages.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.MERCHANTL3] elif number == 7: title = PLocalizer.ContextPanelTitles.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.WARSHIPL3] message = PLocalizer.ContextPanelMessages.get( contextId) % PLocalizer.ShipClassNames[ ShipGlobals.WARSHIPL3] else: if number: title = PLocalizer.ContextPanelTitles.get(contextId).get( number) message = PLocalizer.ContextPanelMessages.get( contextId).get(number) else: title = PLocalizer.ContextPanelTitles.get(contextId) message = PLocalizer.ContextPanelMessages.get(contextId) if contextId == InventoryType.BrokenHull: if part == 1: title = title % PLocalizer.Left message = message % PLocalizer.Left else: title = title % PLocalizer.Right message = message % PLocalizer.Right else: if contextId == InventoryType.SearchableContainers: if part == 1: title = title % PLocalizer.ContextTutBuriedTreasure else: title = title % PLocalizer.ContextTutSearchableContainers else: if contextId == InventoryType.NewSkillPoint: if part == 1: title = title % PLocalizer.InventoryTypeNames[ InventoryType.CutlassRep] message = message % PLocalizer.InventoryTypeNames[ InventoryType.CutlassRep] elif part == 2: title = title % PLocalizer.InventoryTypeNames[ InventoryType.PistolRep] message = message % PLocalizer.InventoryTypeNames[ InventoryType.PistolRep] elif part == 3: title = title % PLocalizer.InventoryTypeNames[ InventoryType.DaggerRep] message = message % PLocalizer.InventoryTypeNames[ InventoryType.DaggerRep] elif part == 4: title = title % PLocalizer.InventoryTypeNames[ InventoryType.GrenadeRep] message = message % PLocalizer.InventoryTypeNames[ InventoryType.GrenadeRep] elif part == 5: title = title % PLocalizer.InventoryTypeNames[ InventoryType.WandRep] message = message % PLocalizer.InventoryTypeNames[ InventoryType.WandRep] elif part == 6: title = title % PLocalizer.InventoryTypeNames[ InventoryType.DollRep] message = message % PLocalizer.InventoryTypeNames[ InventoryType.DollRep] elif part == 7: title = title % PLocalizer.InventoryTypeNames[ InventoryType.CannonRep] message = message % PLocalizer.InventoryTypeNames[ InventoryType.CannonRep] elif part == 8: title = title % PLocalizer.InventoryTypeNames[ InventoryType.SailingRep] message = message % PLocalizer.InventoryTypeNames[ InventoryType.SailingRep] else: if contextId == InventoryType.DockCommands and number == 4: self.accept('space', self.closePanel) else: if contextId == InventoryType.ChatPreferences: if part == 1: message = message % PLocalizer.SpeedChatPlusPreferences else: message = message % PLocalizer.SpeedChatPreferences elif contextId == InventoryType.FishingTutorial: pass if not title: return False titleLabel = DirectLabel( parent=self, relief=None, text=title, text_align=TextNode.ACenter, text_scale=PiratesGuiGlobals. TextScaleExtraLarge, text_fg=(0.6, 0.0, 0.0, 1.0), text_font=PiratesGlobals. getPirateOutlineFont(), text_wordwrap=8, textMayChange=1, pos=(0.0, 0, 0.13)) messageLabel = DirectLabel( parent=self, relief=None, text=message, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleMed, text_fg=PiratesGuiGlobals.TextFG0, text_font=PiratesGlobals.getPirateFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_wordwrap=14, textMayChange=1, pos=(-0.2, 0, 0.07)) titleBounds = titleLabel.getBounds() messageBounds = messageLabel.getBounds() messageLabel.setZ(0.04 + titleBounds[2] - (messageBounds[3] + messageBounds[2]) * 0.5) if titleBounds[3] - titleBounds[2] > 0.09: messageLabel.setZ(messageLabel.getZ() + 0.0125) self.filled = True self.titleLabels[newData] = titleLabel self.messageLabels[newData] = messageLabel if self.noHintsLabels.has_key(self.type): self.noHintsLabels[self.type].hide() if self.noHintsLabels.has_key(type): if contextId in (InventoryType.ChatPreferences, InventoryType.CursedBlades): self.noHintsLabels[type].hide() self.noHintsCheck.hide() else: self.noHintsLabels[type].show() self.noHintsCheck.show() if self.noHintsLabels.has_key(self.type): self.noHintsLabels[self.type].hide() if contextId in (InventoryType.ChatPreferences, InventoryType.CursedBlades): text = '' text = PLocalizer.ContextPanelNoMoreHints % PLocalizer.ContextPanelTypes[ type] noHintsLabel = DirectLabel( parent=self, relief=None, text=text, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleSmall, text_fg=PiratesGuiGlobals.TextFG0, textMayChange=1, pos=(-0.14, 0, -0.12)) if contextId in (InventoryType.ChatPreferences, InventoryType.CursedBlades): self.noHintsCheck.hide() noHintsLabel.hide() self.noHintsCheck.show() noHintsLabel.show() self.noHintsLabels[type] = noHintsLabel self.type = type return True
def setPanel(self, contextId, number, type, part): oldData = "%s%s%s" % (self.contextId, self.number, self.part) newData = "%s%s%s" % (contextId, number, part) if oldData == newData: return None if self.titleLabels.has_key(oldData): self.titleLabels[oldData].hide() self.messageLabels[oldData].hide() self.contextId = contextId self.number = number self.part = part if self.titleLabels.has_key(newData): self.titleLabels[newData].show() self.messageLabels[newData].show() self.contextId = contextId else: title = "" message = "" if contextId == InventoryType.BuyNewShip: if number == 0: title = ( PLocalizer.ContextPanelTitles.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.MERCHANTL1] ) message = ( PLocalizer.ContextPanelMessages.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.MERCHANTL1] ) elif number == 1: title = ( PLocalizer.ContextPanelTitles.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.WARSHIPL1] ) message = ( PLocalizer.ContextPanelMessages.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.WARSHIPL1] ) elif number == 2: title = ( PLocalizer.ContextPanelTitles.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.INTERCEPTORL2] ) message = ( PLocalizer.ContextPanelMessages.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.INTERCEPTORL2] ) elif number == 3: title = ( PLocalizer.ContextPanelTitles.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.MERCHANTL2] ) message = ( PLocalizer.ContextPanelMessages.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.MERCHANTL2] ) elif number == 4: title = ( PLocalizer.ContextPanelTitles.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.WARSHIPL2] ) message = ( PLocalizer.ContextPanelMessages.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.WARSHIPL2] ) elif number == 5: title = ( PLocalizer.ContextPanelTitles.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.INTERCEPTORL3] ) message = ( PLocalizer.ContextPanelMessages.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.INTERCEPTORL3] ) elif number == 6: title = ( PLocalizer.ContextPanelTitles.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.MERCHANTL3] ) message = ( PLocalizer.ContextPanelMessages.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.MERCHANTL3] ) elif number == 7: title = ( PLocalizer.ContextPanelTitles.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.WARSHIPL3] ) message = ( PLocalizer.ContextPanelMessages.get(contextId) % PLocalizer.ShipClassNames[ShipGlobals.WARSHIPL3] ) elif number: title = PLocalizer.ContextPanelTitles.get(contextId).get(number) message = PLocalizer.ContextPanelMessages.get(contextId).get(number) else: title = PLocalizer.ContextPanelTitles.get(contextId) message = PLocalizer.ContextPanelMessages.get(contextId) if contextId == InventoryType.BrokenHull: if part == 1: title = title % PLocalizer.Left message = message % PLocalizer.Left else: title = title % PLocalizer.Right message = message % PLocalizer.Right elif contextId == InventoryType.SearchableContainers: if part == 1: title = title % PLocalizer.ContextTutBuriedTreasure else: title = title % PLocalizer.ContextTutSearchableContainers elif contextId == InventoryType.NewSkillPoint: if part == 1: title = title % PLocalizer.InventoryTypeNames[InventoryType.CutlassRep] message = message % PLocalizer.InventoryTypeNames[InventoryType.CutlassRep] elif part == 2: title = title % PLocalizer.InventoryTypeNames[InventoryType.PistolRep] message = message % PLocalizer.InventoryTypeNames[InventoryType.PistolRep] elif part == 3: title = title % PLocalizer.InventoryTypeNames[InventoryType.DaggerRep] message = message % PLocalizer.InventoryTypeNames[InventoryType.DaggerRep] elif part == 4: title = title % PLocalizer.InventoryTypeNames[InventoryType.GrenadeRep] message = message % PLocalizer.InventoryTypeNames[InventoryType.GrenadeRep] elif part == 5: title = title % PLocalizer.InventoryTypeNames[InventoryType.WandRep] message = message % PLocalizer.InventoryTypeNames[InventoryType.WandRep] elif part == 6: title = title % PLocalizer.InventoryTypeNames[InventoryType.DollRep] message = message % PLocalizer.InventoryTypeNames[InventoryType.DollRep] elif part == 7: title = title % PLocalizer.InventoryTypeNames[InventoryType.CannonRep] message = message % PLocalizer.InventoryTypeNames[InventoryType.CannonRep] elif part == 8: title = title % PLocalizer.InventoryTypeNames[InventoryType.SailingRep] message = message % PLocalizer.InventoryTypeNames[InventoryType.SailingRep] elif contextId == InventoryType.DockCommands and number == 4: self.accept("space", self.closePanel) elif contextId == InventoryType.ChatPreferences: if part == 1: message = message % PLocalizer.SpeedChatPlusPreferences else: message = message % PLocalizer.SpeedChatPreferences elif contextId == InventoryType.FishingTutorial: pass if not title: return False titleLabel = DirectLabel( parent=self, relief=None, text=title, text_align=TextNode.ACenter, text_scale=PiratesGuiGlobals.TextScaleExtraLarge, text_fg=(0.59999999999999998, 0.0, 0.0, 1.0), text_font=PiratesGlobals.getPirateOutlineFont(), text_wordwrap=8, textMayChange=1, pos=(0.0, 0, 0.13), ) messageLabel = DirectLabel( parent=self, relief=None, text=message, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleMed, text_fg=PiratesGuiGlobals.TextFG0, text_font=PiratesGlobals.getPirateFont(), text_shadow=PiratesGuiGlobals.TextShadow, text_wordwrap=14, textMayChange=1, pos=(-0.20000000000000001, 0, 0.070000000000000007), ) titleBounds = titleLabel.getBounds() messageBounds = messageLabel.getBounds() messageLabel.setZ(0.040000000000000001 + titleBounds[2] - (messageBounds[3] + messageBounds[2]) * 0.5) if titleBounds[3] - titleBounds[2] > 0.089999999999999997: messageLabel.setZ(messageLabel.getZ() + 0.012500000000000001) self.filled = True self.titleLabels[newData] = titleLabel self.messageLabels[newData] = messageLabel if self.noHintsLabels.has_key(self.type): self.noHintsLabels[self.type].hide() if self.noHintsLabels.has_key(type): if contextId in (InventoryType.ChatPreferences, InventoryType.CursedBlades): self.noHintsLabels[type].hide() self.noHintsCheck.hide() else: self.noHintsLabels[type].show() self.noHintsCheck.show() elif self.noHintsLabels.has_key(self.type): self.noHintsLabels[self.type].hide() if contextId in (InventoryType.ChatPreferences, InventoryType.CursedBlades): text = "" else: text = PLocalizer.ContextPanelNoMoreHints % PLocalizer.ContextPanelTypes[type] noHintsLabel = DirectLabel( parent=self, relief=None, text=text, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleSmall, text_fg=PiratesGuiGlobals.TextFG0, textMayChange=1, pos=(-0.14000000000000001, 0, -0.12), ) if contextId in (InventoryType.ChatPreferences, InventoryType.CursedBlades): self.noHintsCheck.hide() noHintsLabel.hide() else: self.noHintsCheck.show() noHintsLabel.show() self.noHintsLabels[type] = noHintsLabel self.type = type return True
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 createGui(self): self.destroyGui() box = loader.loadModel("models/gui/gui_title_box").find("**/gui_title_box_top") box.setPos(0.54000000000000004, 0, 1.3600000000000001) box.setScale(0.25) box.reparentTo(self) box.flattenStrong() if not self.charGui: self.charGui = loader.loadModel("models/gui/char_gui") self.title = DirectLabel( parent=self, relief=None, text=self.titleText, text_fg=PiratesGuiGlobals.TextFG1, text_font=PiratesGlobals.getPirateFont(), text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_shadow=PiratesGuiGlobals.TextShadow, pos=(self.width * 0.5, 0, 1.343), ) self.tabBackParent = self.attachNewNode("tabBackParent") self.tabBackParent.setZ(1.1100000000000001) self.scrollFrame = DirectScrolledFrame( parent=self, relief=None, state=DGG.NORMAL, manageScrollBars=0, autoHideScrollBars=1, frameSize=(0.050000000000000003, self.width - 0.10000000000000001, 0.14000000000000001, self.height - 0.25), canvasSize=( 0.050000000000000003, self.width - 0.10000000000000001, 0.14000000000000001, self.height - 0.25, ), verticalScroll_relief=None, verticalScroll_image=self.charGui.find("**/chargui_slider_small"), verticalScroll_frameSize=( 0.0, PiratesGuiGlobals.ScrollbarSize, 0.14199999999999999, self.height - 0.26000000000000001, ), verticalScroll_image_scale=(self.height - 0.29999999999999999, 1, 0.75), verticalScroll_image_hpr=(0, 0, 90), verticalScroll_image_pos=( self.width - PiratesGuiGlobals.ScrollbarSize * 0.5 - 0.059999999999999998, 0, self.height * 0.46000000000000002, ), verticalScroll_image_color=(0.60999999999999999, 0.59999999999999998, 0.59999999999999998, 1), verticalScroll_thumb_image=( self.charGui.find("**/chargui_slider_node"), self.charGui.find("**/chargui_slider_node_down"), self.charGui.find("**/chargui_slider_node_over"), ), verticalScroll_thumb_relief=None, verticalScroll_thumb_image_scale=0.40000000000000002, verticalScroll_thumb_image_pos=(-0.0050000000000000001, 0, 0), verticalScroll_resizeThumb=0, horizontalScroll_relief=None, ) self.scrollFrame.verticalScroll.incButton.destroy() self.scrollFrame.verticalScroll.decButton.destroy() self.scrollFrame.horizontalScroll.incButton.destroy() self.scrollFrame.horizontalScroll.decButton.destroy() self.scrollFrame.horizontalScroll.hide() self.accept("press-wheel_up-%s" % self.scrollFrame.guiId, self.mouseWheelUp) self.accept("press-wheel_down-%s" % self.scrollFrame.guiId, self.mouseWheelDown) self.tabFrontParent = self.attachNewNode("tabFrontParent") self.tabFrontParent.setZ(1.1100000000000001) frameSize = ( self.scrollFrame["frameSize"][0] + 0.01, self.scrollFrame["frameSize"][1] + 0.040000000000000001, self.scrollFrame["frameSize"][2] - 0.01, self.scrollFrame["frameSize"][3], ) self.repackScrollFrame() self.border = BorderFrame( parent=self.scrollFrame, state=DGG.DISABLED, modelName="general_frame_f", frameSize=frameSize, borderScale=0.14999999999999999, showBackground=True, bgColorScale=VBase4(0, 0, 0, 1), sortOrder=-1, ) gui = loader.loadModel("models/gui/toplevel_gui") geomX = gui.find("**/generic_x") self.closeButton = GuiButton.GuiButton( parent=self, pos=(self.width / 2.0, 0, 0.070000000000000007), text=PLocalizer.TableLeave, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.035000000000000003, -0.014), textMayChange=0, geom=(geomX,) * 4, geom_pos=(-0.059999999999999998, 0, 0), geom_scale=0.5, geom0_color=PiratesGuiGlobals.ButtonColor3[0], geom1_color=PiratesGuiGlobals.ButtonColor3[1], geom2_color=PiratesGuiGlobals.ButtonColor3[2], geom3_color=PiratesGuiGlobals.ButtonColor3[3], image3_color=(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), command=self.closePanel, ) self.shipBar = ShipTabBar(self.tabBackParent, self.tabFrontParent, parent=self) for t in self.pages: self.addTab(t) self.refreshTabStates()
def __init__(self, shipPage, shipId, **kwargs): self.shipPage = shipPage self.emptyBottle = True self.setShipId(shipId) self.timer = None self.lBroadsideLimit = 0 self.rBroadsideLimit = 0 kwargs.setdefault('relief', None) kwargs.setdefault('frameSize', (0, self.Width, 0, self.Height)) DirectFrame.__init__(self, **kwargs) self.initialiseoptions(ShipPanel) gui = loader.loadModel('models/gui/toplevel_gui') inventoryGui = loader.loadModel('models/gui/gui_icons_inventory') chestIcon = inventoryGui.find('**/pir_t_ico_trs_chest_01*') cannonIcon = gui.find('**/topgui_icon_ship_cannon_single') skillIcons = loader.loadModel('models/textureCards/skillIcons') broadsideId = InventoryType.CannonRoundShot ammoIconName = WeaponGlobals.getSkillIcon(broadsideId) broadsideIcon = skillIcons.find('**/%s' % ammoIconName) crewIcon = (gui.find('**/pir_t_gui_gen_friends_pirates'), ) self.bottleFrame = ShipFrameBottle(parent=self, shipId=shipId, relief=None, state=DGG.DISABLED, pos=(0.075, 0, 0.75), scale=0.835) gui = loader.loadModel('models/gui/gui_ship_window') bottleImage = gui.find('**/ship_bottle') self.shipBottle = DirectLabel(parent=self.bottleFrame, relief=None, state=DGG.DISABLED, geom=bottleImage, geom_scale=0.3, geom_pos=(0, 0, 0), pos=(0.5, 0, -0.0)) self.nameLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottle, 2), text_fg=PiratesGuiGlobals.TextFG1, text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_align=TextNode.ACenter, text_shadow=(0, 0, 0, 1), text_wordwrap=30, textMayChange=1, text_font=PiratesGlobals.getPirateFont(), pos=(0.55, 0, 1.22)) self.classLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottleDesc, 1), text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ACenter, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), text_wordwrap=30, textMayChange=1, text_font=PiratesGlobals.getInterfaceFont(), pos=(0.55, 0, 1.18)) self.timer = PiratesTimer.PiratesTimer(showMinutes=True, mode=None, titleText='', titleFg='', infoText='', cancelText='', cancelCallback=None) self.timer.setFontColor(PiratesGuiGlobals.TextFG2) self.timer.reparentTo(self) self.timer.setPos(0.45, 0, 0.94) self.timer.setScale(0.6) self.timer.stash() self.hpMeter = DirectWaitBar(parent=self, relief=DGG.RAISED, state=DGG.DISABLED, range=1, value=0, frameColor=(0.0, 0.0, 0.0, 0.0), barColor=(0.1, 0.7, 0.1, 1), frameSize=(0, 0.31, 0, 0.0186), text='', text_align=TextNode.ARight, text_scale=0.03, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.3, 0.03), pos=(0.55, 0.0, 0.45), scale=1.2) hpLabel = DirectLabel(parent=self.hpMeter, relief=None, state=DGG.DISABLED, text=PLocalizer.HP, text_scale=0.03, text_align=TextNode.ALeft, text_pos=(0.015, 0.03), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.speedMeter = DirectWaitBar(parent=self, relief=DGG.RAISED, state=DGG.DISABLED, range=1, value=0, frameColor=(0.0, 0.0, 0.0, 0.0), barColor=(0.7, 0.7, 0.1, 1), frameSize=(0, 0.31, 0, 0.0186), text='', text_align=TextNode.ARight, text_scale=0.03, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.3, 0.03), pos=(0.55, 0.0, 0.35), scale=1.2) speedLabel = DirectLabel(parent=self.speedMeter, relief=None, state=DGG.DISABLED, text=PLocalizer.Sails, text_scale=0.03, text_align=TextNode.ALeft, text_pos=(0.015, 0.03), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.customHullLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.15, geom_pos=(0, 0, 0), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=(0, -0.07), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.35, 0, 0.68)) self.customHullLabel.hide() self.customRiggingLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.15, geom_pos=(0, 0, 0), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=(0, -0.07), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.75, 0, 0.68)) self.customRiggingLabel.hide() textPos = (0.0, -0.16) self.plunderLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.1, geom_pos=(0, 0, -0.05), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.2, 0, 0.2)) plunderLabel = DirectLabel(parent=self.plunderLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Cargo, text_scale=0.036, text_align=TextNode.ACenter, text_pos=(0, 0.04), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.cannonLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=cannonIcon, geom_scale=0.45, geom_pos=(0, 0, -0.05), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.37, 0, 0.2)) cannonLabel = DirectLabel(parent=self.cannonLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Cannon, text_scale=0.036, text_align=TextNode.ACenter, text_pos=(0, 0.04), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.cannonLabel = cannonLabel self.broadsideLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=broadsideIcon, geom_scale=0.15, geom_pos=(0, 0, -0.05), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.81, 0, 0.2)) broadsideLabel = DirectLabel(parent=self.broadsideLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Broadsides, text_scale=0.036, text_align=TextNode.ACenter, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.0, 0.04)) self.broadsideLabel = broadsideLabel self.crewLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=crewIcon, geom_scale=0.4, geom_pos=(0, 0, 0.1), text='', text_scale=0.045, text_align=TextNode.ACenter, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.56, 0, 0.04)) crewLabel = DirectLabel(parent=self.crewLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Crew, text_scale=0.036, text_align=TextNode.ACenter, text_pos=(0.0, 0.2), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.crewLabel = crewLabel shipOV = base.cr.getOwnerView(self.shipId) if shipOV: self.setShipName(shipOV.name) self.setShipClass(shipOV.shipClass) self.setShipHp(shipOV.Hp, shipOV.maxHp) self.setShipSp(shipOV.Sp, shipOV.maxSp) self.setShipCrew(shipOV.crew, shipOV.maxCrew) self.setShipCargo([], shipOV.maxCargo) if hasattr(shipOV, 'cannonConfig'): self.setShipMaxCannons(shipOV.cannonConfig) self.setShipMaxBroadside(shipOV.lBroadsideConfig, shipOV.rBroadsideConfig) self.updateIcons() if self.emptyBottle: self.hpMeter.hide() self.speedMeter.hide() self.plunderLimit.hide() self.cannonLimit.hide() self.broadsideLimit.hide() self.crewLimit.hide() self.accept('setName-%s' % self.shipId, self.setShipName) self.accept('setShipClass-%s' % self.shipId, self.setShipClass) self.accept('setShipHp-%s' % self.shipId, self.setShipHp) self.accept('setShipSp-%s' % self.shipId, self.setShipSp) self.accept('setShipCargo-%s' % self.shipId, self.setShipCargo) self.accept('setShipCrew-%s' % self.shipId, self.setShipCrew) self.accept('setShipTimer-%s' % self.shipId, self.setShipTimer) self.accept('setHullCannonConfig-%s' % self.shipId, self.setShipMaxCannons) self.accept('setHullLeftBroadsideConfig-%s' % self.shipId, self.setShipMaxLeftBroadside) self.accept('setHullRightBroadsideConfig-%s' % self.shipId, self.setShipMaxRightBroadside) self.accept('ShipChanged-%s' % self.shipId, self.handleShipChanged) if base.config.GetBool('want-deploy-button', 0): pass return
def __init__(self, panelName, gameTitle, instructions): BorderFrame.__init__(self, parent = base.a2dBottomCenter, frameSize = (-1, 1, 0, 0.29999999999999999), pos = (0, 0, 0.5), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75)) self.initialiseoptions(PVPRulesPanel) self.secondLayer = BorderFrame(parent = self, frameSize = (-1, 1, 0, 0.29999999999999999), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75)) self.gameTitle = gameTitle self.instructions = instructions self.gameTitleText = DirectLabel(parent = self, relief = None, text = self.gameTitle, text_scale = 0.059999999999999998, text_align = TextNode.ALeft, text_font = PiratesGlobals.getPirateFont(), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), pos = (-0.95999999999999996, 0, 0.23000000000000001)) self.instructionsText = DirectLabel(parent = self, relief = None, text = self.instructions, text_scale = 0.050000000000000003, text_align = TextNode.ALeft, text_wordwrap = 40, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), pos = (-0.95999999999999996, 0, 0.14000000000000001))