Beispiel #1
0
 def destroy(self):
     if self.showTask:
         taskMgr.remove(self.showTask)
         self.showTask = None
     
     self.snapShot = None
     BorderFrame.destroy(self)
Beispiel #2
0
 def __init__(self, parent, shipOV = None, shipName = '', shipClass = 0, mastInfo = [], hp = 0, maxHp = 0, sp = 0, maxSp = 0, cargo = 0, maxCargo = 0, crew = 0, maxCrew = 0, adventureTime = 0, **kw):
     optiondefs = (('state', DGG.DISABLED, None), ('frameSize', (0.050000000000000003, 0.64000000000000001, 0.040000000000000001, 0.39000000000000001), None))
     self.defineoptions(kw, optiondefs)
     BorderFrame.__init__(self, parent, **None)
     self.initialiseoptions(ShipStatFrame)
     self.showTask = None
     self.snapShot = ShipSnapshot(self, shipOV, shipName, shipClass, mastInfo, hp, maxHp, sp, maxSp, cargo, maxCargo, crew, maxCrew, adventureTime, pos = (0, 0, 0))
 def destroy(self, autoDestroy = 1):
     if self.ival:
         self.ival.pause()
         self.ival = None
     
     if autoDestroy:
         BorderFrame.destroy(self)
 def setText(self):
     BorderFrame.setText(self)
     lines = self.component('text0').textNode.getHeight()
     textSpace = (0.034799999999999998 * lines - 0.0276) * self['text_scale'][1] / 0.035000000000000003
     if textSpace > 100:
         textSpace = 0.0
     
     self['frameSize'] = (0, 0.80000000000000004, -0.028000000000000001 - 0.043999999999999997 - 0.043999999999999997 - max(0.042000000000000003, textSpace), 0)
Beispiel #5
0
 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))
Beispiel #6
0
 def __init__(self, tabBar, name, **kw):
     optiondefs = (('state', DGG.DISABLED, None), ('command', None, self.setCommand), ('extraArgs', [], self.setExtraArgs), ('name', name, None), ('mouseEntered', None, None), ('mouseLeft', None, None), ('selected', False, self.setSelected), ('textMayChange', 1, None))
     self.defineoptions(kw, optiondefs)
     BorderFrame.__init__(self, parent = NodePath(), **kw)
     self.initialiseoptions(Tab)
     self.setName(str(name))
     self.tabBar = tabBar
     self.invisibleButton = DirectButton(parent = self, relief = 1, frameColor = (1.0, 0.0, 1.0, 0), frameSize = self.getInnerFrameSize(), rolloverSound = None, command = self['command'], extraArgs = self['extraArgs'], textMayChange = 1)
     self.invisibleButton.bind(DGG.ENTER, self.mouseEntered)
     self.invisibleButton.bind(DGG.EXIT, self.mouseLeft)
 def __init__(self, cell, manager):
     self.sizeX = 0.80000000000000004
     self.sizeZ = 0.59999999999999998
     textScale = PiratesGuiGlobals.TextScaleTitleSmall
     optiondefs = (('state', DGG.DISABLED, None), ('frameSize', (-0.0 * self.sizeX, 1.0 * self.sizeX, -0.0 * self.sizeZ, 1.0 * self.sizeZ), None), ('text', PLocalizer.InventorySplitterTitle, None), ('text_align', TextNode.ACenter, None), ('text_font', PiratesGlobals.getPirateBoldOutlineFont(), None), ('text_fg', (1, 1, 1, 1), None), ('text_shadow', PiratesGuiGlobals.TextShadow, None), ('textMayChange', 1, None), ('text_scale', textScale, None), ('text_pos', (self.sizeX * 0.5, self.sizeZ - textScale), None))
     self.defineoptions({ }, optiondefs)
     BorderFrame.__init__(self, parent = NodePath())
     self.initialiseoptions(InventoryStackSplitter)
     self.fromCell = cell
     self.manager = manager
     self.setup()
Beispiel #8
0
 def destroy(self):
     base.localAvatar.guiMgr.setIgnoreMainMenuHotKey(True)
     base.localAvatar.guiMgr.setIgnoreAllKeys(False)
     base.localAvatar.guiMgr.hideSeaChest()
     base.localAvatar.guiMgr.setIgnoreMainMenuHotKey(False)
     self.ignoreAll()
     BorderFrame.destroy(self)
     if self.confirmDialog:
         self.confirmDialog.destroy()
     
     localAvatar.gameFSM.request('LandRoam')
Beispiel #9
0
 def destroy(self):
     self.borderTwoSecondLayer.destroy()
     self.borderTwoSecondLayer = None
     self.borderTwo.destroy()
     self.borderTwo = None
     self.two.destroy()
     self.two = None
     self.secondLayer.destroy()
     self.secondLater = None
     self.game = None
     BorderFrame.destroy(self)
 def __init__(self, badText = 'Error'):
     self.sizeX = 0.80000000000000004
     self.sizeZ = 0.59999999999999998
     textScale = PiratesGuiGlobals.TextScaleTitleSmall
     optiondefs = (('state', DGG.DISABLED, None), ('frameSize', (-0.0 * self.sizeX, 1.0 * self.sizeX, -0.0 * self.sizeZ, 1.0 * self.sizeZ), None), ('text', PLocalizer.ChatWarningTitle, None), ('text_align', TextNode.ACenter, None), ('text_font', PiratesGlobals.getPirateBoldOutlineFont(), None), ('text_fg', (1, 1, 1, 1), None), ('text_shadow', PiratesGuiGlobals.TextShadow, None), ('textMayChange', 1, None), ('text_scale', textScale, None), ('text_pos', (self.sizeX * 0.5, self.sizeZ - textScale * 1.5), None))
     self.defineoptions({ }, optiondefs)
     BorderFrame.__init__(self, parent = NodePath())
     self.initialiseoptions(ChatWarningBox)
     self.setX(self.sizeX * -0.5)
     self.badText = badText
     self.warningText = badText
     self.setup()
 def __init__(self, manager, callback, **kw):
     self.sizeX = 0.80000000000000004
     self.sizeZ = 0.80000000000000004
     textScale = PiratesGuiGlobals.TextScaleTitleSmall
     optiondefs = (('state', DGG.DISABLED, None), ('frameSize', (-0.0 * self.sizeX, 1.0 * self.sizeX, -0.0 * self.sizeZ, 1.0 * self.sizeZ), None), ('modelName', 'pir_m_gui_frm_main_blue', None), ('nameTag', PLocalizer.InventorySellTitle, None))
     self.defineoptions(kw, optiondefs)
     BorderFrame.__init__(self)
     self.initialiseoptions(InventorySellConfirm)
     self.accept('UpdateSellContainer', self.update)
     self.manager = manager
     self.callback = callback
     self.confirmDialog = None
     self.totalGoldValue = 0
     self.setup()
class VitaeMeter(DirectFrame):

    def __init__(self, parent, **kw):
        DirectFrame.__init__(self, parent)
        self.initialiseoptions(VitaeMeter)
        toplevel_gui = loader.loadModel('models/gui/toplevel_gui')
        self.vitaeDial = DialMeter(parent = self, meterColor = Vec4(0.80000000000000004, 0.20000000000000001, 0.20000000000000001, 1), baseColor = Vec4(0, 0, 0, 1), scale = 0.28000000000000003)
        icon = toplevel_gui.find('**/morale_skull*')
        self.vitaeIcon = DirectFrame(parent = self, state = DGG.NORMAL, relief = None, image = icon, image_scale = 0.625)
        detailLabel = DirectLabel(relief = None, state = DGG.DISABLED, text = PLocalizer.VitaeDesc, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleExtraLarge, text_fg = PiratesGuiGlobals.TextFG1, text_wordwrap = 15, text_shadow = (0, 0, 0, 1), pos = (0.0, 0, -0.025000000000000001), textMayChange = 0, sortOrder = 91)
        height = -(detailLabel.getHeight() + 0.01)
        width = max(0.25, detailLabel.getWidth() + 0.040000000000000001)
        self.helpBox = BorderFrame(parent = self, state = DGG.DISABLED, modelName = 'general_frame_f', frameSize = (-0.040000000000000001, width, height, 0.050000000000000003), pos = (0.050000000000000003, 0, -0.050000000000000003), sortOrder = 90)
        detailLabel.reparentTo(self.helpBox)
        self.helpBox.hide()
        self.helpBox.setClipPlaneOff()
        self.meterLabel = DirectLabel(parent = self.vitaeDial, relief = None, pos = (0, 0, -0.45000000000000001), text = PLocalizer.Vitae, text_scale = 0.20000000000000001, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getPirateOutlineFont(), textMayChange = 1)
        self.vitaeIcon.bind(DGG.WITHIN, self.showDetails)
        self.vitaeIcon.bind(DGG.WITHOUT, self.hideDetails)


    def showDetails(self, event):
        self.helpBox.show()


    def hideDetails(self, event):
        self.helpBox.hide()


    def update(self, level, range, val):
        self.vitaeDial.hide()
        Range = range * 1.0009999999999999
        if level > 0:
            self.vitaeDial.update(val, Range)
            self.vitaeDial.show()
 def createPirateNameBox(self, pirateName):
     self.pirateNameLabel = DirectLabel(relief = None, state = DGG.DISABLED, text = pirateName, text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleMed, text_fg = PiratesGuiGlobals.TextFG1, text_wordwrap = 12, textMayChange = 0, sortOrder = 91)
     self.pirateNameLabel.setBin('fixed', 33)
     height = self.pirateNameLabel.getHeight()
     width = self.pirateNameLabel.getWidth() + 0.050000000000000003
     pos = [
         0.0,
         0.0,
         height / 2 - 0.035000000000000003]
     fs = [
         -(width / 2 + 0.01),
         width / 2 + 0.01,
         -(height / 2 + 0.014999999999999999),
         height / 2 + 0.014999999999999999]
     self.pirateNameBox = BorderFrame(parent = self, state = DGG.DISABLED, frameSize = (fs[0], fs[1], fs[2], fs[3]), modelName = 'general_frame_f', pos = (0.0, 0.0, 0.0))
     self.pirateNameLabel.reparentTo(self.pirateNameBox)
     self.pirateNameLabel.setPos(pos[0], pos[1], pos[2])
     self.pirateNameBox.setClipPlaneOff()
     pos = self.pirateNameBox.getPos(aspect2d)
     x = min(pos[0], base.a2dRight - width)
     z = max(pos[2], base.a2dBottom - height)
     self.pirateNameBox.setPos(aspect2d, x, 0, z - 0.17499999999999999)
     self.pirateNameBox.flattenLight()
     self.pirateNameBox.setBin('fixed', 32)
     self.pirateNameBox.reparentTo(self)
 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))
Beispiel #15
0
 def __init__(self, **kw):
     self.sizeX = 0.80000000000000004
     self.sizeZ = 0.90000000000000002
     textScale = PiratesGuiGlobals.TextScaleTitleSmall
     optiondefs = (('state', DGG.DISABLED, None), ('frameSize', (-0.0 * self.sizeX, 1.0 * self.sizeX, -0.0 * self.sizeZ, 1.0 * self.sizeZ), None), ('text', PLocalizer.BodyShapeUpdate, None), ('text_align', TextNode.ACenter, None), ('text_font', PiratesGlobals.getPirateBoldOutlineFont(), None), ('text_fg', (1, 1, 1, 1), None), ('text_shadow', PiratesGuiGlobals.TextShadow, None), ('textMayChange', 1, None), ('text_scale', textScale, None), ('text_pos', (self.sizeX * 0.5, self.sizeZ * 0.94999999999999996 - textScale), None))
     self.defineoptions(kw, optiondefs)
     BorderFrame.__init__(self)
     self.initialiseoptions(BodyShapeChanger)
     self.setPos(base.a2dRight - self.sizeX, 0, 0)
     self.confirmDialog = None
     self.isSetup = 0
     self.doingRegen = 0
     self.acceptOnce('localAV-enterHalt', self.setup)
     localAvatar.gameFSM.request('Halt')
     if not self.isSetup:
         self.destroy()
    def createHelpbox(self, args=None):
        if self.helpBox:
            return None

        weaponInfo = PLocalizer.WeaponDescriptions.get(self.data[0])
        weaponDesc = weaponInfo
        self.helpText = DirectFrame(
            parent=self,
            relief=None,
            text=weaponDesc,
            state=DGG.DISABLED,
            text_align=TextNode.ALeft,
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_wordwrap=13,
            textMayChange=0,
            sortOrder=91,
        )
        height = -self.helpText.getHeight()
        self.helpBox = BorderFrame(
            parent=aspect2d,
            state=DGG.DISABLED,
            frameSize=(-0.029999999999999999, 0.42999999999999999, height, 0.050000000000000003),
            sortOrder=90,
            borderScale=0.20000000000000001,
        )
        self.helpText.reparentTo(self.helpBox)
        self.helpBox.setBin("gui-popup", 0)
        self.helpBox.setPos(self, 0.25, 0, -0.035000000000000003)
    def makeDetails(self):
        if self.detailFrame:
            return None

        normalScale = 0.97307200000000005
        parent = self.getParent()
        if parent:
            for i in range(0, 2):
                parent = parent.getParent()
                if not parent:
                    break
                    continue


        if parent:
            parentScale = parent.getScale()[0]
        else:
            parentScale = normalScale
        durationStr = str(int(self.maxDuration))
        if self.effectId in buffTable:
            text = buffTable[self.effectId][1] + PLocalizer.BuffDuration % durationStr
        else:
            text = buffTable[WeaponGlobals.C_UNKNOWN_EFFECT][1] + PLocalizer.BuffDuration % durationStr
        self.detailBox = DirectLabel(state = DGG.DISABLED, relief = None, text = text, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleExtraLarge * normalScale / parentScale, text_fg = (1, 1, 1, 1), text_wordwrap = 15, text_shadow = (0, 0, 0, 1), textMayChange = 1)
        height = -(self.detailBox.getHeight() + 0.01)
        width = max(0.25, self.detailBox.getWidth() + 0.040000000000000001)
        self.detailFrame = BorderFrame(parent = self.myIcon, state = DGG.DISABLED, frameSize = (-0.040000000000000001, width, height, 0.070000000000000007), pos = (0.050000000000000003, 0, -0.050000000000000003))
        self.detailBox.reparentTo(self.detailFrame)
        self.detailFrame.setBin('gui-popup', 0)
        self.detailFrame.hide()
 def setupGui(self):
     self.destroyGui()
     if not self.guiSetup:
         self.button = DialogButton(parent = self, buttonStyle = DialogButton.NO, pos = (0.25, 0, 0.080000000000000002), text = PLocalizer.lClose, helpPos = (-0.40000000000000002, 0, 0.029999999999999999), helpDelay = 0.29999999999999999, command = self['command'], extraArgs = self['extraArgs'])
         self.background = BorderFrame(parent = self, pos = (0.050000000000000003, 0, 0.050000000000000003), frameSize = [
             0.0,
             0.40000000000000002,
             0.10000000000000001,
             0.59999999999999998], bgColorScale = VBase4(0, 0, 0, 0.75), bgTransparency = 1, flatten = 0)
         if self['ownShip']:
             state = DGG.NORMAL
         else:
             state = DGG.DISABLED
         ship = localAvatar.getShip()
         if ship:
             friendState = ship.getAllowFriendState()
             crewState = ship.getAllowCrewState()
             guildState = ship.getAllowGuildState()
             publicState = ship.getAllowPublicState()
         else:
             friendState = 0
             crewState = 0
             guildState = 0
             publicState = 0
         buttonOptions = {
             'parent': self.background,
             'state': state,
             'relief': None,
             'pos': (0.059999999999999998, 0, 0.53000000000000003),
             'scale': 0.29999999999999999,
             'text': PLocalizer.CrewBoardingAccessAllowFriends,
             'value': friendState,
             'text_pos': (0.16700000000000001, -0.059999999999999998, 0),
             'text0_fg': PiratesGuiGlobals.TextFG1,
             'text1_fg': PiratesGuiGlobals.TextFG1,
             'text2_fg': PiratesGuiGlobals.TextFG1,
             'text3_fg': PiratesGuiGlobals.TextFG9,
             'text_font': PiratesGlobals.getInterfaceFont(),
             'text_scale': 0.14999999999999999,
             'text_shadow': (0, 0, 0, 1),
             'text_align': TextNode.ALeft,
             'command': self.allowFriends }
         self.friendsButton = CheckButton(**None)
         buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowCrew
         buttonOptions['pos'] = (buttonOptions['pos'][0], buttonOptions['pos'][1], buttonOptions['pos'][2] - 0.12)
         buttonOptions['command'] = self.allowCrew
         buttonOptions['value'] = crewState
         self.crewButton = CheckButton(**None)
         buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowGuild
         buttonOptions['pos'] = (buttonOptions['pos'][0], buttonOptions['pos'][1], buttonOptions['pos'][2] - 0.12)
         buttonOptions['command'] = self.allowGuild
         buttonOptions['value'] = guildState
         self.guildButton = CheckButton(**None)
         buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowPublic
         buttonOptions['pos'] = (buttonOptions['pos'][0], buttonOptions['pos'][1], buttonOptions['pos'][2] - 0.12)
         buttonOptions['command'] = self.allowPublic
         buttonOptions['value'] = publicState
         self.publicButton = CheckButton(**None)
         self.guiSetup = True
 def __init__(self, cell, parent):
     self.sizeX = 0.64000000000000001
     self.sizeZ = 0.64000000000000001
     textScale = PiratesGuiGlobals.TextScaleTitleSmall
     frameSize = (-0.0 * self.sizeX, 1.0 * self.sizeX, -0.0 * self.sizeZ, 1.0 * self.sizeZ)
     modelName = 'pir_m_gui_frm_subframe'
     imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 1.0)
     optiondefs = (('state', DGG.DISABLED, None), ('frameSize', frameSize, None), ('modelName', modelName, None), ('imageColorScale', imageColorScale, None))
     self.defineoptions({ }, optiondefs)
     BorderFrame.__init__(self, parent = NodePath())
     self.initialiseoptions(InventoryStackSeller)
     self.doubleFrame = BorderFrame(parent = self, frameSize = frameSize, modelName = modelName, imageColorScale = imageColorScale)
     self.tripleFrame = BorderFrame(parent = self, frameSize = frameSize, modelName = modelName, imageColorScale = imageColorScale, text = PLocalizer.InventorySplitterTitle, text_align = TextNode.ACenter, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_fg = VBase4(1, 1, 1, 1), text_shadow = PiratesGuiGlobals.TextShadow, text_scale = textScale, text_pos = (self.sizeX * 0.5, self.sizeZ * 0.94999999999999996 - textScale))
     self.fromCell = cell
     self.parent = parent
     self.amount = self.fromCell.inventoryItem.getAmount()
     self.setup()
Beispiel #20
0
 def createHelpBox(self):
     if not self.helpBox:
         self.helpLabel = DirectLabel(parent = aspect2d, relief = None, text = '', text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleSmall, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 12, text_shadow = (0, 0, 0, 1), textMayChange = 1, sortOrder = 91)
         height = -(self.helpLabel.getHeight() + 0.01)
         width = max(0.25, self.helpLabel.getWidth() + 0.040000000000000001)
         self.helpBox = BorderFrame(parent = aspect2d, state = DGG.DISABLED, frameSize = (-0.040000000000000001, width, height, 0.050000000000000003), pos = (0, 0, 0), sortOrder = 90)
         self.helpLabel.reparentTo(self.helpBox)
         self.helpBox.hide()
Beispiel #21
0
    def createHelpBox(self):
        if not self.helpWatcher:
            self.createHelpWatcher()

        helpLabel = DirectLabel(
            relief=None,
            state=DGG.DISABLED,
            text=self["helpText"],
            text_align=TextNode.ACenter,
            text_scale=PiratesGuiGlobals.TextScaleMed,
            text_fg=PiratesGuiGlobals.TextFG1,
            text_wordwrap=12,
            text_shadow=(0, 0, 0, 1),
            textMayChange=0,
            sortOrder=91,
        )
        height = helpLabel.getHeight()
        width = helpLabel.getWidth() + 0.050000000000000003
        if self["helpLeftAlign"]:
            fs = [0.0, width, -height, 0.044999999999999998]
            pos = [width / 2.0, 0, -0.01]
        elif self["helpCenterAlign"]:
            pos = [0.0, 0.0, -0.01]
            fs = [
                -(width / 2 + 0.01),
                width / 2 + 0.01,
                -(height / 2 + 0.014999999999999999),
                height / 2 + 0.014999999999999999,
            ]
        else:
            fs = [0.25 - width, 0.25, -height, 0.044999999999999998]
            pos = [0.25 - width / 2.0, 0, -0.01]
        self.helpBox = BorderFrame(
            parent=self,
            state=DGG.DISABLED,
            frameSize=(fs[0], fs[1], fs[2], fs[3]),
            modelName="general_frame_f",
            pos=self["helpPos"],
            sortOrder=90,
        )
        helpLabel.reparentTo(self.helpBox)
        helpLabel.setPos(pos[0], pos[1], pos[2])
        self.helpBox.hide()
        self.helpBox.setClipPlaneOff()
        pos = self.helpBox.getPos(aspect2d)
        x = min(pos[0], base.a2dRight - width)
        z = max(pos[2], base.a2dBottom - height)
        self.helpBox.setPos(aspect2d, x, 0, z)
        if self["helpColorOff"]:
            self.helpBox.setColorOff()
        else:
            self.helpBox.flattenLight()
        if self["helpBin"]:
            self.helpBox.setBin(self["helpBin"], self["helpBinSort"])
 def createToolTip(self):
     if self.toolTipBox:
         return None
     
     self.label = DirectLabel(parent = None, relief = None, text = PLocalizer.SellButton, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 12)
     height = -self.label.getHeight()
     width = self.label.getWidth()
     toolTipScale = 2.5
     self.toolTipBox = None
     self.toolTipBox = BorderFrame(parent = self.sellButton, frameSize = (-0.01, width, height, 0.050000000000000003), scale = toolTipScale, pos = (-(width * toolTipScale * 0.5), 0, height * toolTipScale * 2.25), state = DGG.DISABLED)
     self.label.reparentTo(self.toolTipBox)
    def destroy(self):
        self.ignore("UpdateSellContainer")
        base.localAvatar.guiMgr.setIgnoreMainMenuHotKey(True)
        base.localAvatar.guiMgr.setIgnoreAllKeys(False)
        base.localAvatar.guiMgr.hideSeaChest()
        base.localAvatar.guiMgr.setIgnoreMainMenuHotKey(False)
        self.manager.releaseFromSale()
        if self.inventoryPanelSell:
            self.inventoryPanelSell.clearSale()

        if self.stackSeller:
            self.stackSeller.destroy()
            self.stackSeller = None

        if self.confirmDialog:
            self.confirmDialog.destroy()
            self.confirmDialog = None

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

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

    
    def destroy(self):
        self.borderTwoSecondLayer.destroy()
        self.borderTwoSecondLayer = None
        self.borderTwo.destroy()
        self.borderTwo = None
        self.two.destroy()
        self.two = None
        self.secondLayer.destroy()
        self.secondLater = None
        self.game = None
        BorderFrame.destroy(self)
Beispiel #25
0
 def __init__(self, parent = None, **kwargs):
     self.loadModels()
     self.cornerGeom = None
     self.text = None
     self.circle = None
     self.icon = None
     self.icon2 = None
     if not StackMessage.popupSfx:
         StackMessage.popupSfx = loadSfx(SoundGlobals.SFX_GUI_STACK_POPUP)
         StackMessage.lootSfx = loadSfx(SoundGlobals.SFX_GUI_LOOT)
         StackMessage.lootSfx.setVolume(0.75)
     
     optiondefs = (('relief', None, None), ('frameSize', (0, 0.80000000000000004, -0.17999999999999999, 0), None), ('state', DGG.DISABLED, None), ('time', 7, None), ('priority', 0, None), ('modelName', 'general_frame_b', None), ('borderScale', 0.69999999999999996, None), ('icon', (), self.setIcon), ('buttonStyle', None, None), ('noCallback', None, None), ('yesCallback', None, None), ('cancelCallback', None, None))
     self.defineoptions(kwargs, optiondefs, dynamicGroups = ())
     BorderFrame.__init__(self, parent, **kwargs)
     self.initialiseoptions(StackMessage)
     self.ival = None
     self.cornerGeom = self.corner.copyTo(self)
     self.cornerGeom.setScale(0.40000000000000002)
     self.cornerGeom.setPos(0.068000000000000005, 0, -0.066000000000000003)
     self.cornerGeom.setColorScale(*PiratesGuiGlobals.TextFG1)
     self.setTransparency(True)
Beispiel #26
0
 def __init__(self, title, w, h, showClose = True, titleSize = 0, modelName = 'general_frame_f', **kw):
     self.width = w
     self.height = h
     BorderFrame.__init__(self, frameSize = (0, w, 0, h), modelName = modelName, sortOrder = 20, **kw)
     self.initialiseoptions(GuiPanel)
     titleFont = PiratesGuiGlobals.TextScaleMed
     textColor = PiratesGuiGlobals.TextFG1
     textShadow = PiratesGuiGlobals.TextShadow
     wordwrap = 13
     if titleSize == 0:
         titleFont = PiratesGuiGlobals.TextScaleMed
         textColor = PiratesGuiGlobals.TextFG1
         textShadow = PiratesGuiGlobals.TextShadow
         wordwrap = 13
     elif titleSize == 1:
         titleFont = PiratesGuiGlobals.TextScaleLarge
         textColor = PiratesGuiGlobals.TextFG2
         textShadow = None
         wordwrap = 10
     elif titleSize == 1.5:
         titleFont = PiratesGuiGlobals.TextScaleExtraLarge
         textColor = PiratesGuiGlobals.TextFG1
         textShadow = None
         wordwrap = 10
     
     if title:
         self.titleLabel = DirectLabel(parent = self, relief = None, pos = (0.050000000000000003, 0, h - PiratesGuiGlobals.TextScaleSmall * 2.5), text = title, text_align = TextNode.ALeft, text_scale = titleFont, text_pos = (0.014999999999999999, 0.014999999999999999), text_fg = textColor, text_shadow = textShadow, text_font = PiratesGlobals.getPirateOutlineFont(), textMayChange = 1, text_wordwrap = wordwrap, sortOrder = 21)
     else:
         self.titleLabel = None
     if showClose:
         lookoutUI = loader.loadModel('models/gui/lookout_gui')
         self.closeButton = DirectButton(parent = self, relief = None, image = (lookoutUI.find('**/lookout_close_window'), lookoutUI.find('**/lookout_close_window_down'), lookoutUI.find('**/lookout_close_window_over'), lookoutUI.find('**/lookout_close_window_disabled')), pos = (w - 0.055, 0, h - 0.055), scale = 0.125, command = self.closePanel, sortOrder = 21)
         lookoutUI.removeNode()
     else:
         self.closeButton = None
     self.fadeLerp = None
class TreasureMapRulesPanel:
    
    def __init__(self, panelTitle, instructions, parent = base.a2dTopCenter, duration = 8.0):
        self.panelTitle = panelTitle
        self.instructions = instructions
        self.showPanelIval = None
        self.duration = duration
        self.load(parent)

    
    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 destroy(self):
        self.frame.destroy()
        taskMgr.remove('hideTMRulesTask')
        if self.showPanelIval:
            self.showPanelIval.pause()
            self.showPanelIval = None
        
        del self.openSfx
        del self.frame
        del self.panelTitleText
        del self.instructionsText

    
    def setInstructions(self, instructions):
        self.instructionsText['text'] = instructions

    
    def show(self):
        self.frame.show()
        if self.showPanelIval.isPlaying():
            self.showPanelIval.finish()
        
        self.showPanelIval.start()

    
    def hide(self, task = None):
        self.frame.stash()
 def createTextBox(self):
     if self.infoBox:
         return None
     
     globalPos = self.getPos(base.a2dLeftCenter)
     self.infoBox = None
     self.infoBox = BorderFrame(parent = base.a2dLeftCenter, frameSize = (-0.040000000000000001, 0.5, -0.25, 0.050000000000000003), pos = (globalPos.getX() + 0.12, 0, globalPos.getZ()), state = DGG.DISABLED)
     self.label = DirectLabel(parent = self.infoBox, relief = None, text = PLocalizer.CannonDefenseAmmoDesc % (PLocalizer.makeHeadingString(PLocalizer.InventoryTypeNames[self.skillId], 2), self.cost, self.amount, PLocalizer.CannonDefenseAmmoTypeDesc[self.skillId]), text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 12, textMayChange = 1)
     if self.locked:
         memberText = ''
         if self.skillId > CannonDefenseGlobals.FREEBOOTER_LAST_AMMO_AVAILABLE:
             memberText = PLocalizer.VR_AuthAccess
         
         self.label['text'] = PLocalizer.CannonDefenseAmmoUnlockedAt % (CannonDefenseGlobals.getLevelUnlockedAt(self.skillId), memberText)
     
     self.infoBox.setBin('gui-cannonDefense', 4)
class GuiButton(DirectButton):
    notify = directNotify.newCategory('GuiButton')
    genericButton = None
    redGenericButton = None
    blueGenericButton = None

    def __init__(self, parent = None, hotkeys = (), hotkeyLabel = None, hotkeyLabelX = 0.091999999999999998, hotkeyArgs = True, helpText = '', helpPos = (0, 0, 0), helpDelay = PiratesGuiGlobals.HelpPopupTime, helpColorOff = False, helpLeftAlign = False, helpCenterAlign = False, **kw):
        self.loadGui()
        self.helpBox = None
        self.helpWatcher = None
        self.canRepositon = False
        optiondefs = (('relief', None, None), ('pos', (0, 0, 0), None), ('image', GuiButton.genericButton, None), ('image_scale', (0.23999999999999999, 0.22, 0.22), None), ('image_pos', (0, 0, 0), None), ('pressEffect', 0, None), ('text', '', None), ('text_font', PiratesGlobals.getInterfaceFont(), None), ('text_scale', PiratesGuiGlobals.TextScaleLarge, None), ('text0_fg', PiratesGuiGlobals.TextFG2, None), ('text1_fg', PiratesGuiGlobals.TextFG2, None), ('text2_fg', PiratesGuiGlobals.TextFG2, None), ('text3_fg', PiratesGuiGlobals.TextFG3, None), ('text_shadow', PiratesGuiGlobals.TextShadow, None), ('text_pos', (0, -0.01), None), ('text_wordwrap', 8, None), ('text_align', TextNode.ACenter, None), ('textMayChange', 1, None), ('helpText', helpText, self.helpTextUpdated), ('helpPos', helpPos, self.setHelpPos), ('helpDelay', helpDelay, None), ('helpColorOff', helpColorOff, None), ('helpLeftAlign', helpLeftAlign, None), ('helpCenterAlign', helpCenterAlign, None), ('helpBin', 'gui-popup', None), ('helpBinSort', 0, None), ('helpOpaque', 0, None), ('canReposition', False, None), ('sortOrder', 100, None), ('baseImage', None, None), ('selected', False, None), ('selectedImage', GuiButton.genericButton, None), ('state', DGG.NORMAL, self.setState))
        self.defineoptions(kw, optiondefs)
        DirectButton.__init__(self, parent = NodePath())
        self.initialiseoptions(GuiButton)
        self.hotkeys = ()
        self.setupHotkeys(hotkeys, hotkeyLabel, self['command'], self['extraArgs'], hotkeyLabelX, hotkeyArgs)
        if not parent:
            pass
        self.reparentTo(aspect2d)
        self.helpTaskName = None


    def destroy(self):
        self.hideDetails()
        if self.helpWatcher:
            self.helpWatcher.unbind(DGG.WITHIN)
            self.helpWatcher.unbind(DGG.WITHOUT)
            self.helpWatcher.destroy()
            self.helpWatcher = None

        self.unbind(DGG.ENTER)
        self.unbind(DGG.EXIT)
        self.ignoreAll()
        DirectButton.destroy(self)


    def loadGui(self):
        if GuiButton.genericButton:
            return None

        gui = loader.loadModel('models/gui/toplevel_gui')
        GuiButton.genericButton = (gui.find('**/generic_button'), gui.find('**/generic_button_down'), gui.find('**/generic_button_over'), gui.find('**/generic_button_disabled'))
        GuiButton.redGenericButton = (gui.find('**/pir_t_gui_but_generic'), gui.find('**/pir_t_gui_but_generic_down'), gui.find('**/pir_t_gui_but_generic_over'), gui.find('**/pir_t_gui_but_generic_disabled'))
        GuiButton.blueGenericButton = (gui.find('**/pir_t_gui_but_generic_blue'), gui.find('**/pir_t_gui_but_generic_blue_down'), gui.find('**/pir_t_gui_but_generic_blue_over'), gui.find('**/pir_t_gui_but_generic_blue_disabled'))


    def setupHotkeys(self, hotkeys, hotkeyLabel, command, extraArgs, hotkeyLabelX = 0.091999999999999998, hotkeyArgs = True):
        if self.hotkeys:
            self.ignoreHotkeys()
            self.hotkeyLabel.destroy()

        self.hotkeys = hotkeys
        self.command = command
        self.extraArgs = extraArgs
        self.hotkeyLabel = hotkeyLabel
        self.hotkeyLabelX = hotkeyLabelX
        self.hotkeyArgs = hotkeyArgs
        if self.hotkeys:
            self.hotkeyLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = hotkeyLabel, text_font = PiratesGlobals.getPirateBoldOutlineFont(), text_scale = PiratesGuiGlobals.TextScaleMed, text_pos = (hotkeyLabelX, 0.01), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1)
            self.acceptHotkeys()
        

    
    def ignoreHotkeys(self):
        if self.hotkeys:
            for hotkey in self.hotkeys:
                self.ignore(hotkey)
            
        

    
    def acceptHotkeys(self):
        if self.hotkeys:
            for hotkey in self.hotkeys:
                if self.hotkeyArgs:
                    self.accept(hotkey, self.command, self.extraArgs + [
                        hotkey])
                    continue
                self.accept(hotkey, self.command, self.extraArgs)




    def createHelpWatcher(self):
        if self['helpOpaque']:
            self.bind(DGG.ENTER, self.waitShowDetails)
            self.bind(DGG.EXIT, self.hideDetails)
        else:
            w = self.getWidth()
            h = self.getHeight()
            pos = self._GuiButton__discoverHelpWatcherPos()
            if not self['frameSize']:
                pass
            frameSize = self.getBounds()
            self.helpWatcher = DirectFrame(parent = self, relief = base.config.GetBool('show-helpwatchers', 0), state = DGG.NORMAL, frameColor = (1, 1, 0, 0.5), frameSize = frameSize, sortOrder = self['sortOrder'] - 1)
            self.helpWatcher.wrtReparentTo(self.getParent())
            self.reparentTo(self.getParent())
            self.helpWatcher.bind(DGG.WITHIN, self.waitShowDetails)
            self.helpWatcher.bind(DGG.WITHOUT, self.hideDetails)


    def _GuiButton__discoverHelpWatcherPos(self):
        w = self.getWidth()
        h = self.getHeight()
        if not self['frameSize']:
            pass
        bounds = self.getBounds()
        pos = Vec3(bounds[0] + w / 2, 0, bounds[2] + h / 2)
        return pos


    def resetHelpWatcher(self):
        if self.helpWatcher:
            self.helpWatcher.setPos(self, 0, 0, 0)



    def createHelpBox(self):
        if not self.helpWatcher:
            self.createHelpWatcher()

        helpLabel = DirectLabel(relief = None, state = DGG.DISABLED, text = self['helpText'], text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleMed, text_fg = PiratesGuiGlobals.TextFG1, text_wordwrap = 12, text_shadow = (0, 0, 0, 1), textMayChange = 0, sortOrder = 91)
        height = helpLabel.getHeight()
        width = helpLabel.getWidth() + 0.050000000000000003
        if self['helpLeftAlign']:
            fs = [
                0.0,
                width,
                -height,
                0.044999999999999998]
            pos = [
                width / 2.0,
                0,
                -0.01]
        elif self['helpCenterAlign']:
            pos = [
                0.0,
                0.0,
                -0.01]
            fs = [
                -(width / 2 + 0.01),
                width / 2 + 0.01,
                -(height / 2 + 0.014999999999999999),
                height / 2 + 0.014999999999999999]
        else:
            fs = [
                0.25 - width,
                0.25,
                -height,
                0.044999999999999998]
            pos = [
                0.25 - width / 2.0,
                0,
                -0.01]
        self.helpBox = BorderFrame(parent = self, state = DGG.DISABLED, frameSize = (fs[0], fs[1], fs[2], fs[3]), modelName = 'general_frame_f', pos = self['helpPos'], sortOrder = 90)
        helpLabel.reparentTo(self.helpBox)
        helpLabel.setPos(pos[0], pos[1], pos[2])
        self.helpBox.hide()
        self.helpBox.setClipPlaneOff()
        pos = self.helpBox.getPos(aspect2d)
        x = min(pos[0], base.a2dRight - width)
        z = max(pos[2], base.a2dBottom - height)
        self.helpBox.setPos(aspect2d, x, 0, z)
        if self['helpColorOff']:
            self.helpBox.setColorOff()
        else:
            self.helpBox.flattenLight()
        if self['helpBin']:
            self.helpBox.setBin(self['helpBin'], self['helpBinSort'])



    def helpTextUpdated(self):
        if self.helpBox and self.helpBox['text'] != self['helpText']:
            self.helpBox.destroy()
            self.createHelpBox()
        elif self['helpText']:
            self.createHelpBox()



    def setHelpPos(self):
        if self.helpBox:
            self.helpTextUpdated()



    def waitShowDetails(self, event):

        try:
            self['helpDelay']
        except AttributeError:
            return None

        if not self.helpBox:
            self.createHelpBox()

        if self['helpDelay']:
            self.hideDetails()
            self.helpTaskName = 'helpInfoTask-%s' % self.getName()
            taskMgr.doMethodLater(self['helpDelay'], self.helpBox.show, self.helpTaskName, extraArgs = [])
        else:
            self.helpBox.show()


    def hideDetails(self, event = None):
        if self.helpTaskName:
            taskMgr.remove(self.helpTaskName)

        if self.helpBox and not self.helpBox.isEmpty():
            self.helpBox.hide()



    def setImage(self):
        DirectButton.setImage(self)
        if not self['baseImage']:
            self['baseImage'] = self['image']



    def setSelected(self):
        if self['selected']:
            self['image'] = self['selectedImage']
        else:
            self['image'] = self['baseImage']


    def setState(self):
        DirectButton.setState(self)
        if self.helpWatcher:
            self.helpWatcher['state'] = self['state']



    def removeNode(self):
        DirectButton.removeNode(self)
        if self.helpWatcher:
            self.helpWatcher.removeNode()



    def remove(self):
        DirectButton.remove(self)
        if self.helpWatcher:
            self.helpWatcher.remove()



    def detachNode(self):
        DirectButton.detachNode(self)
        if self.helpWatcher:
            self.helpWatcher.detachNode()



    def hide(self):
        DirectButton.hide(self)
        if self.helpWatcher:
            self.helpWatcher.hide()



    def show(self):
        DirectButton.show(self)
        if self.helpWatcher:
            self.helpWatcher.show()



    def stash(self):
        DirectButton.stash(self)
        if self.helpWatcher:
            self.helpWatcher.stash()



    def unstash(self):
        DirectButton.unstash(self)
        self.reparentTo(self.getParent(), sort = self['sortOrder'])
        if self.helpWatcher:
            self.helpWatcher.unstash()
            self.helpWatcher.reparentTo(self.helpWatcher.getParent(), sort = self.helpWatcher['sortOrder'])
 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.040000000000000001, pos = (0, 0, 0.17499999999999999), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1)
     self.disableReason.hide()
     self.initializeTableInterface()
     x = -0.35999999999999999
     y = 0.17749999999999999
     x_increment = 0.23999999999999999
     helpText = PLocalizer.TableCardsHelp
     helpPos = (0.0, 0.0, 0.23999999999999999)
     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.35999999999999999
     y = 0.070000000000000007
     x_increment = 0.23999999999999999
     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.050000000000000003, pos = (-0.14999999999999999, 0.0, 0.17000000000000001), text_fg = (1, 0.90000000000000002, 0.59999999999999998, 1), text_shadow = (0, 0, 0, 1))
     if table.wantMeter == 1:
         cardMaker = CardMaker('tellMeter')
         cardMaker.setFrame(-1, 1, -1, 1)
         self.meterMax = 0.20000000000000001
         self.meterBorder = NodePath(cardMaker.generate())
         self.meterBorder.setColor(1, 1, 0, 1)
         self.meterBorder.setScale(0.20000000000000001, 1, 0.02)
         self.meterBorder.reparentTo(aspect2d)
         self.meter = NodePath(cardMaker.generate())
         self.meter.setColor(1, 0, 0, 1)
         self.meter.setScale(0.20000000000000001, 1, 0.050000000000000003)
         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.20000000000000001)
         self.fulcrum.setZ(-0.20999999999999999)
         self.fulcrum.reparentTo(aspect2d)
         self.weightR = NodePath(cardMaker.generate())
         self.weightR.setColor(0, 0, 1, 1)
         self.weightR.setScale(0.029999999999999999, 1, 0.050000000000000003)
         self.weightR.setPos(0.22, 0, 0.059999999999999998)
         self.weightR.reparentTo(self.balance)
         self.weightL = NodePath(cardMaker.generate())
         self.weightL.setColor(0, 0, 1, 1)
         self.weightL.setScale(0.029999999999999999, 1, 0.050000000000000003)
         self.weightL.setPos(-0.22, 0, 0.059999999999999998)
         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.040000000000000001)
     self.communityCards = []
     for i in range(self.maxCommunityCards):
         card = PlayingCard.PlayingCardNodePath('standard', PlayingCardGlobals.Unknown)
         card.reparentTo(self.communityCardNode)
         card.setPos(i * 0.29999999999999999 - 0.59999999999999998, 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.32000000000000001
     currentMoney = self.table.getPlayerChips()
     x_increment = 0.23999999999999999
     self.moneyDisplay = DirectLabel(parent = self.menu, relief = None, pos = (-0.29999999999999999 + x_increment, 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.040000000000000001, text_pos = (0.050000000000000003, -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.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
class BoardingPermissionPanel(GuiPanel):
    def __init__(self, parent, *args, **kw):
        self.guiSetup = False
        optiondefs = (('parent', parent, None),
                      ('pos', (-0.57999999999999996, 0, -0.089999999999999997),
                       None), ('command', None, None), ('extraArgs', [], None),
                      ('ownShip', 0, None))
        self.defineoptions(kw, optiondefs)
        GuiPanel.__init__(self,
                          title=PLocalizer.BoardPermTitle,
                          h=0.80000000000000004,
                          w=0.5,
                          titleSize=1.5,
                          showClose=False)
        self.initialiseoptions(BoardingPermissionPanel)
        self.titleLabel['text_align'] = TextNode.ACenter
        self.titleLabel.setPos(0.23000000000000001, 0, 0.71999999999999997)
        self.setupGui()

    def destroy(self):
        self.button = None
        self.background = None
        self.friendsButton = None
        self.crewButton = None
        self.guildButton = None
        self.publicButton = None
        GuiPanel.destroy(self)

    def setupGui(self):
        self.destroyGui()
        if not self.guiSetup:
            self.button = DialogButton(parent=self,
                                       buttonStyle=DialogButton.NO,
                                       pos=(0.25, 0, 0.080000000000000002),
                                       text=PLocalizer.lClose,
                                       helpPos=(-0.40000000000000002, 0,
                                                0.029999999999999999),
                                       helpDelay=0.29999999999999999,
                                       command=self['command'],
                                       extraArgs=self['extraArgs'])
            self.background = BorderFrame(parent=self,
                                          pos=(0.050000000000000003, 0,
                                               0.050000000000000003),
                                          frameSize=[
                                              0.0, 0.40000000000000002,
                                              0.10000000000000001,
                                              0.59999999999999998
                                          ],
                                          bgColorScale=VBase4(0, 0, 0, 0.75),
                                          bgTransparency=1,
                                          flatten=0)
            if self['ownShip']:
                state = DGG.NORMAL
            else:
                state = DGG.DISABLED
            ship = localAvatar.getShip()
            if ship:
                friendState = ship.getAllowFriendState()
                crewState = ship.getAllowCrewState()
                guildState = ship.getAllowGuildState()
                publicState = ship.getAllowPublicState()
            else:
                friendState = 0
                crewState = 0
                guildState = 0
                publicState = 0
            buttonOptions = {
                'parent': self.background,
                'state': state,
                'relief': None,
                'pos': (0.059999999999999998, 0, 0.53000000000000003),
                'scale': 0.29999999999999999,
                'text': PLocalizer.CrewBoardingAccessAllowFriends,
                'value': friendState,
                'text_pos': (0.16700000000000001, -0.059999999999999998, 0),
                'text0_fg': PiratesGuiGlobals.TextFG1,
                'text1_fg': PiratesGuiGlobals.TextFG1,
                'text2_fg': PiratesGuiGlobals.TextFG1,
                'text3_fg': PiratesGuiGlobals.TextFG9,
                'text_font': PiratesGlobals.getInterfaceFont(),
                'text_scale': 0.14999999999999999,
                'text_shadow': (0, 0, 0, 1),
                'text_align': TextNode.ALeft,
                'command': self.allowFriends
            }
            self.friendsButton = CheckButton(**None)
            buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowCrew
            buttonOptions['pos'] = (buttonOptions['pos'][0],
                                    buttonOptions['pos'][1],
                                    buttonOptions['pos'][2] - 0.12)
            buttonOptions['command'] = self.allowCrew
            buttonOptions['value'] = crewState
            self.crewButton = CheckButton(**None)
            buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowGuild
            buttonOptions['pos'] = (buttonOptions['pos'][0],
                                    buttonOptions['pos'][1],
                                    buttonOptions['pos'][2] - 0.12)
            buttonOptions['command'] = self.allowGuild
            buttonOptions['value'] = guildState
            self.guildButton = CheckButton(**None)
            buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowPublic
            buttonOptions['pos'] = (buttonOptions['pos'][0],
                                    buttonOptions['pos'][1],
                                    buttonOptions['pos'][2] - 0.12)
            buttonOptions['command'] = self.allowPublic
            buttonOptions['value'] = publicState
            self.publicButton = CheckButton(**None)
            self.guiSetup = True

    def destroyGui(self):
        if self.guiSetup:
            self.background.destroy()
            self.background = None
            self.friendsButton.destroy()
            self.friendsButton = None
            self.crewButton.destroy()
            self.crewButton = None
            self.guildButton.destroy()
            self.guildButton = None
            self.publicButton.destroy()
            self.publicButton = None
            self.button.destroy()
            self.button = None
            self.guiSetup = False

    def allowFriends(self, allow):
        if self['ownShip']:
            ship = localAvatar.getShip()
            if ship:
                ship.b_setAllowFriendState(allow)

    def allowCrew(self, allow):
        if self['ownShip']:
            ship = localAvatar.getShip()
            if ship:
                ship.b_setAllowCrewState(allow)

    def allowGuild(self, allow):
        if self['ownShip']:
            ship = localAvatar.getShip()
            if ship:
                ship.b_setAllowGuildState(allow)

    def allowPublic(self, allow):
        if self['ownShip']:
            ship = localAvatar.getShip()
            if ship:
                ship.b_setAllowPublicState(allow)

    def setAllowFriends(self, allow):
        self.friendsButton['value'] = allow

    def setAllowCrew(self, allow):
        self.crewButton['value'] = allow

    def setAllowGuild(self, allow):
        self.guildButton['value'] = allow

    def setAllowPublic(self, allow):
        self.publicButton['value'] = allow
 def setupGui(self):
     self.destroyGui()
     if not self.guiSetup:
         self.button = DialogButton(parent=self,
                                    buttonStyle=DialogButton.NO,
                                    pos=(0.25, 0, 0.080000000000000002),
                                    text=PLocalizer.lClose,
                                    helpPos=(-0.40000000000000002, 0,
                                             0.029999999999999999),
                                    helpDelay=0.29999999999999999,
                                    command=self['command'],
                                    extraArgs=self['extraArgs'])
         self.background = BorderFrame(parent=self,
                                       pos=(0.050000000000000003, 0,
                                            0.050000000000000003),
                                       frameSize=[
                                           0.0, 0.40000000000000002,
                                           0.10000000000000001,
                                           0.59999999999999998
                                       ],
                                       bgColorScale=VBase4(0, 0, 0, 0.75),
                                       bgTransparency=1,
                                       flatten=0)
         if self['ownShip']:
             state = DGG.NORMAL
         else:
             state = DGG.DISABLED
         ship = localAvatar.getShip()
         if ship:
             friendState = ship.getAllowFriendState()
             crewState = ship.getAllowCrewState()
             guildState = ship.getAllowGuildState()
             publicState = ship.getAllowPublicState()
         else:
             friendState = 0
             crewState = 0
             guildState = 0
             publicState = 0
         buttonOptions = {
             'parent': self.background,
             'state': state,
             'relief': None,
             'pos': (0.059999999999999998, 0, 0.53000000000000003),
             'scale': 0.29999999999999999,
             'text': PLocalizer.CrewBoardingAccessAllowFriends,
             'value': friendState,
             'text_pos': (0.16700000000000001, -0.059999999999999998, 0),
             'text0_fg': PiratesGuiGlobals.TextFG1,
             'text1_fg': PiratesGuiGlobals.TextFG1,
             'text2_fg': PiratesGuiGlobals.TextFG1,
             'text3_fg': PiratesGuiGlobals.TextFG9,
             'text_font': PiratesGlobals.getInterfaceFont(),
             'text_scale': 0.14999999999999999,
             'text_shadow': (0, 0, 0, 1),
             'text_align': TextNode.ALeft,
             'command': self.allowFriends
         }
         self.friendsButton = CheckButton(**None)
         buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowCrew
         buttonOptions['pos'] = (buttonOptions['pos'][0],
                                 buttonOptions['pos'][1],
                                 buttonOptions['pos'][2] - 0.12)
         buttonOptions['command'] = self.allowCrew
         buttonOptions['value'] = crewState
         self.crewButton = CheckButton(**None)
         buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowGuild
         buttonOptions['pos'] = (buttonOptions['pos'][0],
                                 buttonOptions['pos'][1],
                                 buttonOptions['pos'][2] - 0.12)
         buttonOptions['command'] = self.allowGuild
         buttonOptions['value'] = guildState
         self.guildButton = CheckButton(**None)
         buttonOptions['text'] = PLocalizer.CrewBoardingAccessAllowPublic
         buttonOptions['pos'] = (buttonOptions['pos'][0],
                                 buttonOptions['pos'][1],
                                 buttonOptions['pos'][2] - 0.12)
         buttonOptions['command'] = self.allowPublic
         buttonOptions['value'] = publicState
         self.publicButton = CheckButton(**None)
         self.guiSetup = True
Beispiel #33
0
class InventoryStackSeller(BorderFrame):
    def __init__(self, cell, parent):
        self.sizeX = 0.64000000000000001
        self.sizeZ = 0.64000000000000001
        textScale = PiratesGuiGlobals.TextScaleTitleSmall
        frameSize = (-0.0 * self.sizeX, 1.0 * self.sizeX, -0.0 * self.sizeZ,
                     1.0 * self.sizeZ)
        modelName = 'pir_m_gui_frm_subframe'
        imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 1.0)
        optiondefs = (('state', DGG.DISABLED, None), ('frameSize', frameSize,
                                                      None),
                      ('modelName', modelName, None), ('imageColorScale',
                                                       imageColorScale, None))
        self.defineoptions({}, optiondefs)
        BorderFrame.__init__(self, parent=NodePath())
        self.initialiseoptions(InventoryStackSeller)
        self.doubleFrame = BorderFrame(parent=self,
                                       frameSize=frameSize,
                                       modelName=modelName,
                                       imageColorScale=imageColorScale)
        self.tripleFrame = BorderFrame(
            parent=self,
            frameSize=frameSize,
            modelName=modelName,
            imageColorScale=imageColorScale,
            text=PLocalizer.InventorySplitterTitle,
            text_align=TextNode.ACenter,
            text_font=PiratesGlobals.getPirateBoldOutlineFont(),
            text_fg=VBase4(1, 1, 1, 1),
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_scale=textScale,
            text_pos=(self.sizeX * 0.5,
                      self.sizeZ * 0.94999999999999996 - textScale))
        self.fromCell = cell
        self.parent = parent
        self.amount = self.fromCell.inventoryItem.getAmount()
        self.setup()

    def setup(self):
        self.setBin('gui-fixed', 1)
        self.itemLabel = DirectLabel(
            parent=self,
            relief=None,
            text='%s' % self.fromCell.inventoryItem.getName(),
            text_font=PiratesGlobals.getPirateBoldOutlineFont(),
            text_align=TextNode.ACenter,
            text_scale=PiratesGuiGlobals.TextScaleLarge,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            image=self.fromCell.inventoryItem['image'],
            image_scale=self.fromCell.inventoryItem['image_scale'],
            text_pos=(0.0, 0.066000000000000003),
            pos=(self.sizeX * 0.5, 0.0, self.sizeZ * 0.59999999999999998))
        self.amountEntry = DirectEntry(
            parent=self,
            relief=DGG.GROOVE,
            scale=PiratesGuiGlobals.TextScaleExtraLarge,
            initialText='%s' % self.amount,
            width=1.5,
            numLines=1,
            focus=1,
            cursorKeys=1,
            frameColor=(1.0, 1.0, 1.0, 0.20000000000000001),
            entryFont=PiratesGlobals.getPirateBoldOutlineFont(),
            text_fg=(1.0, 1.0, 1.0, 1.0),
            pos=(self.sizeX * 0.32500000000000001, 0.0,
                 self.sizeZ * 0.35499999999999998),
            suppressKeys=1,
            suppressMouse=1,
            autoCapitalize=0,
            command=self.selectStackAmount)
        self.amountLabel = DirectLabel(
            parent=self,
            relief=None,
            text=PLocalizer.InventorySellAmount % self.amount,
            text_font=PiratesGlobals.getPirateBoldOutlineFont(),
            text_align=TextNode.ACenter,
            text_scale=PiratesGuiGlobals.TextScaleExtraLarge,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_pos=(0.0, 0.066000000000000003),
            pos=(self.sizeX * 0.55000000000000004, 0.0, self.sizeZ * 0.25))
        self.confirmButton = GuiButton.GuiButton(
            parent=self,
            text=PLocalizer.lOk,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_pos=(0.0, -0.014),
            text_scale=PiratesGuiGlobals.TextScaleLarge,
            text_align=TextNode.ACenter,
            text_shadow=PiratesGuiGlobals.TextShadow,
            image=GuiButton.GuiButton.blueGenericButton,
            image_scale=(0.59999999999999998, 0.59999999999999998,
                         0.59999999999999998),
            pos=(self.sizeX * 0.25, 0, 0.10000000000000001),
            relief=None,
            command=self.selectStackAmount)
        self.cancelButton = GuiButton.GuiButton(
            parent=self,
            text=PLocalizer.lCancel,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_pos=(0.0, -0.014),
            text_scale=PiratesGuiGlobals.TextScaleLarge,
            text_align=TextNode.ACenter,
            text_shadow=PiratesGuiGlobals.TextShadow,
            image=GuiButton.GuiButton.blueGenericButton,
            image_scale=(0.59999999999999998, 0.59999999999999998,
                         0.59999999999999998),
            pos=(self.sizeX * 0.75, 0, 0.10000000000000001),
            relief=None,
            command=self.cancelItem)

    def destroy(self):
        self.parent = None
        self.fromCell = None
        self.doubleFrame.destroy()
        self.tripleFrame.destroy()
        BorderFrame.destroy(self)

    def selectStackAmount(self, amount=None):
        if not amount:
            amount = self.amountEntry.get()

        if not amount or len(amount) == 0:
            base.localAvatar.guiMgr.createWarning(
                PLocalizer.InventorySellWarning, PiratesGuiGlobals.TextFG6)
            return None

        try:
            amount = int(amount)
        except:
            base.localAvatar.guiMgr.createWarning(
                PLocalizer.InventorySellWarning, PiratesGuiGlobals.TextFG6)
            return None

        if amount < 0 or amount > self.amount:
            base.localAvatar.guiMgr.createWarning(
                PLocalizer.InventorySellWarning, PiratesGuiGlobals.TextFG6)
            return None

        if amount == 0:
            self.cancelItem()
            return None
        else:
            self.parent.setStackAmount(self.fromCell, amount)
            self.destroy()

    def cancelItem(self):
        self.parent.cancelItem()
        self.destroy()
class BuffIcon(DirectFrame):
    Background = None
    Card = None

    def __init__(self, parent, effectId, duration, attackerId, **kw):
        optiondefs = (('relief', None, None),)
        self.defineoptions(kw, optiondefs)
        DirectFrame.__init__(self, parent)
        self.initialiseoptions(BuffIcon)
        if not self.Background:
            self.Background = loader.loadModel('models/gui/lookout_gui').find('**/lookout_submit')
            self.Background.setScale(0.33000000000000002)

        if not self.Card:
            self.Card = loader.loadModel('models/textureCards/buff_icons')

        self.myIcon = None
        self.detailFrame = None
        self.dial = None
        self.iconScale = 0.070000000000000007
        self.effectId = effectId
        self.maxDuration = duration
        self.timeLeft = duration
        self.lastTimestamp = None
        self.attackerId = attackerId
        self.setDepthWrite(0)
        self.setFogOff()
        self.setLightOff()
        self.setBin('gui-fixed', 0)


    def makeIcons(self):
        self.Background.copyTo(self)
        self.dial = DialMeter(parent = self, meterColor = Vec4(0.29999999999999999, 0.0, 0.80000000000000004, 1), baseColor = Vec4(0, 0, 0, 1), scale = 0.17000000000000001, sortOrder = 0)
        if self.effectId in buffTable:
            info = buffTable.get(self.effectId)
        else:
            info = buffTable.get(WeaponGlobals.C_UNKNOWN_EFFECT)
        self.myIcon = DirectButton(parent = self, relief = None, geom = self.Card.find('**/' + info[0]), geom_scale = self.iconScale, sortOrder = 1)
        self.myIcon.bind(DGG.ENTER, self.showDetails)
        self.myIcon.bind(DGG.EXIT, self.hideDetails)
        self.updateIconInfo()


    def makeDetails(self):
        if self.detailFrame:
            return None

        normalScale = 0.97307200000000005
        parent = self.getParent()
        if parent:
            for i in range(0, 2):
                parent = parent.getParent()
                if not parent:
                    break
                    continue


        if parent:
            parentScale = parent.getScale()[0]
        else:
            parentScale = normalScale
        durationStr = str(int(self.maxDuration))
        if self.effectId in buffTable:
            text = buffTable[self.effectId][1] + PLocalizer.BuffDuration % durationStr
        else:
            text = buffTable[WeaponGlobals.C_UNKNOWN_EFFECT][1] + PLocalizer.BuffDuration % durationStr
        self.detailBox = DirectLabel(state = DGG.DISABLED, relief = None, text = text, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleExtraLarge * normalScale / parentScale, text_fg = (1, 1, 1, 1), text_wordwrap = 15, text_shadow = (0, 0, 0, 1), textMayChange = 1)
        height = -(self.detailBox.getHeight() + 0.01)
        width = max(0.25, self.detailBox.getWidth() + 0.040000000000000001)
        self.detailFrame = BorderFrame(parent = self.myIcon, state = DGG.DISABLED, frameSize = (-0.040000000000000001, width, height, 0.070000000000000007), pos = (0.050000000000000003, 0, -0.050000000000000003))
        self.detailBox.reparentTo(self.detailFrame)
        self.detailFrame.setBin('gui-popup', 0)
        self.detailFrame.hide()


    def showDetails(self, event):
        self.makeDetails()
        self.detailFrame.show()
        self.updateIconInfo()


    def hideDetails(self, event):
        if self.detailFrame:
            self.detailFrame.hide()



    def updateIconInfo(self):
        if self.lastTimestamp == None:
            timeOffset = 0.0
        else:
            timeOffset = globalClockDelta.localElapsedTime(self.lastTimestamp)
        duration = max(0.0, self.timeLeft - timeOffset)
        self.dial.update(duration, self.maxDuration)
        if self.detailFrame and not self.detailFrame.isHidden():
            if duration > 0:
                durationStr = PLocalizer.BuffDuration % str(int(duration) + 1)
            else:
                durationStr = ''
            if self.effectId in buffTable:
                text = buffTable[self.effectId][1] + durationStr
            else:
                text = buffTable[WeaponGlobals.C_UNKNOWN_EFFECT][1] + durationStr
            self.detailBox['text'] = text



    def destroy(self):
        DirectFrame.destroy(self)
class PokerTableGUI(DirectFrame, TableGUI):
    HandPos = (Vec3(0, 0, 0.40000000000000002), Vec3(0.38, 0, 0.33000000000000002), Vec3(0.65000000000000002, 0, 0.10000000000000001), Vec3(0.45000000000000001, 0, -0.26000000000000001), Vec3(0, 0, -0.29999999999999999), Vec3(-0.45000000000000001, 0, -0.26000000000000001), Vec3(-0.65000000000000002, 0, 0.10000000000000001), Vec3(-0.38, 0, 0.33000000000000002))
    LocalAvatarGuiIndex = 4
    
    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.040000000000000001, pos = (0, 0, 0.17499999999999999), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1)
        self.disableReason.hide()
        self.initializeTableInterface()
        x = -0.35999999999999999
        y = 0.17749999999999999
        x_increment = 0.23999999999999999
        helpText = PLocalizer.TableCardsHelp
        helpPos = (0.0, 0.0, 0.23999999999999999)
        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.35999999999999999
        y = 0.070000000000000007
        x_increment = 0.23999999999999999
        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.050000000000000003, pos = (-0.14999999999999999, 0.0, 0.17000000000000001), text_fg = (1, 0.90000000000000002, 0.59999999999999998, 1), text_shadow = (0, 0, 0, 1))
        if table.wantMeter == 1:
            cardMaker = CardMaker('tellMeter')
            cardMaker.setFrame(-1, 1, -1, 1)
            self.meterMax = 0.20000000000000001
            self.meterBorder = NodePath(cardMaker.generate())
            self.meterBorder.setColor(1, 1, 0, 1)
            self.meterBorder.setScale(0.20000000000000001, 1, 0.02)
            self.meterBorder.reparentTo(aspect2d)
            self.meter = NodePath(cardMaker.generate())
            self.meter.setColor(1, 0, 0, 1)
            self.meter.setScale(0.20000000000000001, 1, 0.050000000000000003)
            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.20000000000000001)
            self.fulcrum.setZ(-0.20999999999999999)
            self.fulcrum.reparentTo(aspect2d)
            self.weightR = NodePath(cardMaker.generate())
            self.weightR.setColor(0, 0, 1, 1)
            self.weightR.setScale(0.029999999999999999, 1, 0.050000000000000003)
            self.weightR.setPos(0.22, 0, 0.059999999999999998)
            self.weightR.reparentTo(self.balance)
            self.weightL = NodePath(cardMaker.generate())
            self.weightL.setColor(0, 0, 1, 1)
            self.weightL.setScale(0.029999999999999999, 1, 0.050000000000000003)
            self.weightL.setPos(-0.22, 0, 0.059999999999999998)
            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.040000000000000001)
        self.communityCards = []
        for i in range(self.maxCommunityCards):
            card = PlayingCard.PlayingCardNodePath('standard', PlayingCardGlobals.Unknown)
            card.reparentTo(self.communityCardNode)
            card.setPos(i * 0.29999999999999999 - 0.59999999999999998, 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.32000000000000001
        currentMoney = self.table.getPlayerChips()
        x_increment = 0.23999999999999999
        self.moneyDisplay = DirectLabel(parent = self.menu, relief = None, pos = (-0.29999999999999999 + x_increment, 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.040000000000000001, text_pos = (0.050000000000000003, -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.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

    
    def showActionButtons(self):
        self.cheat1Button.show()
        self.cheat2Button.show()
        self.passButton.show()
        self.betButton.show()
        self.foldButton.show()
        self.leaveButton.show()
        self.moneyDisplay.show()
        self.disableReason.hide()

    
    def hideActionButtons(self):
        self.cheat1Button.hide()
        self.cheat2Button.hide()
        self.passButton.hide()
        self.betButton.hide()
        self.foldButton.hide()
        self.leaveButton.hide()

    
    def playerAction(self, action, allin_amount = 0):
        self.numberOfTimeouts = 0
        base.localAvatar.delayAFK()
        self.table.guiCallback(action, allin_amount)

    
    def leaveAction(self, action, allin_amount = 0):
        self.deleteLeaveDialog()
        
        def showLeaveDialog(displayText = None):
            if not displayText:
                pass
            self.leaveDialog = PDialog.PDialog(text = PLocalizer.PokerLeaveConfirmMessage, style = OTPDialog.YesNo, giveMouse = False, command = self.leaveCallback)
            self.table.setDialogBin(self.leaveDialog)

        if self.table.gameVariation == PiratesGlobals.PARLORGAME_VARIATION_UNDEAD:
            
            def gotInventory(inventory):
                text = None
                
                try:
                    for currQuest in inventory.getQuestList():
                        for (currQuestTask, currQuestTaskState) in zip(currQuest.getTasks(), currQuest.getTaskStates()):
                            if isinstance(currQuestTask, SkeletonPokerTaskDNA):
                                if currQuestTaskState.isComplete():
                                    if currQuestTaskState.isComplete(bonus = True):
                                        lostProgress = 0
                                    else:
                                        lostProgress = currQuestTaskState.getBonusProgress()
                                else:
                                    lostProgress = currQuestTaskState.getProgress()
                                loseAmt = min(PiratesGlobals.PARLORGAME_UNDEAD_EXIT_LOSS, lostProgress)
                                if loseAmt > 0:
                                    text = PLocalizer.PokerUndeadLeaveConfirmMessage % str(loseAmt)
                                    raise NameError('doneSearch')
                                
                            loseAmt > 0
                        
                except NameError:
                    pass

                showLeaveDialog(text)

            invReq = DistributedInventoryBase.getInventory(localAvatar.inventoryId, gotInventory)
        else:
            showLeaveDialog()

    
    def timeoutAction(self, action):
        self.table.guiCallback(action)

    
    def setMoney(self, money):
        self.moneyDisplay['text'] = ('%s' % money,)
        self.table.displayStacks(self.table.localAvatarSeat, money)

    
    def showArrow(self, seatIndex):
        self.hideArrow()
        guiIndex = self.getGuiIndex(seatIndex)
        self.playerStatusPanels[guiIndex].arrow.show()
        self.playerStatusPanels[guiIndex].actionLabel.hide()

    
    def hideArrow(self):
        map(lambda panel: panel.arrow.hide(), self.playerStatusPanels)

    
    def setPlayerActions(self, maxBet, playerActions):
        oldActions = self.playerActions
        self.playerActions = playerActions
        oldMaxBet = self.maxBet
        self.maxBet = maxBet
        for (i, oldAction, newAction) in zip(range(len(playerActions)), oldActions, playerActions):
            if oldAction != newAction:
                (action, amount) = newAction
                panel = self.playerStatusPanels[self.getGuiIndex(i)]
                hand = panel.hand
                label = panel.actionLabel
                if action == PlayingCardGlobals.CheckCall:
                    if amount:
                        actionText = PLocalizer.PokerCall
                    else:
                        actionText = PLocalizer.PokerCheck
                elif action == PlayingCardGlobals.BetRaise:
                    if oldMaxBet == 0:
                        actionText = PLocalizer.PokerBetAmount % amount
                    else:
                        actionText = PLocalizer.PokerRaiseAmount % amount
                elif action == PlayingCardGlobals.Fold:
                    actionText = PLocalizer.PokerFold
                    for card in hand:
                        card.hide()
                    
                    panel.handNameLabel.hide()
                    panel.arrow.hide()
                elif action == PlayingCardGlobals.NoAction:
                    actionText = ''
                    panel.actionLabel.hide()
                elif action == PlayingCardGlobals.SmallBlind:
                    amount = self.table.anteList[1]
                    actionText = PLocalizer.PokerSmallBlindAmount % amount
                elif action == PlayingCardGlobals.BigBlind:
                    amount = self.table.anteList[2]
                    actionText = PLocalizer.PokerBigBlindAmount % amount
                elif action == PlayingCardGlobals.Check:
                    actionText = PLocalizer.PokerCheck
                elif action == PlayingCardGlobals.AllIn:
                    actionText = PLocalizer.PokerAllIn
                else:
                    self.notify.error('Unknown action: %s' % action)
                panel.displayAction(actionText, self.table, i)
                continue
        

    
    def getGuiIndex(self, seatIndex):
        return ((self.LocalAvatarGuiIndex - self.table.localAvatarSeat) + seatIndex) % (self.table.NumSeats + 1)

    
    def clearTable(self):
        for panel in self.playerStatusPanels:
            for card in panel.hand:
                card.hide()
            
            panel.handNameLabel.hide()
            panel.actionLabel.hide()
            panel.dealerButton.hide()
            panel.anteLabel.hide()
        
        for i in range(len(self.communityCards)):
            card = self.communityCards[i]
            card.hide()
        

    
    def setTableState(self, round, buttonSeat, communityCardValues, playerHandValues, totalWinningsArray):
        self.clearTable()
        self.playerStatusPanels[self.getGuiIndex(buttonSeat)].anteLabel.show()
        self.playerStatusPanels[self.getGuiIndex(buttonSeat)].dealerButton.show()
        for i in range(len(self.communityCards)):
            card = self.communityCards[i]
            if i < len(communityCardValues):
                newValue = communityCardValues[i]
                card.show()
                card.setValue(newValue)
                if newValue != PlayingCardGlobals.Unknown:
                    card.turnUp()
                
            newValue != PlayingCardGlobals.Unknown
            card.hide()
            card.setValue(PlayingCardGlobals.Unknown)
        
        for i in range(len(playerHandValues)):
            newHand = playerHandValues[i]
            guiIndex = self.getGuiIndex(i)
            panel = self.playerStatusPanels[guiIndex]
            hand = panel.hand
            handNameLabel = panel.handNameLabel
            allUnknown = 1
            for (card, newValue) in zip(hand, newHand):
                card.show()
                card.setValue(newValue)
                if newValue == PlayingCardGlobals.Unknown:
                    card.turnDown()
                    continue
                allUnknown = 0
                card.turnUp()
            
            if allUnknown:
                panel.cardScaler.setScale(0.40000000000000002)
            else:
                panel.cardScaler.setScale(0.5)
            if newHand and PlayingCardGlobals.Unknown not in newHand:
                if self.table.handIdArray:
                    seat = i
                    handId = self.table.handIdArray[seat]
                    if handId > PlayingCardGlobals.Nothing:
                        sortedHand = self.table.sortedCardsArray[seat]
                        handName = PLocalizer.getHandNameFull(self.table.handIdToHandCode(handId), sortedHand)
                        handNameLabel['text'] = handName
                        handNameLabel.show()
                    
                
        
        end = False
        length = len(totalWinningsArray)
        for i in range(length):
            if totalWinningsArray[i] != 0:
                end = True
                break
                continue
        
        if end and self.table.endOfHand:
            for i in range(length):
                if totalWinningsArray[i] > 0:
                    actor = self.table.actors[i]
                    if actor:
                        name = actor.getName()
                        win = totalWinningsArray[i]
                        message = PLocalizer.PokerChatWinGoldMessage % (name, win)
                        base.talkAssistant.receiveGameMessage(message)
                    
                
                if totalWinningsArray[i] == PlayingCardGlobals.PlayerCaughtCheating:
                    actor = self.table.actors[i]
                    if actor:
                        name = actor.getName()
                        message = PLocalizer.PokerChatCaughtCheatingMessage % name
                        base.talkAssistant.receiveGameMessage(message)
                    
            
        

    
    def setLocalAvatarHand(self, cardValues):
        map(lambda card: card.hide(), self.localStatusPanel.hand)
        self.localStatusPanel.cardScaler.setScale(0.5)
        for (card, newValue) in zip(self.localStatusPanel.hand, cardValues):
            card.show()
            card.setValue(newValue)
            if newValue != PlayingCardGlobals.Unknown:
                card.turnUp()
                continue
        
        handNameLabel = self.localStatusPanel.handNameLabel
        communityCardValues = map(lambda card: card.getValue(), self.communityCards)
        if cardValues and PlayingCardGlobals.Unknown not in cardValues:
            if self.handId == PlayingCardGlobals.Nothing or self.sortedCards == None:
                handNameLabel.hide()
            else:
                handName = PLocalizer.getHandNameFull(self.table.handIdToHandCode(self.handId), self.sortedCards)
                handNameLabel['text'] = handName
                handNameLabel.show()
        else:
            handNameLabel.hide()

    
    def setPotSize(self, potSize):
        if potSize:
            self.potSizeLabel['text'] = PLocalizer.PokerPotAmount % potSize
        else:
            self.potSizeLabel['text'] = ''

    
    def enableActionCallback(self):
        pass

    
    def enableAction(self):
        chips = self.table.getPlayerChips()
        minimum = self.table.getMinimumBetAmount()
        if chips <= 0:
            self.table.allIn()
        else:
            self.cheat1Button.show()
            self.cheat2Button.show()
            self.passButton.show()
            self.betButton.show()
            self.foldButton.show()
            self.disableReason.hide()
            if self.table.checkCondition():
                self.passButton['text'] = PLocalizer.PokerCheck
                self.passButton['extraArgs'] = [
                    PlayingCardGlobals.Check]
                if chips > minimum:
                    self.betButton['text'] = PLocalizer.PokerBetAmount % minimum
                    self.betButton['extraArgs'] = [
                        PlayingCardGlobals.BetRaise]
                else:
                    self.betButton['text'] = PLocalizer.PokerAllInAmount % chips
                    self.betButton['extraArgs'] = [
                        PlayingCardGlobals.AllIn,
                        chips]
            else:
                callAmount = self.table.getCallAmount()
                raiseAmount = self.table.maxBet + minimum
                if chips > callAmount:
                    if callAmount == 0:
                        self.passButton['text'] = PLocalizer.PokerCheck
                        self.passButton['extraArgs'] = [
                            PlayingCardGlobals.Check]
                    else:
                        self.passButton['text'] = PLocalizer.PokerCallAmount % callAmount
                        self.passButton['extraArgs'] = [
                            PlayingCardGlobals.CheckCall]
                else:
                    self.passButton['text'] = PLocalizer.PokerAllInAmount % chips
                    self.passButton['extraArgs'] = [
                        PlayingCardGlobals.AllIn,
                        chips]
                    self.betButton.hide()
                if chips > callAmount + minimum:
                    self.betButton['text'] = PLocalizer.PokerRaiseAmount % raiseAmount
                    self.betButton['extraArgs'] = [
                        PlayingCardGlobals.BetRaise]
                else:
                    self.betButton['text'] = PLocalizer.PokerAllInAmount % (callAmount + chips)
                    self.betButton['extraArgs'] = [
                        PlayingCardGlobals.AllIn,
                        chips]
            self.startTimer(PlayingCardGlobals.SecondsPerHand)

    
    def timeoutFold(self):
        self.hideActionButtons()
        self.hideCheatButtons()
        self.timeoutAction(PlayingCardGlobals.Fold)
        self.leaveButton.show()
        self.timeout = True
        self.deleteSwapDialog()

    
    def timeoutLeave(self):
        self.hideActionButtons()
        self.hideCheatButtons()
        self.timeoutAction(PlayingCardGlobals.Leave)
        self.timeout = True
        self.deleteSwapDialog()

    
    def timerExpiredCallback(self):
        self.numberOfTimeouts = self.numberOfTimeouts + 1
        if self.numberOfTimeouts >= PlayingCardGlobals.MaximumTimeouts:
            self.timeoutLeave()
        else:
            self.timeoutFold()
        self.endTimer()

    
    def enableCheat(self):
        have_cheat_card = False
        for card_id in range(52):
            if self.table.getPlayerInventoryCardCount(card_id) > 0:
                have_cheat_card = True
                break
                continue
        
        if have_cheat_card:
            self.normalButton(self.cheat1Button)
            self.normalButton(self.cheat2Button)
        else:
            self.disableCheat()

    
    def disableCheat(self):
        self.disableButton(self.cheat1Button)
        self.disableButton(self.cheat2Button)

    
    def disableAction(self, reason = None):
        self.cheat1Button.hide()
        self.cheat2Button.hide()
        self.passButton.hide()
        self.betButton.hide()
        self.foldButton.hide()
        if reason:
            self.disableReason['text'] = reason
            self.disableReason.show()
        else:
            self.disableReason.hide()
        self.endTimer()

    
    def destroy(self):
        self.endTimer()
        self.deleteTableGUI()
        self.potSizeLabel.destroy()
        self.menu.destroy()
        del self.menu
        self.communityCardNode.removeNode()
        del self.communityCardNode
        for card in self.communityCards:
            card.removeNode()
        
        del self.communityCards
        for panel in self.playerStatusPanels:
            panel.destroy()
        
        del self.playerStatusPanels
        del self.localStatusPanel
        if self.table.wantMeter == 1:
            self.meter.removeNode()
            del self.meter
            self.meterBorder.removeNode()
            del self.meterBorder
        
        if self.table.wantMeter == 2:
            self.fulcrum.removeNode()
            del self.fulcrum
            self.balance.removeNode()
            del self.balance
        
        this = self
        if this.sfxArray:
            length = len(this.sfxArray)
            for i in range(length):
                sfx = this.sfxArray[i]
                this.sfxArray[i] = None
                if sfx:
                    loader.unloadSfx(sfx)
                    continue
            
        
        self.destroyed = True
        del self.table
        DirectFrame.destroy(self)

    
    def getMeterPercent(self):
        return (self.meter.getScale()[0] / self.meterMax) * 100.0

    
    def setMeterPercent(self, percent):
        curScale = self.meter.getScale()
        self.meter.setScale(self.meterMax * (percent / 100.0), curScale[1], curScale[2])

    
    def getBalanceAngle(self):
        return self.balance.getR()

    
    def setBalanceAngle(self, angle):
        self.balance.setR(angle)
class AmmoSkillButton(SkillButton.SkillButton):
    __module__ = __name__

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

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

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

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

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

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

    def onSellClick(self):
        messenger.send('onSellClick', [self.skillId])
class LookoutRequestLVL2(DirectFrame, InventoryRequestGameType):
    __module__ = __name__

    def __init__(self,
                 name,
                 titleTextScale=None,
                 itemList=None,
                 parentPanel=None):
        self.width = PiratesGuiGlobals.LookoutRequestLVL2Width
        self.height = PiratesGuiGlobals.LookoutRequestLVL2Height
        DirectFrame.__init__(self,
                             relief=None,
                             state=DGG.DISABLED,
                             frameColor=PiratesGuiGlobals.FrameColor,
                             borderWidth=PiratesGuiGlobals.BorderWidth,
                             frameSize=(0, self.width, 0, self.height))
        self.initialiseoptions(LookoutRequestLVL2)
        InventoryRequestGameType.__init__(self)
        self.parentPanel = parentPanel
        self.name = name
        if itemList:
            self.itemList = itemList
        else:
            self.notify.warning(
                'no itemList provied, displaying default parlor game types')
            self.itemList = [{
                'Text':
                GameTypeGlobals.getGameTypeString(
                    PiratesGlobals.GAME_STYLE_BLACKJACK, 'style'),
                'Value':
                PiratesGlobals.GAME_STYLE_BLACKJACK
            }, {
                'Text':
                GameTypeGlobals.getGameTypeString(
                    PiratesGlobals.GAME_STYLE_POKER, 'style'),
                'Value':
                PiratesGlobals.GAME_STYLE_POKER
            }]
        self.activityListItems = ListFrame(0.8,
                                           None,
                                           'blah',
                                           self,
                                           frameColor=(0, 0, 0, 0))
        self.activityListItems.setup()
        if self.parentPanel.UI_VERSION == 0:
            size = (0, 0.82, 0, 0.45)
            pos = (0.15, 0, 0.55)
        else:
            size = (0, 0.82, 0, 0.75)
            pos = (0.15, 0, 0.2)
        self.activityList = DirectScrolledFrame(
            parent=self,
            frameSize=size,
            relief=DGG.GROOVE,
            state=DGG.NORMAL,
            frameColor=(0, 0, 0, 0),
            borderWidth=PiratesGuiGlobals.BorderWidth,
            canvasSize=(0, 0.7, 0, self.activityListItems['frameSize'][3]),
            verticalScroll_frameColor=PiratesGuiGlobals.ScrollbarColor,
            verticalScroll_borderWidth=(0.0075, 0.0075),
            verticalScroll_frameSize=(0, PiratesGuiGlobals.ScrollbarSize, 0,
                                      self.height),
            verticalScroll_thumb_frameColor=PiratesGuiGlobals.ButtonColor2,
            verticalScroll_incButton_frameColor=PiratesGuiGlobals.ButtonColor2,
            verticalScroll_decButton_frameColor=PiratesGuiGlobals.ButtonColor2,
            sortOrder=5,
            pos=pos)
        if self.parentPanel.UI_VERSION == 0:
            self.createListFrame(self.activityList)
        self.activityListItems.reparentTo(self.activityList.getCanvas())
        self.selectedItem = None
        self.optionsPanel = None
        self.optionsButton = None
        self.rankingDisplay = DirectLabel(
            parent=self.getParent(),
            relief=None,
            text='Ranking',
            text_align=TextNode.ALeft,
            text_scale=0.05,
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=1,
            pos=(0.29, 0, -0.55))
        self.rankingDisplay.hide()
        self.setParentPanel(parentPanel)
        self.storedOptions = {}
        self.customOptions = {}
        return

    def createListFrame(self, list, lookoutUI=None):
        self.activityListBorderFrame = BorderFrame(parent=list,
                                                   pos=(0.4, 0, 0.25),
                                                   scale=(0.8, 1, 0.45))
        self.activityListBorderFrame.setBackgroundVisible(False)

    def createOptionsButton(self, lookoutUI=None, parentInfo=None):
        if lookoutUI == None:
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
        if parentInfo == None:
            parent = self.parentPanel
            buttonPos = (0.43, 0, 0.15)
            buttonScale = 0.3
        else:
            parent = parentInfo.get('parent')
            buttonPos = parentInfo.get('pos', (0.43, 0, 0.15))
            buttonScale = parentInfo.get('scale', 0.3)
        optionsButton, optionsButtonText = self.parentPanel.createButtonAndText(
            imageInfo={
                'parent': parent,
                'textureCard': lookoutUI,
                'imageName': 'lookout_option',
                'buttonPos': buttonPos,
                'buttonScale': buttonScale,
                'clickCommand': lambda param=parent: self.optionsClick(param)
            },
            textInfo=PLocalizer.Options)
        if parentInfo == None:
            buttonParent = self
        else:
            buttonParent = parent
        buttonParent.optionsButton = optionsButton
        buttonParent.optionsButtonText = optionsButtonText
        if self.parentPanel.submitButton:
            self.parentPanel.submitButton['state'] = DGG.DISABLED
        return

    def setParentPanel(self, parentPanel):
        self.parentPanel = parentPanel

    def hide(self):
        self.activityList.hide()
        if self.optionsButton:
            self.optionsButton.hide()
        if self.rankingDisplay:
            self.rankingDisplay.hide()

    def show(self):
        self.activityList.show()

        def gotOptions(itemList):
            if (itemList and len(itemList) > 0 and self).optionsButton:
                self.optionsButton.hide()

        itemList = self.determineLvl3ItemList(self.selectedItem, gotOptions)

    def destroy(self):
        self.selectedItem = None
        self.parentPanel = None
        if self.activityList:
            self.activityList.destroy()
            self.activityList = None
        if self.activityListItems:
            self.activityListItems.destroy()
            self.activityListItems = None
        if self.optionsButton:
            self.optionsButton.destroy()
            self.optionsButton = None
        if self.optionsPanel:
            self.optionsPanel.destroy()
            self.optionsPanel = None
        if self.rankingDisplay:
            self.rankingDisplay.destroy()
        DirectFrame.destroy(self)
        self.cancelAllInventoryRequests()
        return

    def getItemChangeMsg(self):
        return self.taskName('gameTypeChanged')

    def getItemList(self):
        return self.itemList

    def createNewItem(self,
                      item,
                      parent,
                      itemType=None,
                      columnWidths=[],
                      color=None):
        if self.parentPanel.UI_VERSION == 0:
            newItem = ButtonListItem(item,
                                     0.08,
                                     0.75,
                                     parent,
                                     parentList=self,
                                     txtColor=color,
                                     pressEffect=False,
                                     frameColor=(0, 0, 0, 0))
        else:
            newItem = LookoutListItem(item,
                                      self.parentPanel.TOPLEVEL_GUI_FILE,
                                      0.16,
                                      0.75,
                                      parent,
                                      parentList=self,
                                      txtColor=color,
                                      pressEffect=False,
                                      frameColor=(0, 0, 0, 0),
                                      wantFrame=True)
            if self.parentPanel.invited == None:

                def gotOptions(itemList):
                    if itemList and len(itemList) > 0:
                        parentInfo = {
                            'parent': newItem,
                            'pos': (0.675, 0, 0.105),
                            'scale': 0.18
                        }
                        self.createOptionsButton(parentInfo=parentInfo)

                self.determineLvl3ItemList(newItem, gotOptions)
        newItem.setup()
        if item['Value'] == PiratesGlobals.CREW_STYLE_FIND_A_CREW:
            if localAvatar.guiMgr.crewHUD.crew or localAvatar.guiMgr.crewHUD.startACrewState or localAvatar.guiMgr.crewHUD.joinACrewStatusPVP:
                newItem['state'] = DGG.DISABLED
                newItem.title['text_fg'] = PiratesGuiGlobals.TextFG9
                newItem.desc['text_fg'] = PiratesGuiGlobals.TextFG9
        if item['Value'] == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS:
            if not localAvatar.guiMgr.crewHUD.crew or DistributedBandMember.DistributedBandMember.IsLocalAvatarHeadOfBand(
            ) == 0:
                newItem['state'] = DGG.DISABLED
                newItem.title['text_fg'] = PiratesGuiGlobals.TextFG9
                newItem.desc['text_fg'] = PiratesGuiGlobals.TextFG9
            if localAvatar.guiMgr.crewHUD.startACrewState:
                newItem['state'] = DGG.NORMAL
                newItem.title['text_fg'] = PiratesGuiGlobals.TextFG1
                newItem.desc['text_fg'] = PiratesGuiGlobals.TextFG1
        if item['Value'] == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
            if localAvatar.guiMgr.crewHUD.crew or localAvatar.guiMgr.crewHUD.startACrewState or localAvatar.guiMgr.crewHUD.joinACrewStatus:
                newItem['state'] = DGG.DISABLED
                newItem.title['text_fg'] = PiratesGuiGlobals.TextFG9
                newItem.desc['text_fg'] = PiratesGuiGlobals.TextFG9
        if item['Value'] == PiratesGlobals.GAME_STYLE_TM_BLACK_PEARL:
            newItem.title['text_scale'] = PiratesGuiGlobals.TextScaleTitleSmall
        return newItem

    def determineLvl3ItemList(self, item, callback=None):
        availItems = []
        if item == None:
            return availItems
        gameType = self.parentPanel.getSelectedValue()

        def optionsReceived(options):
            if options:
                optionKeys = options.keys()
                for currOption in optionKeys:
                    if options[currOption][
                            0] == PiratesGuiGlobals.UIItemType_Hidden or options.get(
                                'execute'):
                        continue
                    availItems.append({
                        'Text':
                        GameTypeGlobals.getGameTypeString(
                            currOption, 'option'),
                        'Option':
                        currOption,
                        'Values':
                        options[currOption][1],
                        'Value':
                        options[currOption][1][0],
                        'ValueType':
                        options[currOption][0]
                    })

            if callback:
                callback(availItems)

        self.getGameOptions(gameType, item.value, optionsReceived)
        return availItems

    def itemSelect(self, item):
        if item.value == PiratesGlobals.CREW_STYLE_FIND_A_CREW or item.value == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS or item.value == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
            self.toggleAICrewLookout(item.value)
            return
        for currItem in self.activityListItems.items:
            currItem.setSelected(False)

        item.setSelected(True)
        self.selectedItem = item
        categoryName = GameTypeGlobals.getGameTypeString(
            self.selectedItem.value, 'style')
        invCat = GameTypeGlobals.getGameTypeRanking(self.selectedItem.value)
        inv = base.localAvatar.getInventory()
        if inv:
            playerRank = inv.getStackQuantity(invCat)
            self.rankingDisplay['text'] = '%s : %d' % (categoryName,
                                                       playerRank)
            self.rankingDisplay.show()
        if self.parentPanel.submitButton == None:
            self.parentPanel.submitRequest()
        return

    def optionsClick(self, selectedItem):
        if self.optionsPanel:
            self.optionsPanel.destroy()
            self.optionsPanel = None

        def gotOptions(itemList):
            if itemList and len(itemList) > 0:
                self.optionsPanel = LookoutRequestLVL3(
                    PLocalizer.LookoutOptionsTitle,
                    titleTextScale=0.05,
                    itemList=itemList,
                    optionsFor=selectedItem.value)
                self.optionsPanel.reparentTo(self.parentPanel)
                self.optionsPanel.setPos(0, 0, 0)
                self.optionsPanel.setParentPanel(self)
                gameTypeStr = GameTypeGlobals.getGameTypeString(
                    selectedItem.value, 'style')
                self.optionsPanel.show(gameTypeStr, selectedItem)
                if self.optionsButton:
                    self.optionsButton.hide()
                self.parentPanel.updateMode(PiratesGuiGlobals.REQUEST_OPT_MODE)

        self.determineLvl3ItemList(selectedItem, gotOptions)
        return

    def optionsClose(self):
        self.parentPanel.updateMode(PiratesGuiGlobals.REQUEST_TYPE_MODE)
        if self.parentPanel.deleteWhenClosed:
            self.optionsPanel.destroy()
            self.optionsPanel.removeNode()
            self.optionsPanel = None
        else:
            self.optionsPanel.hide()
        self.rankingDisplay.hide()
        if self.optionsButton:
            self.optionsButton.show()
        return

    def itemSelectByValue(self, itemValue=None):
        itemToSelect = None
        if itemValue == None:
            if len(self.activityListItems.items) > 0:
                itemToSelect = self.activityListItems.items[0]
        for currItem in self.activityListItems.items:
            print 'checking item with value %s' % currItem.value
            if currItem.value == itemValue:
                itemToSelect = currItem
                break

        if itemToSelect:
            self.itemSelect(itemToSelect)
        return

    def addCustomOptions(self, gameType, optionPairs):
        currOptions = self.customOptions.get(gameType)
        if currOptions == None:
            self.customOptions[gameType] = optionPairs
            return
        for currOptionPair in optionPairs:
            for currOption in currOptions:
                if currOption[0] == currOptionPair[0]:
                    currOption[1] = currOptionPair[1]
                    continue

            currOptions.append(currOptionPair)

        return

    def getCustomOptions(self, gameType, clear=False):
        options = self.customOptions.get(gameType, [])
        if clear and len(options) > 0:
            del self.customOptions[gameType]
        return options

    def getAllGameOptions(self, gameType, clear=False):
        if self.optionsPanel:
            options = self.optionsPanel.getGameOptions(gameType, clear)
        else:
            options = []
        customOptions = self.getCustomOptions(gameType, clear)
        return options + customOptions

    def toggleAICrewLookout(self, itemType):
        if itemType == PiratesGlobals.CREW_STYLE_FIND_A_CREW:
            localAvatar.guiMgr.crewHUD.toggleAvatarLookout()
        if itemType == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS:
            localAvatar.guiMgr.crewHUD.toggleCrewLookout()
        if itemType == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
            localAvatar.guiMgr.crewHUD.toggleAvatarLookoutPVP()
        localAvatar.guiMgr.lookoutPage.close()
Beispiel #38
0
 def destroy(self):
     self.parent = None
     self.fromCell = None
     self.doubleFrame.destroy()
     self.tripleFrame.destroy()
     BorderFrame.destroy(self)
 def createListFrame(self, list, lookoutUI=None):
     self.activityListBorderFrame = BorderFrame(parent=list,
                                                pos=(0.4, 0, 0.25),
                                                scale=(0.8, 1, 0.45))
     self.activityListBorderFrame.setBackgroundVisible(False)