def makePanels(self):
     self.panels = []
     xStart = -0.66000000000000003
     yStart = -0.17999999999999999
     xOffset = 0.19900000000000001
     yOffset = 0.28399999999999997
     for dept in range(0, len(AvatarDNA.suitDepts)):
         row = []
         color = PANEL_COLORS[dept]
         for type in range(0, AvatarDNA.suitsPerDept):
             panel = DirectLabel(parent=self.panelNode,
                                 pos=(xStart + type * xOffset, 0.0,
                                      yStart - dept * yOffset),
                                 relief=None,
                                 state=NORMAL,
                                 image=self.panelModel,
                                 image_scale=(1, 1, 1),
                                 image_color=color,
                                 text=Localizer.SuitPageMystery,
                                 text_scale=0.044999999999999998,
                                 text_fg=(0, 0, 0, 1),
                                 text_pos=(0, 0.185, 0),
                                 text_font=ToontownGlobals.getSuitFont(),
                                 text_wordwrap=7)
             panel.bind(ENTER, self.grow, extraArgs=[panel])
             panel.bind(EXIT, self.shrink, extraArgs=[panel])
             panel.scale = 0.59999999999999998
             panel.setScale(panel.scale)
             panel.quotaLabel = None
             panel.head = None
             panel.shadow = None
             panel.count = 0
             self.addCogRadarLabel(panel)
             self.panels.append(panel)
 def loadDnaStore(self):
     if not hasattr(self, 'dnaStore'):
         self.dnaStore = DNAStorage()
         loader.loadDNAFile(self.dnaStore, 'phase_4/dna/storage.dna')
         self.dnaStore.storeFont('humanist',
                                 ToontownGlobals.getInterfaceFont())
         self.dnaStore.storeFont('mickey', ToontownGlobals.getSignFont())
         self.dnaStore.storeFont('suit', ToontownGlobals.getSuitFont())
         loader.loadDNAFile(self.dnaStore,
                            'phase_3.5/dna/storage_interior.dna')
 def addCogRadarLabel(self, panel):
     cogRadarLabel = DirectLabel(parent=panel,
                                 pos=(0.0, 0.0, -0.215),
                                 relief=None,
                                 state=DISABLED,
                                 text='',
                                 text_scale=0.050000000000000003,
                                 text_fg=(0, 0, 0, 1),
                                 text_font=ToontownGlobals.getSuitFont())
     panel.cogRadarLabel = cogRadarLabel
 def addQuotaLabel(self, panel):
     index = self.panels.index(panel)
     count = str(toonbase.localToon.cogCounts[index])
     if toonbase.localToon.cogs[index] < COG_COMPLETE1:
         quota = str(COG_QUOTAS[0][index % AvatarDNA.suitsPerDept])
     else:
         quota = str(COG_QUOTAS[1][index % AvatarDNA.suitsPerDept])
     quotaLabel = DirectLabel(parent=panel,
                              pos=(0.0, 0.0, -0.215),
                              relief=None,
                              state=DISABLED,
                              text=count + ' of ' + quota,
                              text_scale=0.065000000000000002,
                              text_fg=(0, 0, 0, 1),
                              text_font=ToontownGlobals.getSuitFont())
     panel.quotaLabel = quotaLabel
Example #5
0
 def setupSuitBuilding(self, nodePath):
     dnaStore = self.cr.playGame.dnaStore
     level = int(self.difficulty / 2) + 1
     suitNP = dnaStore.findNode('suit_landmark_' + chr(self.track) +
                                str(level))
     zoneId = dnaStore.getZoneFromBlockNumber(self.block)
     newParentNP = toonbase.tcr.playGame.hood.loader.zoneDict[zoneId]
     suitBuildingNP = suitNP.copyTo(newParentNP)
     buildingTitle = dnaStore.getTitleFromBlockNumber(self.block)
     if buildingTitle:
         buildingTitle += ', Inc.'
     else:
         buildingTitle = 'COGS, Inc.'
     buildingTitle += '\n%s' % AvatarDNA.getDeptFullname(chr(self.track))
     textNode = TextNode('sign')
     textNode.freeze()
     textNode.setTextColor(1.0, 1.0, 1.0, 1.0)
     textNode.setFont(ToontownGlobals.getSuitFont())
     textNode.setAlign(TextNode.ACenter)
     textNode.setWordwrap(17.0)
     textNode.setText(buildingTitle)
     textHeight = textNode.getHeight()
     zScale = (textHeight + 2) / 3.0
     signOrigin = suitBuildingNP.find('**/sign_origin;+s')
     backgroundNP = loader.loadModel('phase_5/models/modules/suit_sign')
     backgroundNP.reparentTo(signOrigin)
     backgroundNP.setPosHprScale(0.0, 0.0,
                                 textHeight * 0.80000000000000004 / zScale,
                                 0.0, 0.0, 0.0, 8.0, 8.0, 8.0 * zScale)
     backgroundNP.node().setEffect(DecalEffect.make())
     signTextNodePath = backgroundNP.attachNewNode(textNode.generate())
     signTextNodePath.setPosHprScale(
         0.0, 0.0,
         -0.20999999999999999 + textHeight * 0.10000000000000001 / zScale,
         0.0, 0.0, 0.0, 0.10000000000000001, 0.10000000000000001,
         0.10000000000000001 / zScale)
     signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0)
     frontNP = suitBuildingNP.find('**/*_front/+GeomNode;+s')
     backgroundNP.wrtReparentTo(frontNP)
     frontNP.node().setEffect(DecalEffect.make())
     suitBuildingNP.setName('sb' + str(self.block) + ':_landmark__DNARoot')
     suitBuildingNP.setPosHprScale(nodePath, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                   1.0, 1.0, 1.0)
     suitBuildingNP.flattenMedium()
     self.loadElevator(suitBuildingNP)
     return suitBuildingNP
Example #6
0
 def showfont(self, fontname):
     fontname = string.strip(string.lower(fontname))
     if fontname == '' or fontname == 'interface':
         font = ToontownGlobals.getInterfaceFont()
     else:
         if fontname == 'toon':
             font = ToontownGlobals.getToonFont()
         else:
             if fontname == 'suit':
                 font = ToontownGlobals.getSuitFont()
             else:
                 if fontname == 'sign':
                     font = ToontownGlobals.getSignFont()
                 else:
                     self.setMagicWordResponse('Unknown font: %s' % fontname)
                     return
     if not isinstance(font, DynamicTextFont):
         self.setMagicWordResponse('Font %s is not dynamic.' % fontname)
         return
     self.hidefont()
     self.shownFontNode = aspect2d.attachNewNode('shownFont')
     tn = TextNode('square')
     tn.freeze()
     tn.setCardActual(0.0, 1.0, -1.0, 0.0)
     tn.setFrameActual(0.0, 1.0, -1.0, 0.0)
     tn.setCardColor(1, 1, 1, 0.5)
     tn.setFrameColor(1, 1, 1, 1)
     tn.setFont(font)
     tn.setText(' ')
     numXPages = 2
     numYPages = 2
     pageScale = 0.8
     pageMargin = 0.1
     numPages = font.getNumPages()
     x = 0
     y = 0
     for pi in range(numPages):
         page = font.getPage(pi)
         tn.setCardTexture(page)
         np = self.shownFontNode.attachNewNode(tn.generate())
         np.setScale(pageScale)
         (
          np.setPos(float(x) / numXPages * 2 - 1 + pageMargin, 0, 1 - float(y) / numYPages * 2 - pageMargin),)
         x += 1
         if x >= numXPages:
             y += 1
 def addBuildingRadarLabel(self, button):
     gui = loader.loadModelOnce('phase_3.5/models/gui/suit_detail_panel')
     zPos = BUILDING_RADAR_POS[self.radarButtons.index(button)]
     buildingRadarLabel = DirectLabel(
         parent=button,
         relief=None,
         pos=(0.22500000000000001, 0.0, zPos),
         state=DISABLED,
         image=gui.find('**/avatar_panel'),
         image_hpr=(0, 0, 90),
         image_scale=(0.050000000000000003, 1, 0.10000000000000001),
         image_pos=(0, 0, 0.014999999999999999),
         text='0 buildings',
         text_scale=0.050000000000000003,
         text_fg=(1, 0, 0, 1),
         text_font=ToontownGlobals.getSuitFont())
     gui.removeNode()
     button.buildingRadarLabel = buildingRadarLabel
    def showfont(self, fontname):
        fontname = string.strip(string.lower(fontname))
        if fontname == '' or fontname == 'interface':
            font = ToontownGlobals.getInterfaceFont()
        elif fontname == 'toon':
            font = ToontownGlobals.getToonFont()
        elif fontname == 'suit':
            font = ToontownGlobals.getSuitFont()
        elif fontname == 'sign':
            font = ToontownGlobals.getSignFont()
        else:
            self.setMagicWordResponse('Unknown font: %s' % fontname)
            return None
        if not isinstance(font, DynamicTextFont):
            self.setMagicWordResponse('Font %s is not dynamic.' % fontname)
            return None

        self.hidefont()
        self.shownFontNode = aspect2d.attachNewNode('shownFont')
        tn = TextNode('square')
        tn.freeze()
        tn.setCardActual(0.0, 1.0, -1.0, 0.0)
        tn.setFrameActual(0.0, 1.0, -1.0, 0.0)
        tn.setCardColor(1, 1, 1, 0.5)
        tn.setFrameColor(1, 1, 1, 1)
        tn.setFont(font)
        tn.setText(' ')
        numXPages = 2
        numYPages = 2
        pageScale = 0.80000000000000004
        pageMargin = 0.10000000000000001
        numPages = font.getNumPages()
        x = 0
        y = 0
        for pi in range(numPages):
            page = font.getPage(pi)
            tn.setCardTexture(page)
            np = self.shownFontNode.attachNewNode(tn.generate())
            np.setScale(pageScale)
            (np.setPos(((float(x) / numXPages) * 2 - 1) + pageMargin, 0,
                       1 - (float(y) / numYPages) * 2 - pageMargin), )
            x += 1
            if x >= numXPages:
                y += 1
    def __init__(self):

        try:
            pass
        except:
            self.Suit_initialized = 1
            Avatar.Avatar.__init__(self)
            self.setFont(ToontownGlobals.getSuitFont())
            self.setPlayerType(NametagGroup.CCSuit)
            self.setPickable(1)
            self.leftHand = None
            self.rightHand = None
            self.shadowNull = None
            self.nametagNull = None
            self.headParts = []
            self.healthBar = None
            self.healthCondition = 0

        return None
Example #10
0
    def __init__(self):

        try:
            pass
        except:
            self.Suit_initialized = 1
            Avatar.Avatar.__init__(self)
            self.setFont(ToontownGlobals.getSuitFont())
            self.setPlayerType(NametagGroup.CCSuit)
            self.setPickable(1)
            self.leftHand = None
            self.rightHand = None
            self.shadowNull = None
            self.nametagNull = None
            self.headParts = []
            self.healthBar = None
            self.healthCondition = 0

        return None
Example #11
0
 def __init__(self, parent=aspect2d, **kw):
     bookModel = loader.loadModelOnce(
         'phase_3.5/models/gui/stickerbook_gui')
     questCard = bookModel.find('**/questCard')
     optiondefs = (('relief', None,
                    None), ('reverse', 0, None), ('image', questCard, None),
                   ('image_scale', (0.8, 1.0, 0.58), None), ('state',
                                                             NORMAL, None))
     self.defineoptions(kw, optiondefs)
     DirectFrame.__init__(self, relief=None)
     self.initialiseoptions(QuestPoster)
     self.questFrame = DirectFrame(parent=self, relief=None)
     self.headline = DirectLabel(parent=self.questFrame,
                                 relief=None,
                                 text='',
                                 text_font=ToontownGlobals.getMinnieFont(),
                                 text_fg=self.normalTextColor,
                                 text_scale=0.05,
                                 text_align=TextNode.ACenter,
                                 text_wordwrap=12.0,
                                 textMayChange=1,
                                 pos=(0, 0, 0.23))
     self.questInfo = DirectLabel(parent=self.questFrame,
                                  relief=None,
                                  text='',
                                  text_fg=self.normalTextColor,
                                  text_scale=TEXT_SCALE,
                                  text_align=TextNode.ACenter,
                                  text_wordwrap=TEXT_WORDWRAP,
                                  textMayChange=1,
                                  pos=(0, 0, -0.0625))
     self.rewardText = DirectLabel(parent=self.questFrame,
                                   relief=None,
                                   text='',
                                   text_fg=self.colors['rewardRed'],
                                   text_scale=0.0425,
                                   text_align=TextNode.ALeft,
                                   text_wordwrap=17.0,
                                   textMayChange=1,
                                   pos=(-0.36, 0, -0.26))
     self.rewardText.hide()
     self.lPictureFrame = DirectFrame(
         parent=self.questFrame,
         relief=None,
         image=bookModel.find('**/questPictureFrame'),
         image_scale=IMAGE_SCALE_SMALL,
         text='',
         text_pos=(0, -0.11),
         text_fg=self.normalTextColor,
         text_scale=TEXT_SCALE,
         text_align=TextNode.ACenter,
         text_wordwrap=8.0,
         textMayChange=1)
     self.lPictureFrame.hide()
     self.rPictureFrame = DirectFrame(
         parent=self.questFrame,
         relief=None,
         image=bookModel.find('**/questPictureFrame'),
         image_scale=IMAGE_SCALE_SMALL,
         text='',
         text_pos=(0, -0.11),
         text_fg=self.normalTextColor,
         text_scale=TEXT_SCALE,
         text_align=TextNode.ACenter,
         text_wordwrap=8.0,
         textMayChange=1,
         pos=(0.18, 0, 0.13))
     self.rPictureFrame.hide()
     self.lQuestIcon = DirectFrame(parent=self.lPictureFrame,
                                   relief=None,
                                   text=' ',
                                   text_font=ToontownGlobals.getSuitFont(),
                                   text_pos=(0, -0.03),
                                   text_fg=self.normalTextColor,
                                   text_scale=0.13,
                                   text_align=TextNode.ACenter,
                                   text_wordwrap=13.0,
                                   textMayChange=1)
     self.lQuestIcon.setColorOff()
     self.rQuestIcon = DirectFrame(parent=self.rPictureFrame,
                                   relief=None,
                                   text=' ',
                                   text_font=ToontownGlobals.getSuitFont(),
                                   text_pos=(0, -0.03),
                                   text_fg=self.normalTextColor,
                                   text_scale=0.13,
                                   text_align=TextNode.ACenter,
                                   text_wordwrap=13.0,
                                   textMayChange=1)
     self.rQuestIcon.setColorOff()
     self.auxText = DirectLabel(parent=self.questFrame,
                                relief=None,
                                text='',
                                text_scale=0.04,
                                text_fg=self.normalTextColor,
                                text_align=TextNode.ACenter,
                                textMayChange=1)
     self.auxText.hide()
     self.questProgress = DirectWaitBar(parent=self.questFrame,
                                        relief=SUNKEN,
                                        frameSize=(-0.95, 0.95, -0.1, 0.12),
                                        borderWidth=(0.025, 0.025),
                                        scale=0.2,
                                        frameColor=(0.945, 0.875, 0.706,
                                                    1.0),
                                        barColor=(0.5, 0.7, 0.5, 1),
                                        text='0/0',
                                        text_scale=0.19,
                                        text_fg=(0.05, 0.14, 0.4, 1),
                                        text_align=TextNode.ACenter,
                                        text_pos=(0, -0.04),
                                        pos=(0, 0, -0.195))
     self.questProgress.hide()
     self.funQuest = DirectLabel(parent=self.questFrame,
                                 relief=None,
                                 text=Localizer.QuestPosterFun,
                                 text_fg=(0.0, 0.439, 1.0, 1.0),
                                 text_shadow=(0, 0, 0, 1),
                                 pos=(-0.28, 0, 0.19),
                                 scale=0.04)
     self.funQuest.setR(30)
     self.funQuest.hide()
     bookModel.removeNode()
     self.reverseBG(self['reverse'])
     self.laffMeter = None
     return
Example #12
0
 def __init__(self, parent = aspect2d, **kw):
     bookModel = loader.loadModelOnce('phase_3.5/models/gui/stickerbook_gui')
     questCard = bookModel.find('**/questCard')
     optiondefs = (('relief', None, None), ('reverse', 0, None), ('image', questCard, None), ('image_scale', (0.80000000000000004, 1.0, 0.57999999999999996), None), ('state', NORMAL, None))
     self.defineoptions(kw, optiondefs)
     DirectFrame.__init__(self, relief = None)
     self.initialiseoptions(QuestPoster)
     self.questFrame = DirectFrame(parent = self, relief = None)
     self.headline = DirectLabel(parent = self.questFrame, relief = None, text = '', text_font = ToontownGlobals.getMinnieFont(), text_fg = self.normalTextColor, text_scale = 0.050000000000000003, text_align = TextNode.ACenter, text_wordwrap = 12.0, textMayChange = 1, pos = (0, 0, 0.23000000000000001))
     self.questInfo = DirectLabel(parent = self.questFrame, relief = None, text = '', text_fg = self.normalTextColor, text_scale = TEXT_SCALE, text_align = TextNode.ACenter, text_wordwrap = TEXT_WORDWRAP, textMayChange = 1, pos = (0, 0, -0.0625))
     self.rewardText = DirectLabel(parent = self.questFrame, relief = None, text = '', text_fg = self.colors['rewardRed'], text_scale = 0.042500000000000003, text_align = TextNode.ALeft, text_wordwrap = 17.0, textMayChange = 1, pos = (-0.35999999999999999, 0, -0.26000000000000001))
     self.rewardText.hide()
     self.lPictureFrame = DirectFrame(parent = self.questFrame, relief = None, image = bookModel.find('**/questPictureFrame'), image_scale = IMAGE_SCALE_SMALL, text = '', text_pos = (0, -0.11), text_fg = self.normalTextColor, text_scale = TEXT_SCALE, text_align = TextNode.ACenter, text_wordwrap = 8.0, textMayChange = 1)
     self.lPictureFrame.hide()
     self.rPictureFrame = DirectFrame(parent = self.questFrame, relief = None, image = bookModel.find('**/questPictureFrame'), image_scale = IMAGE_SCALE_SMALL, text = '', text_pos = (0, -0.11), text_fg = self.normalTextColor, text_scale = TEXT_SCALE, text_align = TextNode.ACenter, text_wordwrap = 8.0, textMayChange = 1, pos = (0.17999999999999999, 0, 0.13))
     self.rPictureFrame.hide()
     self.lQuestIcon = DirectFrame(parent = self.lPictureFrame, relief = None, text = ' ', text_font = ToontownGlobals.getSuitFont(), text_pos = (0, -0.029999999999999999), text_fg = self.normalTextColor, text_scale = 0.13, text_align = TextNode.ACenter, text_wordwrap = 13.0, textMayChange = 1)
     self.lQuestIcon.setColorOff()
     self.rQuestIcon = DirectFrame(parent = self.rPictureFrame, relief = None, text = ' ', text_font = ToontownGlobals.getSuitFont(), text_pos = (0, -0.029999999999999999), text_fg = self.normalTextColor, text_scale = 0.13, text_align = TextNode.ACenter, text_wordwrap = 13.0, textMayChange = 1)
     self.rQuestIcon.setColorOff()
     self.auxText = DirectLabel(parent = self.questFrame, relief = None, text = '', text_scale = 0.040000000000000001, text_fg = self.normalTextColor, text_align = TextNode.ACenter, textMayChange = 1)
     self.auxText.hide()
     self.questProgress = DirectWaitBar(parent = self.questFrame, relief = SUNKEN, frameSize = (-0.94999999999999996, 0.94999999999999996, -0.10000000000000001, 0.12), borderWidth = (0.025000000000000001, 0.025000000000000001), scale = 0.20000000000000001, frameColor = (0.94499999999999995, 0.875, 0.70599999999999996, 1.0), barColor = (0.5, 0.69999999999999996, 0.5, 1), text = '0/0', text_scale = 0.19, text_fg = (0.050000000000000003, 0.14000000000000001, 0.40000000000000002, 1), text_align = TextNode.ACenter, text_pos = (0, -0.040000000000000001), pos = (0, 0, -0.19500000000000001))
     self.questProgress.hide()
     self.funQuest = DirectLabel(parent = self.questFrame, relief = None, text = Localizer.QuestPosterFun, text_fg = (0.0, 0.439, 1.0, 1.0), text_shadow = (0, 0, 0, 1), pos = (-0.28000000000000003, 0, 0.19), scale = 0.040000000000000001)
     self.funQuest.setR(30)
     self.funQuest.hide()
     bookModel.removeNode()
     self.reverseBG(self['reverse'])
     self.laffMeter = None