def __init__(self, title, x, y, width, height): self.popupDialog = None self.feedbackPanel = None self.gameOptions = None DirectFrame.__init__(self, relief=None, image=loader.loadModel('models/misc/fade'), image_scale=(5, 2, 2), image_color=(0, 0, 0, 0.29999999999999999), image_pos=(0.5, 0, 0.80000000000000004), state=DGG.NORMAL, pos=(x, 0.0, y), sortOrder=20) self.initialiseoptions(MainMenu) self.setBin('gui-fixed', 5) self.model = loader.loadModel('models/gui/avatar_chooser_rope') self.parentFrame = DirectFrame(parent=self, pos=(0, 0, 1.2)) self.ropeFrame = DirectFrame( parent=self.parentFrame, relief=None, image=self.model.find('**/avatar_c_A_rope'), image_scale=0.35999999999999999, pos=(0.51800000000000002, 0, 1.5800000000000001)) self.ropeFrame2 = DirectFrame( parent=self.parentFrame, relief=None, image=self.model.find('**/avatar_c_A_rope'), image_scale=0.35999999999999999, pos=(1.0760000000000001, 0, 1.5800000000000001)) self.logo = loader.loadModel('models/gui/potcLogo') self.logo.reparentTo(self.parentFrame) self.logo.setPos(width / 2.0, 0, height - 0.14999999999999999) self.logo.setScale(0.90000000000000002) self.buttons = [] hotkeys = [''] hotkeyConfig = getBase().config.GetString('want-menu-hotkeys', '') if hotkeyConfig and '%' not in hotkeyConfig: hotkeyConfig = 'f%s' buttonCount = 0 if hotkeyConfig: hotkeys = ['esc'] buttonCount += 1 self.returnButton = GuiButton( parent=self.logo, relief=None, text_scale=PiratesGuiGlobals.TextScaleExtraLarge, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text=PLocalizer.MainMenuReturn, image=(self.model.find('**/avatar_c_A_top'), self.model.find('**/avatar_c_A_top'), self.model.find('**/avatar_c_A_top_over')), image_scale=0.40000000000000002, text_pos=(0, -0.02), pos=(0, 0, -0.45000000000000001), command=self._MainMenu__handleReturn, hotkeys=hotkeys, hotkeyLabel=hotkeys[0], hotkeyLabelX=0.20000000000000001, hotkeyArgs=False) self.buttons.append(self.returnButton) if hotkeyConfig: hotkeys = [hotkeyConfig % (buttonCount, )] buttonCount += 1 self.optionsButton = GuiButton( parent=self.logo, relief=None, text_scale=PiratesGuiGlobals.TextScaleExtraLarge, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text=PLocalizer.MainMenuOptions, image=(self.model.find('**/avatar_c_A_middle'), self.model.find('**/avatar_c_A_middle'), self.model.find('**/avatar_c_A_middle_over')), image_scale=0.40000000000000002, text_pos=(0, -0.014999999999999999), pos=(0, 0, -0.56399999999999995), command=self._MainMenu__handleOptions, hotkeys=hotkeys, hotkeyLabel=hotkeys[0], hotkeyLabelX=0.20000000000000001, hotkeyArgs=False) self.buttons.append(self.optionsButton) if hotkeyConfig: hotkeys = [hotkeyConfig % (buttonCount, )] buttonCount += 1 self.feedbackButton = GuiButton( parent=self.logo, relief=None, text_scale=PiratesGuiGlobals.TextScaleExtraLarge, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text=PLocalizer.MainMenuFeedback, image=(self.model.find('**/avatar_c_A_middle'), self.model.find('**/avatar_c_A_middle'), self.model.find('**/avatar_c_A_middle_over')), image_scale=0.40000000000000002, text_pos=(0, -0.014999999999999999), pos=(0, 0, -0.67000000000000004), command=self._MainMenu__loadFeedbackPanel, hotkeys=hotkeys, hotkeyLabel=hotkeys[0], hotkeyLabelX=0.20000000000000001, hotkeyArgs=False) self.buttons.append(self.feedbackButton) self.buttonZ = -0.67000000000000004 magicWordConfig = getBase().config.GetString('want-menu-magic', '') if magicWordConfig: self.magicButtons = [] magicWords = _[1] magicWords = [ choice(mw[0] == '~', mw, '~%s' % mw) for mw in magicWords ] for mw in magicWords: if hotkeyConfig: hotkeys = [hotkeyConfig % (buttonCount, )] buttonCount += 1 self.buttonZ = self.buttonZ - 0.106 self.magicButtons.append( GuiButton( parent=self.logo, relief=None, text_scale=PiratesGuiGlobals.TextScaleExtraLarge, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text=mw, image=(self.model.find('**/avatar_c_A_middle'), self.model.find('**/avatar_c_A_middle'), self.model.find('**/avatar_c_A_middle_over')), image_scale=0.40000000000000002, text_pos=(0, -0.014999999999999999), pos=(0, 0, self.buttonZ), command=lambda mw=mw: self._MainMenu__handleMagic(mw), hotkeys=hotkeys, hotkeyLabel=hotkeys[0], hotkeyLabelX=0.20000000000000001, hotkeyArgs=False)) self.buttons.extend(self.magicButtons) if hotkeyConfig: hotkeys = [hotkeyConfig % (buttonCount, )] buttonCount += 1 self.buttonZ = self.buttonZ - 0.106 self.logoutButton = GuiButton( parent=self.logo, relief=None, text_scale=PiratesGuiGlobals.TextScaleExtraLarge, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text=PLocalizer.MainMenuLogout, image=(self.model.find('**/avatar_c_A_middle'), self.model.find('**/avatar_c_A_middle'), self.model.find('**/avatar_c_A_middle_over')), image_scale=0.40000000000000002, text_pos=(0, -0.014999999999999999), pos=(0, 0, self.buttonZ), command=self._MainMenu__handleLogout, hotkeys=hotkeys, hotkeyLabel=hotkeys[0], hotkeyLabelX=0.20000000000000001, hotkeyArgs=False) self.buttons.append(self.logoutButton) if hotkeyConfig: hotkeys = [hotkeyConfig % (buttonCount, )] buttonCount += 1 self.buttonZ = self.buttonZ - 0.157 self.quitButton = GuiButton( parent=self.logo, relief=None, text_scale=PiratesGuiGlobals.TextScaleExtraLarge, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text=PLocalizer.MainMenuQuit, image=(self.model.find('**/avatar_c_A_bottom'), self.model.find('**/avatar_c_A_bottom'), self.model.find('**/avatar_c_A_bottom_over')), image_scale=0.40000000000000002, text_pos=(0, 0.035000000000000003), pos=(0, 0, self.buttonZ), command=self._MainMenu__handleQuit, hotkeys=hotkeys, hotkeyLabel=hotkeys[0], hotkeyLabelX=0.20000000000000001, hotkeyArgs=False) self.buttons.append(self.quitButton) self.barFrame = DirectFrame( parent=self.logo, relief=None, image=self.model.find('**/avatar_c_B_frame'), image_scale=0.34999999999999998, pos=(0, 0, -0.34999999999999998)) self.showMenuIval = None self.hideMenuIval = None self.buildShowHideMenuIvals() self.menuSfx = loadSfx(SoundGlobals.SFX_GUI_SHOW_PANEL) self.menuSfx.setVolume(0.40000000000000002)
def __init__(self, parent, parentMgr, **kw): GuiTray.GuiTray.__init__(self, parent, 0.6, 0.12, **kw) self.initialiseoptions(ChestTray) self.setBin('gui-fixed', 0) self.state = 0 self.buttonsParent = self.attachNewNode( ModelNode('ChestTray.buttonsParent'), sort=1) self.stickyButtonsParent = self.attachNewNode( ModelNode('ChestTray.stickyButtonsParent'), sort=1) self.stickyButtonsParent.setPos(0, 0, 0.02) self.buttons = {} self.buildShowHideButtonsIvals() self.openSfx = loadSfx(SoundGlobals.SFX_GUI_OPEN_SEACHEST) self.openSfx.setVolume(0.4) self.closeSfx = loadSfx(SoundGlobals.SFX_GUI_CLOSE_SEACHEST) self.closeSfx.setVolume(0.4) gui = loader.loadModel('models/gui/toplevel_gui') gui_main = loader.loadModel('models/gui/gui_main') helpPos = (-0.26, 0, 0.06) helpDelay = 0 self.buttonImage = gui.find('**/topgui_icon_box') self.buttonImageIn = gui.find('**/topgui_icon_box_in') self.buttonColors = (VBase4(0.7, 0.7, 0.7, 1), VBase4(0.8, 0.8, 0.8, 1), VBase4(1.0, 1.0, 1.0, 1), VBase4(0.6, 0.6, 0.6, 1)) self.currentButtonIn = None self.highlightButtons = [ 'guiMgrToggleMap', 'guiMgrToggleWeapons', 'guiMgrToggleQuest', 'guiMgrToggleLevels', 'guiMgrToggleShips', 'guiMgrToggleTreasures', 'guiMgrToggleLookout', 'guiMgrToggleInventory', 'guiMgrToggleTitles' ] buttonOptions = { 'image': self.buttonImage, 'geom': None, 'relief': None, 'frameSize': (0, 0.12, 0, 0.12), 'image_scale': 0.47, 'image_pos': (0.06, 0, 0.06), 'image0_color': self.buttonColors[0], 'image1_color': self.buttonColors[1], 'image2_color': self.buttonColors[2], 'image3_color': self.buttonColors[3], 'geom_scale': 0.12, 'geom_pos': (0.06, 0, 0.06), 'command': self.togglePanel } extraHeight = 0 if self.WantTitlesPage: extraHeight = 0.12 buttonOptions['geom'] = gui.find('**/friend_button_over') buttonOptions['geom_scale'] = 0.12 self.socialButton = GuiButton(parent=self.buttonsParent, hotkeys=['f', 'shift-f'], hotkeyLabel='F', helpText=PLocalizer.SocialButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleSocial'], pos=(0.01, 0, 1.16 + extraHeight), **buttonOptions) self.buttons['guiMgrToggleSocial'] = self.socialButton buttonOptions['geom'] = gui.find('**/compass_small_button_open_over') buttonOptions['geom_scale'] = 0.09 self.radarButton = GuiButton(parent=self.buttonsParent, hotkeys=['c', 'shift-c'], hotkeyLabel='C', helpText=PLocalizer.RadarButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleRadar'], pos=(0.01, 0, 1.04 + extraHeight), **buttonOptions) self.buttons['guiMgrToggleRadar'] = self.radarButton buttonPosZ = 0.88 buttonHeight = 0.12 if self.WantTitlesPage: buttonPosZ += buttonHeight buttonOptions['geom'] = gui_main.find('**/world_map_icon') buttonOptions['geom_scale'] = 0.095 self.mapButton = GuiButton(parent=self.buttonsParent, hotkeys=['m', 'shift-m'], hotkeyLabel='M', helpText=PLocalizer.MapButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleMap'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleMap'] = self.mapButton buttonPosZ -= buttonHeight self.highlightButton('guiMgrToggleMap') buttonOptions['geom'] = (gui.find('**/treasure_chest_closed_over'), ) buttonOptions['geom_scale'] = 0.12 self.bagButton = GuiButton(parent=self.buttonsParent, hotkeys=['i', 'shift-i'], hotkeyLabel='I', helpText=PLocalizer.SocialButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleInventory'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleInventory'] = self.bagButton buttonPosZ -= buttonHeight buttonOptions['geom'] = gui.find('**/topgui_icon_weapons') buttonOptions['geom_scale'] = 0.18 self.weaponButton = GuiButton(parent=self.buttonsParent, hotkeys=['y', 'shift-y'], hotkeyLabel='Y', helpText=PLocalizer.WeaponButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleWeapons'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleWeapons'] = self.weaponButton buttonPosZ -= buttonHeight buttonOptions['geom'] = gui.find('**/topgui_icon_skills') buttonOptions['geom_scale'] = 0.18 self.levelButton = GuiButton(parent=self.buttonsParent, hotkeys=['k', 'shift-k'], hotkeyLabel='K', helpText=PLocalizer.SkillButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleLevels'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleLevels'] = self.levelButton buttonPosZ -= buttonHeight if self.WantClothingPage: buttonOptions['geom'] = gui.find('**/topgui_icon_clothing') buttonOptions['geom_scale'] = 0.17 self.clothingButton = GuiButton( parent=self.buttonsParent, helpText=PLocalizer.ClothingButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleClothing'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleClothing'] = self.clothingButton buttonPosZ -= buttonHeight if self.WantTitlesPage: buttonOptions['geom'] = gui.find('**/topgui_infamy_frame') buttonOptions['geom_scale'] = 0.2 self.titlesButton = GuiButton(parent=self.buttonsParent, hotkeys=['b', 'shift-b'], hotkeyLabel='B', helpText=PLocalizer.TitlesButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleTitles'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleTitles'] = self.titlesButton buttonPosZ -= buttonHeight buttonOptions['geom'] = gui.find('**/topgui_icon_ship') buttonOptions['geom_scale'] = 0.2 self.shipsButton = GuiButton(parent=self.buttonsParent, hotkeys=['h', 'shift-h'], hotkeyLabel='H', helpText=PLocalizer.ShipsButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleShips'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleShips'] = self.shipsButton buttonPosZ -= buttonHeight buttonOptions['geom'] = gui.find('**/topgui_icon_journal') buttonOptions['geom_scale'] = 0.18 self.questButton = GuiButton(parent=self.buttonsParent, hotkeys=['j', 'shift-j'], hotkeyLabel='J', helpText=PLocalizer.QuestButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleQuest'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleQuest'] = self.questButton buttonPosZ -= buttonHeight self.lookoutButtonNormal = gui.find('**/telescope_button') self.lookoutButtonLight = gui.find('**/telescope_button_over') self.lookoutButtonSearch3o = gui.find('**/lookout_icon_over_03') buttonOptions['geom'] = None self.lookoutButton = GuiButton(parent=self.buttonsParent, hotkeys=['l', 'shift-l'], hotkeyLabel='L', helpText=PLocalizer.LookoutButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleLookout'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleLookout'] = self.lookoutButton buttonPosZ -= buttonHeight self.lookoutButtonImage = OnscreenImage( parent=self.stickyButtonsParent, image=self.lookoutButtonLight, scale=0.3, pos=(0.065, 0.0, 0.215)) self.lookoutButtonImage.sourceImage = self.lookoutButtonLight buttonOptions['geom'] = gui.find('**/topgui_icon_main_menu') buttonOptions['geom_scale'] = 0.18 self.mainMenuButton = GuiButton( parent=self.buttonsParent, hotkeys=[PiratesGlobals.OptionsHotkey, 'escape'], hotkeyLabel='F7', helpText=PLocalizer.QuestButtonHelp, helpPos=helpPos, helpDelay=helpDelay, extraArgs=['guiMgrToggleMainMenu'], pos=(0.01, 0, buttonPosZ), **buttonOptions) self.buttons['guiMgrToggleMainMenu'] = self.mainMenuButton buttonPosZ -= buttonHeight self.chestButtonClosed = (gui.find('**/treasure_chest_closed'), gui.find('**/treasure_chest_closed'), gui.find('**/treasure_chest_closed_over')) self.chestButtonOpen = gui.find('**/treasure_chest_open_over') self.chestButton = GuiButton(command=self.toggle, parent=self, relief=None, image=self.chestButtonClosed, image_scale=0.15, image_pos=(0.05, 0, 0.06), scale=1.2) self.chestHotkeyText = DirectLabel( parent=self.chestButton, relief=None, text='Tab', text_align=TextNode.ARight, text_scale=PiratesGuiGlobals.TextScaleSmall, text_pos=(0.11, 0.0), text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text_font=PiratesGlobals.getPirateBoldOutlineFont(), textMayChange=1) self.buttonsParent.hide() self.buttonsParent.setPos(0.2, 0, 0.14) self.stickyButtonsParent.hide() self.stickyButtonsParent.setPos(0.2, 0, 0.14) gui.removeNode() return
def __init__(self, potionGame): self.potionGame = potionGame DirectFrame.__init__(self, parent=potionGame.dialogs, relief=None) self.setPos((-0.5, 0, 0.074999999999999997)) guiAssets = loader.loadModel( 'models/minigames/pir_m_gui_pot_textureCard') parch = guiAssets.find('**/pir_t_gui_pot_potionIngredients') parch.setScale(3.4500000000000002, 1, 3.4500000000000002) parch.setPos(0.5, 0, -0.02) self.background = parch.copyTo(self) self.bQuit = GuiButton( image=(guiAssets.find('**/pir_t_gui_pot_exitIngredients'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredients')), scale=(0.29999999999999999, 0.29999999999999999, 0.29999999999999999), command=self.quit) self.bQuit.reparentTo(self) self.bQuit.setPos(1.673, 0, 0.76700000000000002) self.messageText = PLocalizer.PotionGui['InfoText'] self.message = DirectLabel( parent=self, relief=None, text=self.messageText, text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_align=TextNode.ARight, text_fg=PotionGlobals.TextColor, text_shadow=None, pos=(-0.17000000000000001, 0, 0.71999999999999997), textMayChange=0) self.pieces = [] self.pieceLabels = [] for color in range(6): for level in range(6): piece = PotionBoardPiece(self, color, level + 1) piece.setPiecePosition( level * 0.112 - 0.27700000000000002, 0.17000000000000001 - color * 0.070900000000000005) piece.background.setDepthTest(False) piece.background.setDepthWrite(False) piece.setScale(0.34999999999999998) self.pieces.append(piece) piecelabel = DirectLabel( parent=self, relief=None, text=PLocalizer.PotionIngredients[color][level], text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ACenter, text_fg=PotionGlobals.TextColor, text_shadow=None, pos=(level * 0.38600000000000001 - 0.45200000000000001, 0, 0.438 - color * 0.245), textMayChange=0) self.message = DirectLabel( parent=self, relief=None, text=PLocalizer.PotionIngredients[color][level], text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ACenter, text_fg=PotionGlobals.TextColor, text_shadow=None, pos=(level * 0.38600000000000001 - 0.45200000000000001, 0, 0.438 - color * 0.245), textMayChange=0) self.pieceLabels.append(piecelabel) guiAssets.removeNode()
def _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, table): DirectFrame.__init__(self, relief=None) self.initialiseoptions(BlackjackTableGUI) self.table = table self.destroyed = False self.maxHandCards = 14 self.playerStatusPanels = [] for i in range(self.table.NumSeats + 1): statusPanel = BlackjackStatusPanel(self.maxHandCards) statusPanel.setName('playerHand-%s' % i) pos = self.HandPos[i] statusPanel.setPos(pos) self.playerStatusPanels.append(statusPanel) self.localStatusPanel = self.playerStatusPanels[ self.LocalAvatarGuiIndex] width = 1.0 height = 0.25 self.menu = BorderFrame(parent=base.a2dBottomCenter, frameSize=(-width / 2.0, width / 2.0, 0, height), pos=(0, 0, 0)) self.width = width self.height = height self.initializeTableInterface() x = -0.35999999999999999 y = 0.17749999999999999 x_increment = 0.23999999999999999 helpText = PLocalizer.TableCardsHelp helpPos = (0.0, 0.0, 0.23999999999999999) text = PLocalizer.BlackjackCardSwap button = GuiButton(parent=self.menu, command=self.playerAction, helpText=helpText, helpPos=helpPos, pos=(x, 0, y), canReposition=True) self.setButtonSettings2Lines(button, (x, 0, y), text, [PlayingCardGlobals.CardSwap]) button.show() self.cardSwapButton = button self.buttonArray = self.buttonArray + [button] x += x_increment text = PLocalizer.BlackjackDoubleDown button = GuiButton(parent=self.menu, command=self.playerAction, canReposition=True) self.setButtonSettings2Lines(button, (x, 0, y), text, [PlayingCardGlobals.DoubleDown]) button.show() self.doubleDownButton = button self.buttonArray = self.buttonArray + [button] x += x_increment text = PLocalizer.BlackjackStay button = GuiButton(parent=self.menu, command=self.playerAction, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [PlayingCardGlobals.Stay]) button.show() self.stayButton = button self.buttonArray = self.buttonArray + [button] x += x_increment text = PLocalizer.BlackjackHit button = GuiButton(parent=self.menu, command=self.playerAction, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [PlayingCardGlobals.Hit]) button.show() self.hitButton = button self.buttonArray = self.buttonArray + [button] x += x_increment x = -0.35999999999999999 y = 0.070000000000000007 x_increment = 0.23999999999999999 x += x_increment x += x_increment text = PLocalizer.BlackjackSplit button = GuiButton(parent=self.menu, command=self.playerAction, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [PlayingCardGlobals.Split]) button.show() self.splitButton = button self.buttonArray = self.buttonArray + [button] x += x_increment bid = self.table.getTableBidAmount() text = PLocalizer.BlackjackBid + ' ' + bid.__repr__() button = GuiButton(parent=self.menu, command=self.playerAction, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [PlayingCardGlobals.Bid]) button.show() self.bidButton = button self.buttonArray = self.buttonArray + [button] x += x_increment def bid_update_function(value): bid = self.sliderValueToBid(value) text = PLocalizer.BlackjackBid + ' ' + bid.__repr__() self.bidButton['text'] = text self.bidAmount = bid self.bidAmount = 2 default_value = 0.0 x = 0.0 y = -0.25 label = PLocalizer.BlackjackBid resolution = 1.0 self.bidSlider = self.create_slider(bid_update_function, default_value, x, y, resolution, label, self.menu) x = -0.35999999999999999 y = 0.17749999999999999 x_increment = 0.23999999999999999 text = PLocalizer.PokerCheat1 button = GuiButton(parent=self.menu, command=self.cardSwapButtonSelection, canReposition=True) self.setButtonSettings2Lines(button, (x, 0, y), text, [PlayingCardGlobals.Cheat1]) self.cheat1Button = button self.buttonArray = self.buttonArray + [button] x = x + x_increment text = PLocalizer.PokerCheat2 button = GuiButton(parent=self.menu, command=self.cardSwapButtonSelection, canReposition=True) self.setButtonSettings2Lines(button, (x, 0, y), text, [PlayingCardGlobals.Cheat2]) self.cheat2Button = button self.buttonArray = self.buttonArray + [button] x = x + x_increment self.hideCheatButtons() self.disableAllPlayButtons() gui = loader.loadModel('models/gui/toplevel_gui') goldCoin = gui.find('**/treasure_w_coin*') scale = 0.32000000000000001 currentMoney = localAvatar.getInventory().getGoldInPocket() self.moneyDisplay = DirectLabel( parent=self.menu, relief=None, pos=(-0.29999999999999999 + x_increment / 2.0, 0, 0.074999999999999997), geom=goldCoin, geom_scale=(scale, scale, scale), geom_pos=(0, 0, 0), text='%s' % currentMoney, text_align=TextNode.ALeft, text_scale=0.035000000000000003, text_pos=(0.044999999999999998, -0.01), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, scale=1.1000000000000001) self.accept( InventoryGlobals.getCategoryQuantChangeMsg( localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.setMoney) this = self identifier = 0 this.sfxArray = [] this.hitIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_HIT) ] identifier = identifier + 1 self.hands = [] self.splitCardsArray = [] self.canSplit = False self.canDoubleDown = False self.bid = False
def createGui(self): ShipFrame.createGui(self) self.nameLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(self['shipName'], 2), text_align=TextNode.ALeft, text_scale=0.050000000000000003, text_pos=(0.059999999999999998, 0.014999999999999999), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, frameColor=PiratesGuiGlobals.ButtonColor1[3], frameSize=(self['frameSize'][0] + 0.040000000000000001, self['frameSize'][1] - 0.029999999999999999, -0.0, 0.050000000000000003), pos=(0, 0, self['frameSize'][3] - 0.089999999999999997)) self.classLabel = DirectLabel( parent=self.nameLabel, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString( PLocalizer.ShipClassNames.get(self['shipClass']), 1), text_font=PiratesGlobals.getInterfaceFont(), text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), textMayChange=1, text_pos=(self.nameLabel['frameSize'][0] + 0.02, -0.029999999999999999)) self.typeLabel = DirectLabel( parent=self.nameLabel, relief=None, state=DGG.DISABLED, text='', text_pos=(0.59999999999999998, -0.029999999999999999), text_font=PiratesGlobals.getInterfaceFont(), text_scale=0.032000000000000001, text_align=TextNode.ARight, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), textMayChange=0) self.stateLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text='', text_font=PiratesGlobals.getInterfaceFont(), text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), text_pos=(0.19, 0.070000000000000007), text_scale=PiratesGuiGlobals.TextScaleLarge, textMayChange=0) gui = loader.loadModel('models/gui/toplevel_gui') geomCheck = gui.find('**/generic_check') self.button = GuiButton( parent=self, pos=(0.73999999999999999, 0, 0.080000000000000002), text=PLocalizer.SelectShip, text_scale=PiratesGuiGlobals.TextScaleLarge, text_font=PiratesGlobals.getInterfaceFont(), text_pos=(0.035000000000000003, -0.014), geom=(geomCheck, ) * 4, geom_pos=(-0.059999999999999998, 0, 0), geom_scale=0.5, geom0_color=PiratesGuiGlobals.ButtonColor6[0], geom1_color=PiratesGuiGlobals.ButtonColor6[1], geom2_color=PiratesGuiGlobals.ButtonColor6[2], geom3_color=PiratesGuiGlobals.ButtonColor6[3], image3_color=(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), helpPos=(-0.40000000000000002, 0, 0.029999999999999999), helpDelay=0.29999999999999999, command=self['command'], extraArgs=self['extraArgs'])
def __init__(self, table, maxCommunityCards, maxHandCards): DirectFrame.__init__(self, parent=base.a2dBackground, relief=None) self.initialiseoptions(PokerTableGUI) self.maxCommunityCards = maxCommunityCards self.maxHandCards = maxHandCards self.maxBet = 0 self.numberOfTimeouts = 0 self.table = table self.destroyed = False self.playerActions = [] width = 1.0 self.menu = BorderFrame(parent=base.a2dBottomCenter, frameSize=(-width / 2.0, width / 2.0, 0, 0.25), pos=(0, 0, 0)) self.disableReason = DirectLabel( parent=self.menu, text='', text_align=TextNode.ACenter, text_scale=0.04, pos=(0, 0, 0.175), text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1) self.disableReason.hide() self.initializeTableInterface() x = -0.36 y = 0.1775 x_increment = 0.24 helpText = PLocalizer.TableCardsHelp helpPos = (0.0, 0.0, 0.24) text = PLocalizer.PokerCheat1 button = GuiButton(parent=self.menu, command=self.cardIndexSelection, helpText=helpText, helpPos=helpPos, pos=(x, 0, y), canReposition=True) self.setButtonSettings2Lines(button, (x, 0, y), text, [PlayingCardGlobals.Cheat1]) self.cheat1Button = button self.buttonArray = self.buttonArray + [button] x = x + x_increment text = PLocalizer.PokerCheat2 button = GuiButton(parent=self.menu, command=self.cardIndexSelection, helpText=helpText, helpPos=helpPos, pos=(x, 0, y), canReposition=True) self.setButtonSettings2Lines(button, (x, 0, y), text, [PlayingCardGlobals.Cheat2]) self.cheat2Button = button self.buttonArray = self.buttonArray + [button] x = x + x_increment text = PLocalizer.PokerCheck button = GuiButton(parent=self.menu, command=self.playerAction, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [PlayingCardGlobals.CheckCall]) self.passButton = button self.buttonArray = self.buttonArray + [button] x = x + x_increment text = PLocalizer.PokerBet button = GuiButton(parent=self.menu, command=self.playerAction, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [PlayingCardGlobals.BetRaise]) self.betButton = button self.buttonArray = self.buttonArray + [button] x = x + x_increment x = -0.36 y = 0.07 x_increment = 0.24 x = x + x_increment x = x + x_increment x = x + x_increment text = PLocalizer.PokerFold button = GuiButton(parent=self.menu, command=self.playerAction, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [PlayingCardGlobals.Fold]) self.foldButton = button self.buttonArray = self.buttonArray + [button] x = x + x_increment self.potSizeLabel = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ACenter, text_scale=0.05, pos=(-0.15, 0.0, 0.17), text_fg=(1, 0.9, 0.6, 1), text_shadow=(0, 0, 0, 1)) if table.wantMeter == 1: cardMaker = CardMaker('tellMeter') cardMaker.setFrame(-1, 1, -1, 1) self.meterMax = 0.2 self.meterBorder = NodePath(cardMaker.generate()) self.meterBorder.setColor(1, 1, 0, 1) self.meterBorder.setScale(0.2, 1, 0.02) self.meterBorder.reparentTo(aspect2d) self.meter = NodePath(cardMaker.generate()) self.meter.setColor(1, 0, 0, 1) self.meter.setScale(0.2, 1, 0.05) self.meter.reparentTo(aspect2d) if table.wantMeter == 2: cardMaker = CardMaker('tellMeter') cardMaker.setFrame(-1, 1, -1, 1) self.balance = NodePath('Balance') self.balance.reparentTo(aspect2d) self.balanceL = NodePath(cardMaker.generate()) self.balanceL.setColor(1, 0, 0, 1) self.balanceL.setScale(0.125, 1, 0.01) self.balanceL.setPos(-0.125, 0, 0) self.balanceL.reparentTo(self.balance) self.balanceR = NodePath(cardMaker.generate()) self.balanceR.setColor(0, 1, 0, 1) self.balanceR.setScale(0.125, 1, 0.01) self.balanceR.setPos(0.125, 0, 0) self.balanceR.reparentTo(self.balance) self.fulcrum = loader.loadModel('models/props/winebottle_B') self.fulcrum.setScale(0.2) self.fulcrum.setZ(-0.21) self.fulcrum.reparentTo(aspect2d) self.weightR = NodePath(cardMaker.generate()) self.weightR.setColor(0, 0, 1, 1) self.weightR.setScale(0.03, 1, 0.05) self.weightR.setPos(0.22, 0, 0.06) self.weightR.reparentTo(self.balance) self.weightL = NodePath(cardMaker.generate()) self.weightL.setColor(0, 0, 1, 1) self.weightL.setScale(0.03, 1, 0.05) self.weightL.setPos(-0.22, 0, 0.06) self.weightL.reparentTo(self.balance) self.balance.hide() self.fulcrum.hide() self.communityCardNode = NodePath('communityCards') self.communityCardNode.reparentTo(self) self.communityCardNode.setScale(0.5) self.communityCardNode.setPos(0, 0, 0.04) self.communityCards = [] for i in range(self.maxCommunityCards): card = PlayingCard.PlayingCardNodePath('standard', PlayingCardGlobals.Unknown) card.reparentTo(self.communityCardNode) card.setPos(i * 0.3 - 0.6, 0, 0) card.hide() self.communityCards.append(card) self.playerStatusPanels = [] for i in range(self.table.NumSeats + 1): statusPanel = PokerStatusPanel(self.maxHandCards) statusPanel.setName('playerHand-%s' % i) pos = self.HandPos[i] statusPanel.setPos(pos) self.playerStatusPanels.append(statusPanel) self.localStatusPanel = self.playerStatusPanels[ self.LocalAvatarGuiIndex] gui = loader.loadModel('models/gui/toplevel_gui') goldCoin = gui.find('**/treasure_w_coin*') scale = 0.32 currentMoney = self.table.getPlayerChips() x_increment = 0.24 self.moneyDisplay = DirectLabel( parent=self.menu, relief=None, pos=(-0.3 + x_increment, 0, 0.075), geom=goldCoin, geom_scale=(scale, scale, scale), geom_pos=(0, 0, 0), text='%s' % currentMoney, text_align=TextNode.ALeft, text_scale=0.04, text_pos=(0.05, -0.01), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, scale=1.1) self.accept( InventoryGlobals.getCategoryQuantChangeMsg( localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.setMoney) this = self identifier = 0 this.sfxArray = [] this.shuffleIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_SHUFFLE) ] identifier += 1 this.startDealIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_01) ] identifier += 1 this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_02) ] identifier += 1 this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_03) ] identifier += 1 this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_04) ] identifier += 1 this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_05) ] identifier += 1 this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_06) ] identifier += 1 this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_07) ] identifier += 1 this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_08) ] identifier += 1 this.totalDealIdentifiers = identifier - this.startDealIdentifier this.foldIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FOLD) ] identifier += 1 this.flipIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FLIP) ] identifier += 1 this.pickupIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_PICKUP) ] identifier += 1 this.checkIdentifier = identifier check = loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHECK) check.setVolume(0.5) this.sfxArray = this.sfxArray + [check] identifier += 1 this.betIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_BET) ] identifier += 1 this.collectIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_COLLECT) ] identifier += 1 this.allInIdentifier = identifier this.sfxArray = this.sfxArray + [ loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_ALL) ] identifier += 1 return
def __init__(self, name, pvp): self.width = PiratesGuiGlobals.PVPCompletePanelWidth self.height = PiratesGuiGlobals.PVPCompletePanelHeight BorderFrame.__init__(self, frameSize=(self.width * 0.14999999999999999, self.width * 0.84999999999999998, self.height * 0.81999999999999995, self.height), modelName='pir_m_gui_frm_subframe', imageColorScale=VBase4(0.75, 0.75, 0.94999999999999996, 0.75)) self.secondLayer = BorderFrame( parent=self, relief=None, frameSize=(self.width * 0.14999999999999999, self.width * 0.84999999999999998, self.height * 0.81999999999999995, self.height), modelName='pir_m_gui_frm_subframe', imageColorScale=VBase4(0.75, 0.75, 0.90000000000000002, 0.75)) self.initialiseoptions(PVPCompletePanel) self.endButton = GuiButton(parent=self, text=PLocalizer.PVPExit, command=pvp.requestPVPLeave, pos=(1.25, 0, 0.10000000000000001), image=GuiButton.redGenericButton, image_scale=0.59999999999999998) self.endButton.setBin('gui-popup', 0) self.name = name self.title = DirectLabel(parent=self, relief=None, text=name, text_align=TextNode.ACenter, text_scale=0.070000000000000007, text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, pos=(1.25, 0, 1.6200000000000001)) if pvp.hasTeams(): team1Score = '0' team2Score = '0' for stat in pvp.scoreboardHolder.getItemList(): if stat['Team'] == 1: team1Score = stat['Score'] continue if stat['Team'] == 2: team2Score = stat['Score'] continue self.team1ScoreLabel = DirectLabel( parent=self, relief=None, text=PLocalizer.PVPTeamScore % (1, team1Score), text_align=TextNode.ACenter, text_scale=0.040000000000000001, text_fg=PVPGlobals.getTeamColor(1), text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, pos=(1.05, 0, 1.55)) self.team2ScoreLabel = DirectLabel( parent=self, relief=None, text=PLocalizer.PVPTeamScore % (2, team2Score), text_align=TextNode.ACenter, text_scale=0.040000000000000001, text_fg=PVPGlobals.getTeamColor(2), text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, pos=(1.45, 0, 1.55)) self.outcome = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ACenter, text_scale=0.059999999999999998, text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, pos=(1.25, 0, 1.45)) if pvp.hasTeams(): if team1Score > team2Score: self.outcome['text_fg'] = PVPGlobals.getTeamColor(1) elif team2Score > team1Score: self.outcome['text_fg'] = PVPGlobals.getTeamColor(2) self.borderTwo = BorderFrame( parent=self, relief=None, frameSize=(self.width * 0.14999999999999999, self.width * 0.84999999999999998, 0, self.height * 0.80000000000000004), modelName='pir_m_gui_frm_subframe', imageColorScale=VBase4(0.75, 0.75, 0.90000000000000002, 0.75)) self.borderTwoSecondLayer = BorderFrame( parent=self.borderTwo, relief=None, frameSize=(self.width * 0.14999999999999999, self.width * 0.84999999999999998, 0, self.height * 0.80000000000000004), modelName='pir_m_gui_frm_subframe', imageColorScale=VBase4(0.75, 0.75, 0.90000000000000002, 0.75)) self.two = ScoreFrame(PiratesGuiGlobals.PVPCompletePageWidth - 1.0, PiratesGuiGlobals.PVPCompletePageHeight, pvp.statsHolder, 0, sortOrder=2) self.two.reparentTo(self.borderTwo) self.two.setPos(0.45000000000000001, 0, -0.14999999999999999) self.two.setup() self.game = pvp
def initializeTableInterface(self): self.levelUpIval = None self.swapCard = False self.cardSwapIndex = 0 self.swapDialog = None self.leaveDialog = None self.swapResultDialog = None self.timer = False self.timeout = False self.buttonArray = [] self.suitGeomArray = [] if not True: self.suitGeomArray.append(self.suitImage(0)) self.suitGeomArray.append(self.suitImage(1)) self.suitGeomArray.append(self.suitImage(2)) self.suitGeomArray.append(self.suitImage(3)) else: self.suitIcons = loader.loadModel('models/gui/suit_icons') if self.suitIcons: scale = 0.08 icon = self.suitIcons.find('**/suit_icon_h') icon.setScale(scale) self.suitGeomArray.append(icon) icon = self.suitIcons.find('**/suit_icon_d') icon.setScale(scale) self.suitGeomArray.append(icon) icon = self.suitIcons.find('**/suit_icon_c') icon.setScale(scale) self.suitGeomArray.append(icon) icon = self.suitIcons.find('**/suit_icon_s') icon.setScale(scale) self.suitGeomArray.append(icon) else: self.suitGeomArray = [None, None, None, None] x = -0.36 y = 0.07 x_increment = 0.24 text = PLocalizer.TableLeave button = GuiButton(parent=self.menu, command=self.leaveAction, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [PlayingCardGlobals.Leave]) self.leaveButton = button self.buttonArray = self.buttonArray + [button] button.show() text = PLocalizer.TableCancel button = GuiButton(parent=self.menu, command=self.cancelSelection, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [0]) self.cancelButton = button self.buttonArray = self.buttonArray + [button] button.hide() x = x + x_increment self.suit = 0 self.rank = 0 self.cardSwapIndex = 0 self.suitButtonArray = [] self.rankButtonArray = [] x = -0.36 y = 0.1775 x_increment = 0.24 suit = 0 text = PLocalizer.PlayingCardSuits[suit] button = GuiButton(parent=self.menu, command=self.cardSuitSelection, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [suit]) self.suitButtonArray = self.suitButtonArray + [button] geom = self.suitGeomArray[suit] button['geom'] = geom button.setGeom() x = x + x_increment suit = suit + 1 text = PLocalizer.PlayingCardSuits[suit] button = GuiButton(parent=self.menu, command=self.cardSuitSelection, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [suit]) self.suitButtonArray = self.suitButtonArray + [button] geom = self.suitGeomArray[suit] button['geom'] = geom button.setGeom() x = x + x_increment suit = suit + 1 text = PLocalizer.PlayingCardSuits[suit] button = GuiButton(parent=self.menu, command=self.cardSuitSelection, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [suit]) self.suitButtonArray = self.suitButtonArray + [button] geom = self.suitGeomArray[suit] button['geom'] = geom button.setGeom() x = x + x_increment suit = suit + 1 text = PLocalizer.PlayingCardSuits[suit] button = GuiButton(parent=self.menu, command=self.cardSuitSelection, canReposition=True) self.setButtonSettings(button, (x, 0, y), text, [suit]) self.suitButtonArray = self.suitButtonArray + [button] geom = self.suitGeomArray[suit] button['geom'] = geom button.setGeom() x = x + x_increment suit = suit + 1 x = -0.36 - 0.06 y = 0.1775 x_increment = 0.12 rank = 0 text = PLocalizer.Card2 button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.Card3 button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.Card4 button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.Card5 button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.Card6 button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.Card7 button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.Card8 button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.Card9 button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 x = -0.36 - 0.06 y = 0.07 x_increment = 0.12 x = x + x_increment x = x + x_increment x = x + x_increment text = PLocalizer.CardT button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.CardJ button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.CardQ button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.CardK button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 text = PLocalizer.CardA button = GuiButton(parent=self.menu, command=self.cardRankSelection, canReposition=True) self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank]) self.rankButtonArray = self.rankButtonArray + [button] x = x + x_increment rank = rank + 1 return
def __init__(self, gameObject=None): base.loadingScreen.beginStep('LegendaryGameGUI', 4, 20) self.gameObject = gameObject self.guiImage = loader.loadModel( 'models/minigames/pir_m_gam_fsh_legendaryGui') self.UICompoments = {} self.uiBaseNode = NodePath('baseNode') self.uiBaseNode.reparentTo(aspect2d) self.uiBaseNode.show() self.leftBaseNode = NodePath('leftBaseNode') self.leftBaseNode.reparentTo(base.a2dLeftCenter) self.leftBaseNode.show() self.fishActor = None self.actorAnim = {} self.scaleSize = { InventoryType.Collection_Set11_Part1: 0.06, InventoryType.Collection_Set11_Part2: 0.055, InventoryType.Collection_Set11_Part3: 0.12, InventoryType.Collection_Set11_Part4: 0.087, InventoryType.Collection_Set11_Part5: 0.08 } self.meterFrame = DirectFrame( parent=self.leftBaseNode, frameSize=(-0.3, 0.3, -1.0, 0.0), frameColor=(1.0, 1.0, 1.0, 0.0), relief=None, state=DGG.DISABLED, pos=(1.0, 0.0, -0.45), hpr=(0, 0, 0), scale=(1.3, 0.0, 1.3), image=self.guiImage.find('**/pir_t_gui_fsh_meter'), image_scale=(0.2, 0.0, 0.8), image_pos=(0, 0, 0), text='', textMayChange=1, text_scale=PiratesGuiGlobals.TextScaleTitleLarge, text_pos=(-0.55, 0.1), text_shadow=PiratesGuiGlobals.TextShadow) self.UICompoments['meterFrame'] = self.meterFrame self.fishingRod = DirectFrame( parent=self.meterFrame, frameSize=(-0.3, 0.3, -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.2, 0, 0)) self.fishingRod.setR(FishingGlobals.fishingRodInitSlope) self.UICompoments['fishingRod'] = self.fishingRod base.loadingScreen.tick() self.fishingHandleBaseFrame = DirectFrame( parent=self.uiBaseNode, frameSize=(-0.3, 0.3, -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.72, 0.0, 0.72), image=self.guiImage.find('**/pir_t_gui_fsh_partialRod'), image_scale=(3.8, 0.0, 1.9), 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.08, 0.08, -0.2, 0.2), relief=None, state=DGG.DISABLED, pos=(-0.1, 0.0, -0.05), hpr=(0, 0, 0), image=self.guiImage.find('**/pir_t_gui_fsh_handleArm'), image_scale=(1.0, 0.0, 1.0), image_pos=(-0.042, 0, -0.115), image_hpr=(0.0, 0.0, 0)) self.UICompoments['fishingHandle'] = self.fishingHandle self.arrowImage = DirectFrame( parent=self.fishingHandleBaseFrame, frameSize=(-0.4, 0.4, -0.4, 0.4), 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.3, 0, -0.55), hpr=(0, 0, 0), scale=0.45, 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.8) self.lineOneTransitTextNodePath.setScale(0.35, 0.35, 0.35) 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.4, 0.0, -0.95) 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.6, 1.9, True) self.winImagePanel.setPos(-1.3, 0.0, -0.95) self.winImagePanel.reparentTo(self.uiBaseNode) self.winImagePanel.background = OnscreenImage( parent=self.winImagePanel, scale=(2.4, 0, 1.8), image=self.guiImage.find('**/pir_t_gui_fsh_posterBackground'), hpr=(0, 0, 0), pos=(1.3, 0, 0.95)) 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.23, 0.09, 0.03, 1.0) self.winTitleTextNodePath = NodePath(self.winTitleTextNode) self.winTitleTextNodePath.setPos(1.35, 0.0, 1.67) self.winTitleTextNodePath.setScale(0.18) self.winTitleTextNodePath.reparentTo(self.winImagePanel) self.wholeStoryTextNode = TextNode('storyTextNode') self.wholeStoryTextNode.setText('') self.wholeStoryTextNode.setWordwrap(19.0) self.wholeStoryTextNode.setTextColor(0.23, 0.09, 0.03, 1.0) self.wholeStoryTextNodePath = NodePath(self.wholeStoryTextNode) self.wholeStoryTextNodePath.setPos(0.33, 0.0, 1.64) self.wholeStoryTextNodePath.setScale(0.05) 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.2, 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.2)), 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.2), (0.0, 0.0, -0.8), 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.32), (0.0, 0.0, -0.95), 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') 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.15, 0.0, -0.6) self['geom'] = self.card.find('**/background') self['geom_pos'] = (0.58, 0.0, 0.63) self['geom_scale'] = (0.95, 0.0, 0.85) self.coinImage = OnscreenImage(parent=self, image=self.card.find('**/coin'), scale=0.9, hpr=(0, 0, 0), pos=(0.85, 0, 0.85)) self.titleTextNode = TextNode('legendPanelTitle') self.titleTextNode.setText(PLocalizer.LegendSelectionGui['panelTitle']) self.titleTextNode.setFont(PiratesGlobals.getPirateFont()) self.titleTextNode.setTextColor(0.87, 0.82, 0.54, 0.9) self.titleTextNodePath = NodePath(self.titleTextNode) self.titleTextNodePath.setPos(0.65, 0.0, 1.2) self.titleTextNodePath.setScale(0.07) self.titleTextNodePath.reparentTo(self) self.introTextNode = TextNode('legendaryIntroTextNode') self.introTextNode.setText( PLocalizer.LegendSelectionGui['legendIntro']) self.introTextNode.setWordwrap(14.0) self.introTextNode.setTextColor(0.9, 0.8, 0.47, 0.9) self.introTextNodePath = NodePath(self.introTextNode) self.introTextNodePath.setPos(0.6, 0.0, 0.5) self.introTextNodePath.setScale(0.042) self.introTextNodePath.reparentTo(self) self.buttonRootNode = NodePath('button_RootNode') self.buttonRootNode.reparentTo(self) self.buttonRootNode.setPos(-0.08, 0.0, 1.15) 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.3 pos_z = 0.0 - i * 0.25 button = GuiButton(parent=self.buttonRootNode, text=(fishName, fishName, fishName, fishName), text0_fg=(0.43, 0.29, 0.19, 1.0), text1_fg=(0.43, 0.29, 0.19, 1.0), text2_fg=(0.43, 0.29, 0.19, 1.0), text3_fg=(0.43, 0.29, 0.19, 1.0), text_scale=0.035, text_pos=(0.038, -0.005), pos=(pos_x, 0, pos_z), hpr=(0, 0, 0), scale=1.5, image=btnGeom, image_pos=(0, 0, 0), image_scale=0.7, sortOrder=2, command=self.buttonClickHandle, extraArgs=[fishId, assetsKey, locationId]) button.icon = OnscreenImage(parent=button, image=self.iconCard.find('**/%s*' % assetsKey), scale=0.35, hpr=(0, 0, 0), pos=(-0.123, 0, 0.005)) self.legendPanel = GuiPanel.GuiPanel('', 2.6, 1.9, True) self.legendPanel.setPos(-1.3, 0.0, -0.95) self.legendPanel.background = OnscreenImage( parent=self.legendPanel, scale=(2.4, 0, 1.8), image=self.storyImageCard.find( '**/pir_t_gui_fsh_posterBackground'), hpr=(0, 0, 0), pos=(1.3, 0, 0.95)) 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.23, 0.09, 0.03, 1.0) self.storyTextNodePath = NodePath(self.storyTextNode) self.storyTextNodePath.setPos(0.33, 0.0, 1.67) self.storyTextNodePath.setScale(0.05) self.storyTextNodePath.reparentTo(self.legendPanel) self.callBack = None self.legendPanel.hide() return