Ejemplo n.º 1
0
    def __init__(self, page, text, extraArgs, pos=(0, 0, 0), text_pos_x=0.07):
        self.page = page

        gui = loader.loadModel('phase_3.5/models/gui/fishingBook.bam')

        DirectButton.__init__(self,
                              parent=page.tabsFrame,
                              relief=None,
                              extraArgs=extraArgs,
                              text=text,
                              text_scale=0.07,
                              text_align=TextNode.ALeft,
                              text_pos=(text_pos_x, 0.0, 0.0),
                              image=gui.find('**/tabs/polySurface1'),
                              image_pos=(0.6, 1, -0.91),
                              image_hpr=(0, 0, -90),
                              image_scale=(0.033, 0.033, 0.035),
                              image_color=self.normalColor,
                              image1_color=self.clickColor,
                              image2_color=self.rolloverColor,
                              image3_color=self.disabledColor,
                              text_fg=Vec4(0.2, 0.1, 0, 1),
                              command=self.page.pickCategory,
                              pos=pos,
                              rolloverSound=CIGlobals.getRolloverSound(),
                              clickSound=CIGlobals.getClickSound())

        self.initialiseoptions(CategoryTab)
Ejemplo n.º 2
0
 def __setDescVisible(self, visible, _):
     if visible:
         CIGlobals.getRolloverSound().play()
         self.desc.show()
     else:
         self.desc.hide()
Ejemplo n.º 3
0
    def load(self):
        BookPage.load(self)
        # Let's load up the clouds.
        for pos, scale, hpr in self.cloudPos:
            cloud = loader.loadModel('phase_3.5/models/gui/cloud.bam')
            cloud.reparentTo(self)
            cloud.setPos(pos)
            cloud.setScale(scale)
            cloud.setHpr(hpr)
            self.clouds.append(cloud)

        for pos, scale, hpr, hood in self.hoodClouds:
            if not base.localAvatar.hasDiscoveredHood(
                    ZoneUtil.getZoneId(hood)):
                cloud = loader.loadModel('phase_3.5/models/gui/cloud.bam')
                cloud.reparentTo(self)
                cloud.setPos(pos)
                cloud.setScale(scale)
                cloud.setHpr(hpr)
                self.clouds.append(cloud)

        for pos, name in self.labelData:
            if base.localAvatar.hasDiscoveredHood(ZoneUtil.getZoneId(name)):
                text = name
                if base.localAvatar.hasTeleportAccess(
                        ZoneUtil.getZoneId(name)):
                    text = 'Go To\n' + text
                label = DirectButton(
                    parent=self,
                    relief=None,
                    pos=pos,
                    pad=(0.2, 0.16),
                    text=('', text, text, ''),
                    text_bg=Vec4(1, 1, 1, 0.4),
                    text_scale=0.055,
                    text_wordwrap=8,
                    rolloverSound=CIGlobals.getRolloverSound(),
                    clickSound=None,
                    pressEffect=0,
                    sortOrder=1,
                    text_font=CIGlobals.getToonFont())
                if base.localAvatar.hasTeleportAccess(
                        ZoneUtil.getZoneId(name)):
                    label['command'] = self.book.finished
                    label['extraArgs'] = [ZoneUtil.getZoneId(name)]
                label.resetFrameSize()
                self.labels.append(label)

        currHoodName = base.cr.playGame.hood.id
        currLocation = ''
        if base.localAvatar.zoneId == ZoneUtil.MinigameAreaId or base.localAvatar.getBattleZone(
        ) is not None:
            currLocation = ''
        elif ZoneUtil.getWhereName(base.localAvatar.zoneId) == 'playground':
            currLocation = 'Playground'
        elif ZoneUtil.getWhereName(
                base.localAvatar.zoneId) in ['street', 'interior']:
            currLocation = ZoneUtil.BranchZone2StreetName[
                ZoneUtil.getBranchZone(base.localAvatar.zoneId)]
        self.infoLabel = DirectLabel(relief=None,
                                     text='You are in: {0}\n{1}'.format(
                                         currHoodName, currLocation),
                                     scale=0.06,
                                     pos=(-0.4, 0, -0.74),
                                     parent=self,
                                     text_align=TextNode.ACenter)

        if currHoodName in [ZoneUtil.MinigameArea, ZoneUtil.BattleTTC]:
            currHoodName = base.cr.playGame.lastHood
        btpText = 'Back to Playground'
        btpEA = [ZoneUtil.getZoneId(currHoodName)]
        self.BTPButton = DirectButton(relief=None,
                                      text=btpText,
                                      geom=CIGlobals.getDefaultBtnGeom(),
                                      text_pos=(0, -0.018),
                                      geom_scale=(1.3, 1.11, 1.11),
                                      text_scale=0.06,
                                      parent=self,
                                      text_font=CIGlobals.getToonFont(),
                                      pos=(0.25, 0, -0.75),
                                      command=self.book.finished,
                                      extraArgs=btpEA,
                                      scale=0.7)

        icons = loader.loadModel('phase_3.5/models/gui/sos_textures.bam')
        self.icon = icons.find('**/teleportIcon')
        icons.detachNode()