def __init__(self, holder):
     pvpIcons = loader.loadModel('models/textureCards/pvp_arrow')
     self.holder = holder
     hasTeams = holder.hasTeams()
     self.borderOne = BorderFrame.BorderFrame(relief = None, frameSize = (-(PiratesGuiGlobals.PVPCompletePageWidth) * 0.33000000000000002, PiratesGuiGlobals.PVPCompletePageWidth * 0.33000000000000002, PiratesGuiGlobals.PVPCompletePageHeight * 0.5 - 0.10000000000000001 - (PiratesGuiGlobals.TMCompletePageHeight / 16.0) * len(holder.getItemList(1)), PiratesGuiGlobals.PVPCompletePageHeight * 0.5), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
     self.borderOneSecondLayer = BorderFrame.BorderFrame(parent = self.borderOne, relief = None, text = '', text_scale = 0.074999999999999997, text_fg = PVPGlobals.getTeamColor(1), text_pos = (-0.65000000000000002, 0.64000000000000001), frameSize = (-(PiratesGuiGlobals.PVPCompletePageWidth) * 0.33000000000000002, PiratesGuiGlobals.PVPCompletePageWidth * 0.33000000000000002, PiratesGuiGlobals.PVPCompletePageHeight * 0.5 - 0.10000000000000001 - (PiratesGuiGlobals.TMCompletePageHeight / 16.0) * len(holder.getItemList(1)), PiratesGuiGlobals.PVPCompletePageHeight * 0.5), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
     self.borderOne.setPos(0.0625, 0, -0.10000000000000001)
     if hasTeams:
         self.borderOneSecondLayer['text'] = PLocalizer.PVPTeamName % 1
         self.one = ScoreFrame(PiratesGuiGlobals.PVPCompletePageWidth - 1.2, PiratesGuiGlobals.PVPCompletePageHeight, holder, 1, sortOrder = 2)
         self.one.setPos(-0.5, 0, -0.84999999999999998)
     else:
         self.one = ScoreFrame(PiratesGuiGlobals.PVPCompletePageWidth - 1.0, PiratesGuiGlobals.PVPCompletePageHeight, holder, 1, sortOrder = 2)
         self.one.setPos(-0.73999999999999999, 0, -0.84999999999999998)
     self.borderOne.hide()
     self.one.hide()
     if hasTeams:
         self.borderTwo = BorderFrame.BorderFrame(relief = None, frameSize = (-(PiratesGuiGlobals.PVPCompletePageWidth) * 0.33000000000000002, PiratesGuiGlobals.PVPCompletePageWidth * 0.33000000000000002, PiratesGuiGlobals.PVPCompletePageHeight * 0.5 - 0.10000000000000001 - (PiratesGuiGlobals.TMCompletePageHeight / 16.0) * len(holder.getItemList(2)), PiratesGuiGlobals.PVPCompletePageHeight * 0.5), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
         self.borderTwoSecondLayer = BorderFrame.BorderFrame(parent = self.borderTwo, relief = None, text = PLocalizer.PVPTeamName % 2, text_scale = 0.074999999999999997, text_fg = PVPGlobals.getTeamColor(2), text_pos = (-0.65000000000000002, 0.64000000000000001), frameSize = (-(PiratesGuiGlobals.PVPCompletePageWidth) * 0.33000000000000002, PiratesGuiGlobals.PVPCompletePageWidth * 0.33000000000000002, PiratesGuiGlobals.PVPCompletePageHeight * 0.5 - 0.10000000000000001 - (PiratesGuiGlobals.TMCompletePageHeight / 16.0) * len(holder.getItemList(2)), PiratesGuiGlobals.PVPCompletePageHeight * 0.5), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75))
         self.two = ScoreFrame(PiratesGuiGlobals.PVPCompletePageWidth - 1.2, PiratesGuiGlobals.PVPCompletePageHeight, holder, 2, sortOrder = 2)
         self.borderTwo.setPos(0.0625, 0, -0.25 - (PiratesGuiGlobals.TMCompletePageHeight / 16.0) * len(holder.getItemList(1)))
         self.two.setPos(-0.5, 0, -1.0 - (PiratesGuiGlobals.TMCompletePageHeight / 16.0) * len(holder.getItemList(1)))
         self.borderTwo.hide()
         self.two.hide()
     else:
         self.borderTwo = None
         self.two = None
    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
Esempio n. 3
0
 def __init__(self, holder):
     pvpIcons = loader.loadModel('models/textureCards/pvp_arrow')
     self.holder = holder
     self.borderOne = BorderFrame.BorderFrame(
         relief=None,
         frameSize=(-PiratesGuiGlobals.ScorePanelWidth * 0.4,
                    PiratesGuiGlobals.ScorePanelWidth * 0.5,
                    PiratesGuiGlobals.ScorePanelHeight * 0.5 - 0.2,
                    PiratesGuiGlobals.ScorePanelHeight * 0.5),
         modelName='pir_m_gui_frm_subframe',
         imageColorScale=VBase4(0.75, 0.75, 0.9, 0.75))
     self.borderOneSecondLayer = BorderFrame.BorderFrame(
         parent=self.borderOne,
         relief=None,
         frameSize=(-PiratesGuiGlobals.ScorePanelWidth * 0.4,
                    PiratesGuiGlobals.ScorePanelWidth * 0.5,
                    PiratesGuiGlobals.ScorePanelHeight * 0.5 - 0.2,
                    PiratesGuiGlobals.ScorePanelHeight * 0.5),
         modelName='pir_m_gui_frm_subframe',
         imageColorScale=VBase4(0.75, 0.75, 0.9, 0.75))
     iconOne = DirectFrame(
         parent=self.borderOne,
         relief=None,
         image=pvpIcons.find('**/pir_t_gui_frm_pvpFrench'),
         image_scale=0.2,
         image_pos=(-PiratesGuiGlobals.ScorePanelWidth * 0.35, 0,
                    PiratesGuiGlobals.ScorePanelHeight * 0.45))
     self.one = ScoreFrame(PiratesGuiGlobals.ScorePanelWidth - 0.2,
                           PiratesGuiGlobals.ScorePanelHeight,
                           holder,
                           1,
                           sortOrder=2)
     self.borderOne.setPos(-0.625, 0, -0.3)
     self.one.setPos(-1.05, 0, -1.1)
     self.borderOne.hide()
     self.one.hide()
     self.borderTwo = BorderFrame.BorderFrame(
         relief=None,
         frameSize=(-PiratesGuiGlobals.ScorePanelWidth * 0.4,
                    PiratesGuiGlobals.ScorePanelWidth * 0.5,
                    PiratesGuiGlobals.ScorePanelHeight * 0.5 - 0.2,
                    PiratesGuiGlobals.ScorePanelHeight * 0.5),
         modelName='pir_m_gui_frm_subframe',
         imageColorScale=VBase4(0.75, 0.75, 0.9, 0.75))
     self.borderTwoSecondLayer = BorderFrame.BorderFrame(
         parent=self.borderTwo,
         relief=None,
         frameSize=(-PiratesGuiGlobals.ScorePanelWidth * 0.4,
                    PiratesGuiGlobals.ScorePanelWidth * 0.5,
                    PiratesGuiGlobals.ScorePanelHeight * 0.5 - 0.2,
                    PiratesGuiGlobals.ScorePanelHeight * 0.5),
         modelName='pir_m_gui_frm_subframe',
         imageColorScale=VBase4(0.75, 0.75, 0.9, 0.75))
     self.borderTwo.setPos(
         -0.625 + PiratesGuiGlobals.ScorePanelWidth + 0.01, 0, -0.3)
     iconTwo = DirectFrame(
         parent=self.borderTwo,
         relief=None,
         image=pvpIcons.find('**/pir_t_gui_frm_pvpSpanish'),
         image_scale=0.2,
         image_pos=(-PiratesGuiGlobals.ScorePanelWidth * 0.35, 0,
                    PiratesGuiGlobals.ScorePanelHeight * 0.45))
     self.two = ScoreFrame(PiratesGuiGlobals.ScorePanelWidth - 0.2,
                           PiratesGuiGlobals.ScorePanelHeight,
                           holder,
                           2,
                           sortOrder=2)
     self.two.setPos(-1.05 + PiratesGuiGlobals.ScorePanelWidth + 0.01, 0,
                     -1.1)
     self.borderTwo.hide()
     self.two.hide()
     self.accept(self.holder.getItemChangeMsg(), self._updateBorders)
     return