예제 #1
0
 def load(self):
     ClothesGUI.ClothesGUI.load(self)
     self.cancelButton = DirectButton(
         relief=None,
         image=(self.gui.find('**/CrtAtoon_Btn2_UP'),
                self.gui.find('**/CrtAtoon_Btn2_DOWN'),
                self.gui.find('**/CrtAtoon_Btn2_RLLVR')),
         pos=(0.15, 0, -0.85),
         command=self.__handleCancel,
         text=('', Localizer.MakeAToonCancel, Localizer.MakeAToonCancel),
         text_font=ToontownGlobals.getInterfaceFont(),
         text_scale=0.08,
         text_pos=(0, -0.03),
         text_fg=(1, 1, 1, 1),
         text_shadow=(0, 0, 0, 1))
     self.cancelButton.hide()
     if self.isOwner:
         trashcanGui = loader.loadModel(
             'phase_3/models/gui/trashcan_gui.bam')
         trashImage = (trashcanGui.find('**/TrashCan_CLSD'),
                       trashcanGui.find('**/TrashCan_OPEN'),
                       trashcanGui.find('**/TrashCan_RLVR'))
         self.topTrashButton = DirectButton(image=trashImage,
                                            relief=None,
                                            text_scale=0.15,
                                            text_pos=(0.0, -0.1),
                                            textMayChange=0,
                                            pos=(0.67, 0, 0.04),
                                            command=self.__handleDelete,
                                            extraArgs=[ClosetGlobals.SHIRT],
                                            scale=(0.5, 0.5, 0.5))
         self.bottomTrashButton = DirectButton(
             image=trashImage,
             relief=None,
             text_scale=0.15,
             text_pos=(0.0, -0.1),
             textMayChange=0,
             pos=(0.67, 0, -0.36),
             command=self.__handleDelete,
             extraArgs=[ClosetGlobals.SHORTS],
             scale=(0.5, 0.5, 0.5))
         self.button = DirectButton(
             relief=None,
             image=(self.gui.find('**/CrtAtoon_Btn1_UP'),
                    self.gui.find('**/CrtAtoon_Btn1_DOWN'),
                    self.gui.find('**/CrtAtoon_Btn1_RLLVR')),
             pos=(-0.15, 0, -0.85),
             command=self.__handleButton,
             text=('', Localizer.MakeAToonDone, Localizer.MakeAToonDone),
             text_font=ToontownGlobals.getInterfaceFont(),
             text_scale=0.08,
             text_pos=(0, -0.03),
             text_fg=(1, 1, 1, 1),
             text_shadow=(0, 0, 0, 1))
         trashcanGui.removeNode()
     return
예제 #2
0
    def _RoguesGallery__makeGallery(self):
        self.gallery = hidden.attachNewNode("gallery")
        self.gallery.setDepthWrite(1)
        self.gallery.setDepthTest(1)
        self.suits = []
        self.actors = []
        self.text = TextNode("rogues")
        self.text.freeze()
        self.text.setFont(ToontownGlobals.getInterfaceFont())
        self.text.setAlign(TextNode.ACenter)
        self.text.setTextColor(0.0, 0.0, 0.0, 1.0)
        self.rowHeight = 0.0
        self.minXScale = None
        print "rognamestr='", self.rognamestr, "'\n"
        if self.rognamestr == None or len(self.rognamestr) == 0:
            for dept in AvatarDNA.suitDepts:
                self._RoguesGallery__makeDept(dept)

        else:
            self.suitRow = []
            self.rowWidth = 0.0
            self._RoguesGallery__makeSuit(None, None, self.rognamestr)
            self.minXScale = self.xRowSpace / self.rowWidth
            self.suits.append((self.rowWidth, self.suitRow))
            del self.suitRow
        self._RoguesGallery__rescaleSuits()
예제 #3
0
    def __init__(self):
        
        try:
            pass
        except:
            self.Avatar_initialized = 1
            Actor.Actor.__init__(self)
            self._Avatar__font = ToontownGlobals.getToonFont()
            self.soundChatBubble = base.loadSfx('phase_3/audio/sfx/GUI_balloon_popup.mp3')
            self._Avatar__nameVisible = 1
            self.nametag = NametagGroup()
            self.nametag.setAvatar(self)
            self.nametag.setFont(ToontownGlobals.getInterfaceFont())
            self.nametag2dContents = Nametag.CName | Nametag.CSpeech
            self.nametag2dDist = Nametag.CName | Nametag.CSpeech
            self.nametag3d = self.attachNewNode('nametag3d')
            self.dropShadows = []
            self.scale = 1.0
            self.nametagScale = 1.0
            self.height = 0.0
            self.name = ''
            self.style = None
            self.commonChatFlags = 0
            self.understandable = 1
            self.setPlayerType(NametagGroup.CCNormal)
            self._Avatar__chatParagraph = None
            self._Avatar__chatMessage = None
            self._Avatar__chatFlags = 0
            self._Avatar__chatPageNumber = None
            self._Avatar__chatAddressee = None
            self._Avatar__chatSet = 0
            self._Avatar__chatLocal = 0

        return None
예제 #4
0
    def __init__(self):
        try:
            self.Avatar_initialized
        except:
            self.Avatar_initialized = 1
            Actor.Actor.__init__(self)
            self.__font = ToontownGlobals.getToonFont()
            self.soundChatBubble = base.loadSfx(
                'phase_3/audio/sfx/GUI_balloon_popup.mp3')
            self.__nameVisible = 1
            self.nametag = NametagGroup()
            self.nametag.setAvatar(self)
            self.nametag.setFont(ToontownGlobals.getInterfaceFont())
            self.nametag2dContents = Nametag.CName | Nametag.CSpeech
            self.nametag2dDist = Nametag.CName | Nametag.CSpeech
            self.nametag3d = self.attachNewNode('nametag3d')
            self.dropShadows = []
            self.scale = 1.0
            self.nametagScale = 1.0
            self.height = 0.0
            self.name = ''
            self.style = None
            self.commonChatFlags = 0
            self.understandable = 1
            self.setPlayerType(NametagGroup.CCNormal)
            self.__chatParagraph = None
            self.__chatMessage = None
            self.__chatFlags = 0
            self.__chatPageNumber = None
            self.__chatAddressee = None
            self.__chatSet = 0
            self.__chatLocal = 0

        return None
        return
예제 #5
0
    def _RoguesGallery__makeGallery(self):
        self.gallery = hidden.attachNewNode('gallery')
        self.gallery.setDepthWrite(1)
        self.gallery.setDepthTest(1)
        self.suits = []
        self.actors = []
        self.text = TextNode('rogues')
        self.text.freeze()
        self.text.setFont(ToontownGlobals.getInterfaceFont())
        self.text.setAlign(TextNode.ACenter)
        self.text.setTextColor(0.0, 0.0, 0.0, 1.0)
        self.rowHeight = 0.0
        self.minXScale = None
        print "rognamestr='", self.rognamestr, "'\n"
        if self.rognamestr == None or len(self.rognamestr) == 0:
            for dept in AvatarDNA.suitDepts:
                self._RoguesGallery__makeDept(dept)

        else:
            self.suitRow = []
            self.rowWidth = 0.0
            self._RoguesGallery__makeSuit(None, None, self.rognamestr)
            self.minXScale = self.xRowSpace / self.rowWidth
            self.suits.append((self.rowWidth, self.suitRow))
            del self.suitRow
        self._RoguesGallery__rescaleSuits()
예제 #6
0
    def __init__(self, cr):
        try:
            self.LocalAvatar_initialized
        except:
            self.LocalAvatar_initialized = 1
            DistributedAvatar.DistributedAvatar.__init__(self, cr)
            DistributedSmoothNode.DistributedSmoothNode.__init__(self, cr)
            self.initializeCollisions()
            self.initializeSmartCamera()
            self.animMultiplier = 1.0
            self.customMessages = []
            self.soundRun = base.loadSfx(
                'phase_3.5/audio/sfx/AV_footstep_runloop.wav')
            self.soundWalk = base.loadSfx(
                'phase_3.5/audio/sfx/AV_footstep_walkloop.wav')
            self.soundWhisper = base.loadSfx(
                'phase_3.5/audio/sfx/GUI_whisper_3.mp3')
            self.positionExaminer = PositionExaminer.PositionExaminer()
            friendsGui = loader.loadModelOnce(
                'phase_3.5/models/gui/friendslist_gui')
            friendsButtonNormal = friendsGui.find('**/FriendsBox_Closed')
            friendsButtonPressed = friendsGui.find('**/FriendsBox_Rollover')
            friendsButtonRollover = friendsGui.find('**/FriendsBox_Rollover')
            self.bFriendsList = DirectButton(
                image=(friendsButtonNormal, friendsButtonPressed,
                       friendsButtonRollover),
                relief=None,
                pos=(1.192, 0, 0.875),
                scale=0.8,
                text=('', Localizer.FriendsListLabel,
                      Localizer.FriendsListLabel),
                text_scale=0.09,
                text_fg=Vec4(1, 1, 1, 1),
                text_shadow=Vec4(0, 0, 0, 1),
                text_pos=(0, -0.18),
                text_font=ToontownGlobals.getInterfaceFont(),
                command=self.sendFriendsListEvent)
            self.bFriendsList.hide()
            self.friendsListButtonActive = 0
            self.friendsListButtonObscured = 0
            friendsGui.removeNode()
            self.chatMgr = ChatManager.ChatManager()
            self.commonChatFlags = 0
            self.garbleChat = 1
            self.isPageUp = 0
            self.isPageDown = 0
            self.sleepFlag = 0
            self.movingFlag = 0
            self.lastNeedH = None
            self.accept('friendOnline', self.__friendOnline)
            self.accept('friendOffline', self.__friendOffline)
            self.accept('clickedWhisper', self.__clickedWhisper)
            self.sleepCallback = None
            self.accept('wakeup', self.wakeUp)

        return None
        return
 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')
예제 #8
0
 def fitLabel(self, label, lineNo = 0):
     text = label['text']
     label['text_scale'] = TEXT_SCALE
     label['text_wordwrap'] = TEXT_WORDWRAP
     if len(text) > 0:
         lines = text.split('\n')
         lineWidth = ToontownGlobals.getInterfaceFont().calcWidth(lines[lineNo])
         if lineWidth > 0:
             textScale = POSTER_WIDTH / lineWidth
             label['text_scale'] = min(TEXT_SCALE, textScale)
             label['text_wordwrap'] = max(TEXT_WORDWRAP, lineWidth + 0.050000000000000003)
예제 #9
0
 def displayWhisper(self, fromId, chatString, whisperType):
     sender = None
     if fromId != 0:
         sender = toonbase.tcr.identifyAvatar(fromId)
     if whisperType == WhisperPopup.WTNormal or whisperType == WhisperPopup.WTQuickTalker:
         if sender == None:
             return
         chatString = sender.getName() + ': ' + chatString
     whisper = WhisperPopup(chatString, ToontownGlobals.getInterfaceFont(),
                            whisperType)
     if sender != None:
         whisper.setClickable(sender.getName(), fromId)
     whisper.manage(toonbase.marginManager)
     base.playSfx(self.soundWhisper)
     return
예제 #10
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
예제 #11
0
    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
예제 #12
0
class NameGenerator:
    font = ToontownGlobals.getInterfaceFont()
    notify = DirectNotifyGlobal.directNotify.newCategory('NameGenerator')
    boyTitles = []
    girlTitles = []
    neutralTitles = []
    boyFirsts = []
    girlFirsts = []
    neutralFirsts = []
    capPrefixes = []
    lastPrefixes = []
    lastSuffixes = []

    def __init__(self):
        self.generateLists()
        return None

    def generateLists(self):
        self.boyTitles = []
        self.girlTitles = []
        self.neutralTitles = []
        self.boyFirsts = []
        self.girlFirsts = []
        self.neutralFirsts = []
        self.capPrefixes = []
        self.lastPrefixes = []
        self.lastSuffixes = []
        self.nameDictionary = {}
        searchPath = DSearchPath()
        searchPath.appendDirectory(Filename('phase_3/etc'))
        searchPath.appendDirectory(
            Filename.fromOsSpecific(
                os.path.expandvars('$TOONTOWN/src/configfiles')))
        filename = Filename(Localizer.NameShopNameMaster)
        if vfs:
            found = vfs.resolveFilename(filename, searchPath)
        else:
            found = filename.resolveFilename(searchPath)
        if not found:
            self.notify.error(
                'NameGenerator: Error opening name list text file.')

        if vfs:
            input = StreamReader(vfs.openReadFile(filename), 1)
        else:
            input = open(filename.toOsSpecific(), 'r')
        currentLine = input.readline()
        while currentLine:
            if currentLine.lstrip()[0:1] != '#':
                a1 = currentLine.find('*')
                a2 = currentLine.find('*', a1 + 1)
                self.nameDictionary[int(
                    currentLine[0:a1])] = (int(currentLine[a1 + 1:a2]),
                                           currentLine[a2 +
                                                       1:len(currentLine) - 1])

            currentLine = input.readline()
        masterList = [
            self.boyTitles, self.girlTitles, self.neutralTitles,
            self.boyFirsts, self.girlFirsts, self.neutralFirsts,
            self.capPrefixes, self.lastPrefixes, self.lastSuffixes
        ]
        for tu in self.nameDictionary.values():
            masterList[tu[0]].append(tu[1])

        return 1

    def returnUniqueID(self, name, listnumber):
        newtu = [(), (), ()]
        if listnumber == 0:
            newtu[0] = (0, name)
            newtu[1] = (1, name)
            newtu[2] = (2, name)
        elif listnumber == 1:
            newtu[0] = (3, name)
            newtu[1] = (4, name)
            newtu[2] = (5, name)
        elif listnumber == 2:
            newtu[0] = (6, name)
            newtu[1] = (7, name)
        else:
            newtu[0] = (8, name)
        for tu in self.nameDictionary.items():
            for g in newtu:
                if tu[1] == g:
                    return tu[0]

        return -1

    def findWidestInList(self, font, nameList):
        maxWidth = 0
        maxName = ''
        for name in nameList:
            width = font.calcWidth(name)
            if width > maxWidth:
                maxWidth = font.calcWidth(name)
                maxName = name

        print maxName + ' ' + str(maxWidth)
        return maxName

    def findWidestName(self):
        longestBoyTitle = self.findWidestInList(
            self.font, self.boyTitles + self.neutralTitles)
        longestGirlTitle = self.findWidestInList(
            self.font, self.girlTitles + self.neutralTitles)
        longestBoyFirst = self.findWidestInList(
            self.font, self.boyFirsts + self.neutralFirsts)
        longestGirlFirst = self.findWidestInList(
            self.font, self.girlFirsts + self.neutralFirsts)
        longestLastPrefix = self.findWidestInList(self.font, self.lastPrefixes)
        longestLastSuffix = self.findWidestInList(self.font, self.lastSuffixes)
        longestBoyFront = self.findWidestInList(
            self.font, [longestBoyTitle, longestBoyFirst])
        longestGirlFront = self.findWidestInList(
            self.font, [longestGirlTitle, longestGirlFirst])
        longestBoyName = longestBoyTitle + ' ' + longestBoyFirst + ' ' + longestLastPrefix + longestLastSuffix
        longestGirlName = longestGirlTitle + ' ' + longestGirlFirst + ' ' + longestLastPrefix + longestLastSuffix
        longestName = self.findWidestInList(self.font,
                                            [longestBoyName, longestGirlName])
        return longestName

    def findWidestTitleFirst(self):
        longestBoyTitle = self.findWidestInList(
            self.font, self.boyTitles + self.neutralTitles)
        longestGirlTitle = self.findWidestInList(
            self.font, self.girlTitles + self.neutralTitles)
        longestBoyFirst = self.findWidestInList(
            self.font, self.boyFirsts + self.neutralFirsts)
        longestGirlFirst = self.findWidestInList(
            self.font, self.girlFirsts + self.neutralFirsts)
        longestBoyName = longestBoyTitle + ' ' + longestBoyFirst
        longestGirlName = longestGirlTitle + ' ' + longestGirlFirst
        longestName = self.findWidestInList(self.font,
                                            [longestBoyName, longestGirlName])

    def findWidestTitle(self):
        widestTitle = self.findWidestInList(
            self.font, self.neutralTitles + self.boyTitles + self.girlTitles)
        return widestTitle

    def findWidestFirstName(self):
        widestFirst = self.findWidestInList(
            self.font, self.neutralFirsts + self.boyFirsts + self.girlFirsts)
        return widestFirst

    def findWidestLastName(self):
        longestLastPrefix = self.findWidestInList(self.font, self.lastPrefixes)
        longestLastSuffix = self.findWidestInList(self.font, self.lastSuffixes)
        longestLastName = longestLastPrefix + longestLastSuffix
        return longestLastName

    def findWidestNameWord(self):
        widestWord = self.findWidestInList(self.font, [
            self.findWidestTitle(),
            self.findWidestFirstName(),
            self.findWidestLastName()
        ])
        return widestWord

    def findWidestNameWidth(self):
        name = self.findWidestName()
        return self.font.calcWidth(name)

    def printWidestName(self):
        name = self.findWidestName()
        width = self.font.calcWidth(name)
        widthStr = str(width)
        print 'The widest name is: ' + name + ' (' + widthStr + ' units)'

    def printWidestLastName(self):
        name = self.findWidestLastName()
        width = self.font.calcWidth(name)
        widthStr = str(width)
        print 'The widest last name is: ' + name + ' (' + widthStr + ' units)'

    def randomName(self, boy=0, girl=0):
        if boy and girl:
            self.error("A name can't be both boy and girl!")

        if not boy and not girl:
            boy = whrandom.choice([0, 1])
            girl = not boy

        uberFlag = whrandom.choice([
            'title-first', 'title-last', 'first', 'last', 'first-last',
            'title-first-last'
        ])
        titleFlag = 0
        if uberFlag == 'title-first' and uberFlag == 'title-last' or uberFlag == 'title-first-last':
            titleFlag = 1

        firstFlag = 0
        if uberFlag == 'title-first' and uberFlag == 'first' and uberFlag == 'first-last' or uberFlag == 'title-first-last':
            firstFlag = 1

        lastFlag = 0
        if uberFlag == 'title-last' and uberFlag == 'last' and uberFlag == 'first-last' or uberFlag == 'title-first-last':
            lastFlag = 1

        retString = ''
        if titleFlag:
            titleList = self.neutralTitles[:]
            if boy:
                titleList += self.boyTitles
            elif girl:
                titleList += self.girlTitles
            else:
                self.error('Must be boy or girl.')
            retString += whrandom.choice(titleList) + ' '

        if firstFlag:
            firstList = self.neutralFirsts[:]
            if boy:
                firstList += self.boyFirsts
            elif girl:
                firstList += self.girlFirsts
            else:
                self.error('Must be boy or girl.')
            retString += whrandom.choice(firstList)
            if lastFlag:
                retString += ' '

        if lastFlag:
            lastPrefix = whrandom.choice(self.lastPrefixes)
            lastSuffix = whrandom.choice(self.lastSuffixes)
            if lastPrefix in self.capPrefixes:
                lastSuffix = lastSuffix.capitalize()

            retString += lastPrefix + lastSuffix

        return retString

    def randomNameMoreinfo(self, boy=0, girl=0):
        if boy and girl:
            self.error("A name can't be both boy and girl!")

        if not boy and not girl:
            boy = whrandom.choice([0, 1])
            girl = not boy

        uberFlag = whrandom.choice([
            'title-first', 'title-last', 'first', 'last', 'first-last',
            'title-first-last'
        ])
        titleFlag = 0
        if uberFlag == 'title-first' and uberFlag == 'title-last' or uberFlag == 'title-first-last':
            titleFlag = 1

        firstFlag = 0
        if uberFlag == 'title-first' and uberFlag == 'first' and uberFlag == 'first-last' or uberFlag == 'title-first-last':
            firstFlag = 1

        lastFlag = 0
        if uberFlag == 'title-last' and uberFlag == 'last' and uberFlag == 'first-last' or uberFlag == 'title-first-last':
            lastFlag = 1

        retString = ''
        uberReturn = [0, 0, 0, '', '', '', '']
        uberReturn[0] = titleFlag
        uberReturn[1] = firstFlag
        uberReturn[2] = lastFlag
        titleList = self.neutralTitles[:]
        if boy:
            titleList += self.boyTitles
        elif girl:
            titleList += self.girlTitles
        else:
            self.error('Must be boy or girl.')
        uberReturn[3] = whrandom.choice(titleList)
        firstList = self.neutralFirsts[:]
        if boy:
            firstList += self.boyFirsts
        elif girl:
            firstList += self.girlFirsts
        else:
            self.error('Must be boy or girl.')
        uberReturn[4] = whrandom.choice(firstList)
        lastPrefix = whrandom.choice(self.lastPrefixes)
        lastSuffix = whrandom.choice(self.lastSuffixes)
        if lastPrefix in self.capPrefixes:
            lastSuffix = lastSuffix.capitalize()

        uberReturn[5] = lastPrefix
        uberReturn[6] = lastSuffix
        if titleFlag:
            retString += uberReturn[3] + ' '

        if firstFlag:
            retString += uberReturn[4]
            if lastFlag:
                retString += ' '

        if lastFlag:
            retString += uberReturn[5] + uberReturn[6]

        uberReturn.append(retString)
        return uberReturn

    def printRandomNames(self, boy=0, girl=0, total=1):
        i = 0
        origBoy = boy
        origGirl = girl
        while i < total:
            if not origBoy and not origGirl:
                boy = whrandom.choice([0, 1])
                girl = not boy

            name = self.randomName(boy, girl)
            width = self.font.calcWidth(name)
            widthStr = str(width)
            if boy:
                print 'Boy: ' + name + ' (' + widthStr + ' units)'

            if girl:
                print 'Girl: ' + name + ' (' + widthStr + ' units)'

            i += 1

    def percentOver(self, limit=9.0, samples=1000):
        i = 0
        over = 0
        while i < samples:
            name = self.randomName()
            width = self.font.calcWidth(name)
            if width > limit:
                over += 1

            i += 1
        percent = (float(over) / float(samples)) * 100
        print 'Samples: ' + str(samples) + ' Over: ' + str(
            over) + ' Percent: ' + str(percent)

    def totalNames(self):
        firsts = len(self.boyFirsts) + len(self.girlFirsts) + len(
            self.neutralFirsts)
        print 'Total firsts: ' + str(firsts)
        lasts = len(self.lastPrefixes) * len(self.lastSuffixes)
        print 'Total lasts: ' + str(lasts)
        neutralTitleFirsts = len(self.neutralTitles) * len(self.neutralFirsts)
        boyTitleFirsts = len(self.boyTitles) * (len(self.neutralFirsts) + len(
            self.boyFirsts)) + len(self.neutralTitles) * len(self.boyFirsts)
        girlTitleFirsts = len(self.girlTitles) * (
            len(self.neutralFirsts) + len(self.girlFirsts)) + len(
                self.neutralTitles) * len(self.girlFirsts)
        totalTitleFirsts = neutralTitleFirsts + boyTitleFirsts + girlTitleFirsts
        print 'Total title firsts: ' + str(totalTitleFirsts)
        neutralTitleLasts = len(self.neutralTitles) * lasts
        boyTitleLasts = len(self.boyTitles) * lasts
        girlTitleLasts = len(self.girlTitles) * lasts
        totalTitleLasts = neutralTitleLasts + boyTitleFirsts + girlTitleLasts
        print 'Total title lasts: ' + str(totalTitleLasts)
        neutralFirstLasts = len(self.neutralFirsts) * lasts
        boyFirstLasts = len(self.boyFirsts) * lasts
        girlFirstLasts = len(self.girlFirsts) * lasts
        totalFirstLasts = neutralFirstLasts + boyFirstLasts + girlFirstLasts
        print 'Total first lasts: ' + str(totalFirstLasts)
        neutralTitleFirstLasts = neutralTitleFirsts * lasts
        boyTitleFirstLasts = boyTitleFirsts * lasts
        girlTitleFirstLasts = girlTitleFirsts * lasts
        totalTitleFirstLasts = neutralTitleFirstLasts + boyTitleFirstLasts + girlTitleFirstLasts
        print 'Total title first lasts: ' + str(totalTitleFirstLasts)
        totalNames = firsts + lasts + totalTitleFirsts + totalTitleLasts + totalFirstLasts + totalTitleFirstLasts
        print 'Total Names: ' + str(totalNames)
예제 #13
0
 def load(self):
     ShtikerPage.ShtikerPage.load(self)
     self.title = DirectLabel(parent = self, relief = None, text = Localizer.FishPageTitle, text_scale = 0.12, pos = (0, 0, 0.59999999999999998))
     self.fishPanel = DirectLabel(parent = self, pos = (0.45000000000000001, 0, 0), relief = None, state = NORMAL, image = getDefaultDialogGeom(), image_scale = (0.59999999999999998, 1, 0.59999999999999998), text = '', text_scale = 0.055, text_fg = (0, 0, 0, 1), text_pos = (0, 0.22500000000000001, 0), text_font = ToontownGlobals.getInterfaceFont(), text_wordwrap = 7.25)
     buttons = loader.loadModelOnce('phase_3/models/gui/dialog_box_buttons_gui')
     self.fishPanelCancel = DirectButton(parent = self.fishPanel, pos = (0.25, 0, -0.25), relief = None, state = NORMAL, image = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), image_scale = (0.59999999999999998, 1, 0.59999999999999998), command = self.hideFishPanel)
     self.fishPanel.hide()
     del buttons
     self.releasePanel = DirectFrame(relief = None, geom = getDefaultDialogGeom(), geom_color = ToontownGlobals.GlobalDialogColor, geom_scale = (1, 1, 1.75), text = Localizer.FishPageOverflow, text_pos = (0, 0.69999999999999996), text_scale = 0.070000000000000007, pos = (0, 0, 0))
     self.releasePanel.hide()
     self.newFishLabel = DirectLabel(parent = self.releasePanel, relief = None, text = Localizer.FishingItemFound, text_scale = 0.070000000000000007, pos = (-0.29999999999999999, 0, 0.45000000000000001))
     self.newFishButton = DirectButton(parent = self.releasePanel, text = '', text_scale = 0.070000000000000007, text_align = TextNode.ALeft, text1_bg = Vec4(1, 1, 0, 1), text2_bg = Vec4(0.5, 0.90000000000000002, 1, 1), text3_fg = Vec4(0.40000000000000002, 0.80000000000000004, 0.40000000000000002, 1), command = self.releaseFish, pos = (-0.25, 0, 0.32500000000000001))
     self.oldFishLabel = DirectLabel(parent = self.releasePanel, relief = None, text = Localizer.FishPageOldFish, text_scale = 0.070000000000000007, pos = (-0.22, 0, 0.155))
     self.makePicker()
     self.updatePage()
예제 #14
0
 def load(self):
     gui = loader.loadModelOnce('phase_3/models/gui/create_a_toon_gui')
     self.guiTopBar = DirectFrame(relief = None, image = gui.find('**/CrtATn_TopBar'), text = Localizer.CreateYourToon, text_font = ToontownGlobals.getSignFont(), text_fg = (0.0, 0.65000000000000002, 0.34999999999999998, 1), text_scale = 0.17999999999999999, text_pos = (0, -0.029999999999999999), pos = (0, 0, 0.85999999999999999))
     self.guiTopBar.hide()
     self.guiBottomBar = DirectFrame(relief = None, image = gui.find('**/CrtATn_BtmBar'), image_scale = (1.25, 1, 1), pos = (0.01, 0, -0.85999999999999999))
     self.guiBottomBar.hide()
     self.guiCheckButton = DirectButton(parent = self.guiBottomBar, relief = None, image = (gui.find('**/CrtAtoon_Btn1_UP'), gui.find('**/CrtAtoon_Btn1_DOWN'), gui.find('**/CrtAtoon_Btn1_RLLVR')), pos = (1.165, 0, -0.017999999999999999), command = self._MakeAToon__handleNext, text = ('', Localizer.MakeAToonDone, Localizer.MakeAToonDone), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.guiCheckButton.hide()
     self.guiCancelButton = DirectButton(parent = self.guiBottomBar, relief = None, image = (gui.find('**/CrtAtoon_Btn2_UP'), gui.find('**/CrtAtoon_Btn2_DOWN'), gui.find('**/CrtAtoon_Btn2_RLLVR')), pos = (-1.179, 0, -0.010999999999999999), command = self._MakeAToon__handleCancel, text = ('', Localizer.MakeAToonCancel, Localizer.MakeAToonCancel), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.guiCancelButton.hide()
     self.guiNextButton = DirectButton(parent = self.guiBottomBar, relief = None, image = (gui.find('**/CrtAtoon_Btn3_UP'), gui.find('**/CrtAtoon_Btn3_DN'), gui.find('**/CrtAtoon_Btn3_RLVR')), pos = (1.165, 0, -0.017999999999999999), command = self._MakeAToon__handleNext, text = ('', Localizer.MakeAToonNext, Localizer.MakeAToonNext), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.guiNextButton.hide()
     self.guiLastButton = DirectButton(parent = self.guiBottomBar, relief = None, image = (gui.find('**/CrtAtoon_Btn3_UP'), gui.find('**/CrtAtoon_Btn3_DN'), gui.find('**/CrtAtoon_Btn3_RLVR')), image_scale = (-1.0, 1, 1), pos = (0.82499999999999996, 0, -0.017999999999999999), command = self._MakeAToon__handleLast, text = ('', Localizer.MakeAToonLast, Localizer.MakeAToonLast), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.guiLastButton.hide()
     gui.removeNode()
     self.room = loader.loadModel('phase_3/models/gui/create_a_toon')
     self.roomWalls = self.room.find('**/wall_floor')
     self.draftingTable = self.room.find('**/drafting_table')
     self.easel = self.room.find('**/easel')
     self.sewingMachine = self.room.find('**/sewing_machine')
     ee = DirectFrame(pos = (-1, 1, 1), frameSize = (-0.01, 0.01, -0.01, 0.01), frameColor = (0, 0, 0, 0.050000000000000003), state = 'normal')
     ee.bind(B1PRESS, lambda x, ee = ee: self.toggleSlide())
     self.eee = ee
     self.stool = self.room.find('**/stool')
     self.stool.hide()
     self.draftingTable.hide()
     self.easel.hide()
     self.sewingMachine.hide()
     if not (self.warp):
         self.dna = AvatarDNA.AvatarDNA()
         animal = whrandom.choice(AvatarDNA.toonHeadAnimalIndices)
         head = AvatarDNA.toonHeadTypes[animal]
         torso = whrandom.choice(AvatarDNA.toonTorsoTypes[-3:])
         leg = whrandom.choice(AvatarDNA.toonLegTypes)
         self.dna.newToon((head, torso, leg, 'm'))
     else:
         self.dna = AvatarDNA.AvatarDNA()
         self.dna.makeFromNetString(self.namelessPotAv.dna)
     self.toon = Toon.Toon()
     self.toon.setDNA(self.dna)
     self.toon.useLOD(1000)
     self.toon.setNameVisible(0)
     self.toon.startBlink()
     self.toon.startLookAround()
     self.mickey = Char.Char()
     mickeyDNA = AvatarDNA.AvatarDNA()
     mickeyDNA.newChar('mk')
     self.mickey.setDNA(mickeyDNA)
     self.mickey.addActive()
     self.mickey.startEarTask()
     self.mickey.setNametagScale(0.80000000000000004)
     self.mickey.hideName()
     self.mickey.setPickable(1)
     self.mickey.nametag.getNametag3d().setChatWordwrap(8)
     self.minnie = Char.Char()
     minnieDNA = AvatarDNA.AvatarDNA()
     minnieDNA.newChar('mn')
     self.minnie.setDNA(minnieDNA)
     self.minnie.addActive()
     self.minnie.startEarTask()
     self.minnie.setNametagScale(0.80000000000000004)
     self.minnie.hideName()
     self.minnie.setPickable(1)
     self.minnie.nametag.getNametag3d().setChatWordwrap(8)
     self.gs.load()
     self.bs.load()
     self.cos.load()
     self.cls.load()
     self.ns.load()
     self.music = base.loadMusic('phase_3/audio/bgm/create_a_toon.mid')
     self.soundBack = base.loadSfx('phase_3/audio/sfx/GUI_create_toon_back.mp3')
     return None
예제 #15
0
 def __init__(self, trackId, callback):
     DirectFrame.__init__(self, relief=None)
     self.initialiseoptions(TrackPoster)
     bookModel = loader.loadModelOnce(
         'phase_3.5/models/gui/stickerbook_gui')
     trackName = ToontownBattleGlobals.Tracks[trackId].capitalize()
     self.poster = DirectFrame(parent=self,
                               relief=None,
                               image=bookModel.find('**/questCard'),
                               image_scale=(0.80000000000000004,
                                            0.57999999999999996,
                                            0.57999999999999996))
     invModel = loader.loadModelOnce('phase_3.5/models/gui/inventory_icons')
     iconGeom = invModel.find('**/' +
                              ToontownBattleGlobals.AvPropsNew[trackId][1])
     invModel.removeNode()
     self.pictureFrame = DirectFrame(
         parent=self.poster,
         relief=None,
         image=bookModel.find('**/questPictureFrame'),
         image_scale=0.25,
         image_color=(0.45000000000000001, 0.80000000000000004,
                      0.45000000000000001, 1),
         text=trackName,
         text_font=ToontownGlobals.getInterfaceFont(),
         text_pos=(0, -0.16),
         text_fg=self.normalTextColor,
         text_scale=0.050000000000000003,
         text_align=TextNode.ACenter,
         text_wordwrap=8.0,
         textMayChange=0,
         geom=iconGeom,
         pos=(-0.20000000000000001, 0, 0.059999999999999998))
     bookModel.removeNode()
     if trackId == ToontownBattleGlobals.HEAL_TRACK:
         help = Localizer.TrackChoiceGuiHEAL
     elif trackId == ToontownBattleGlobals.TRAP_TRACK:
         help = Localizer.TrackChoiceGuiTRAP
     elif trackId == ToontownBattleGlobals.LURE_TRACK:
         help = Localizer.TrackChoiceGuiLURE
     elif trackId == ToontownBattleGlobals.SOUND_TRACK:
         help = Localizer.TrackChoiceGuiSOUND
     elif trackId == ToontownBattleGlobals.DROP_TRACK:
         help = Localizer.TrackChoiceGuiDROP
     else:
         help = ''
     self.helpText = DirectFrame(
         parent=self.poster,
         relief=None,
         text=help,
         text_font=ToontownGlobals.getInterfaceFont(),
         text_fg=self.normalTextColor,
         text_scale=0.050000000000000003,
         text_align=TextNode.ALeft,
         text_wordwrap=8.0,
         textMayChange=0,
         pos=(-0.050000000000000003, 0, 0.14000000000000001))
     guiButton = loader.loadModelOnce('phase_3/models/gui/quit_button')
     self.chooseButton = DirectButton(
         parent=self.poster,
         relief=None,
         image=(guiButton.find('**/QuitBtn_UP'),
                guiButton.find('**/QuitBtn_DN'),
                guiButton.find('**/QuitBtn_RLVR')),
         image_scale=(0.69999999999999996, 1, 1),
         text=Localizer.TrackChoiceGuiChoose,
         text_scale=0.059999999999999998,
         text_pos=(0, -0.02),
         command=callback,
         extraArgs=[trackId],
         pos=(0, 0, -0.16),
         scale=0.80000000000000004)
     guiButton.removeNode()
예제 #16
0
 def load(self):
     ClothesGUI.ClothesGUI.load(self)
     self.cancelButton = DirectButton(relief = None, image = (self.gui.find('**/CrtAtoon_Btn2_UP'), self.gui.find('**/CrtAtoon_Btn2_DOWN'), self.gui.find('**/CrtAtoon_Btn2_RLLVR')), pos = (0.14999999999999999, 0, -0.84999999999999998), command = self._ClosetGUI__handleCancel, text = ('', Localizer.MakeAToonCancel, Localizer.MakeAToonCancel), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.cancelButton.hide()
     if self.isOwner:
         trashcanGui = loader.loadModel('phase_3/models/gui/trashcan_gui.bam')
         trashImage = (trashcanGui.find('**/TrashCan_CLSD'), trashcanGui.find('**/TrashCan_OPEN'), trashcanGui.find('**/TrashCan_RLVR'))
         self.topTrashButton = DirectButton(image = trashImage, relief = None, text_scale = 0.14999999999999999, text_pos = (0.0, -0.10000000000000001), textMayChange = 0, pos = (0.67000000000000004, 0, 0.040000000000000001), command = self._ClosetGUI__handleDelete, extraArgs = [
             ClosetGlobals.SHIRT], scale = (0.5, 0.5, 0.5))
         self.bottomTrashButton = DirectButton(image = trashImage, relief = None, text_scale = 0.14999999999999999, text_pos = (0.0, -0.10000000000000001), textMayChange = 0, pos = (0.67000000000000004, 0, -0.35999999999999999), command = self._ClosetGUI__handleDelete, extraArgs = [
             ClosetGlobals.SHORTS], scale = (0.5, 0.5, 0.5))
         self.button = DirectButton(relief = None, image = (self.gui.find('**/CrtAtoon_Btn1_UP'), self.gui.find('**/CrtAtoon_Btn1_DOWN'), self.gui.find('**/CrtAtoon_Btn1_RLLVR')), pos = (-0.14999999999999999, 0, -0.84999999999999998), command = self._ClosetGUI__handleButton, text = ('', Localizer.MakeAToonDone, Localizer.MakeAToonDone), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
         trashcanGui.removeNode()
예제 #17
0
    def __init__(self, av=None, position=0, paid=0):
        DirectButton.__init__(self,
                              relief=None,
                              text='',
                              text_font=ToontownGlobals.getSignFont())
        self.initialiseoptions(AvatarChoice)
        self.hasPaid = paid
        if not av:
            self.create = 1
            self.name = ''
            self.dna = None
        else:
            self.create = 0
            self.name = av.name
            self.dna = AvatarDNA.AvatarDNA(av.dna)
            self.wantName = av.wantName
            self.approvedName = av.approvedName
            self.rejectedName = av.rejectedName
            self.allowedName = av.allowedName
        self.position = position
        self.doneEvent = 'avChoicePanel-' + str(self.position)
        self.deleteWithPasswordFrame = None
        self.pickAToonGui = loader.loadModelOnce(
            'phase_3/models/gui/pick_a_toon_gui')
        self['image'] = self.pickAToonGui.find('**/av-chooser_Square_UP')
        self.setScale(1.01)
        if self.create:
            self['command'] = self._AvatarChoice__handleCreate
            self['text'] = (Localizer.AvatarChoiceMakeAToon, )
            self['text_pos'] = (0, 0)
            self['text0_scale'] = 0.10000000000000001
            self['text1_scale'] = 0.12
            self['text2_scale'] = 0.12
            self['text0_fg'] = (0, 1, 0.80000000000000004, 0.5)
            self['text1_fg'] = (0, 1, 0.80000000000000004, 1)
            self['text2_fg'] = (0.29999999999999999, 1, 0.90000000000000002, 1)
        else:
            self['command'] = self._AvatarChoice__handleChoice
            self['text'] = ('', Localizer.AvatarChoicePlayThisToon,
                            Localizer.AvatarChoicePlayThisToon)
            self['text_scale'] = 0.12
            self['text_fg'] = (1, 0.90000000000000002, 0.10000000000000001, 1)
            self.nameText = DirectLabel(
                parent=self,
                relief=None,
                scale=0.089999999999999997,
                pos=(0, 0, 0.27000000000000002),
                text=self.name,
                text_fg=(1, 1, 1, 1),
                text_shadow=(0, 0, 0, 1),
                text_wordwrap=7.5,
                text_font=ToontownGlobals.getToonFont(),
                state=DISABLED)
            if self.approvedName != '':
                self.nameText['text'] = self.approvedName

            guiButton = loader.loadModelOnce('phase_3/models/gui/quit_button')
            self.nameYourToonButton = DirectButton(
                parent=self,
                relief=None,
                image=(guiButton.find('**/QuitBtn_UP'),
                       guiButton.find('**/QuitBtn_DN'),
                       guiButton.find('**/QuitBtn_RLVR')),
                text=(Localizer.AvatarChoiceNameYourToon,
                      Localizer.AvatarChoiceNameYourToon,
                      Localizer.AvatarChoiceNameYourToon),
                text_fg=(1, 1, 1, 1),
                text_shadow=(0, 0, 0, 1),
                text_scale=0.14999999999999999,
                text_pos=(0, 0.029999999999999999),
                text_font=ToontownGlobals.getInterfaceFont(),
                pos=(-0.20000000000000001, 0, -0.29999999999999999),
                scale=0.45000000000000001,
                image_scale=(2, 1, 3),
                command=self._AvatarChoice__handleNameYourToon)
            guiButton.removeNode()
            self.statusText = DirectLabel(
                parent=self,
                relief=None,
                scale=0.089999999999999997,
                pos=(0, 0, -0.23999999999999999),
                text='',
                text_fg=(1, 1, 1, 1),
                text_shadow=(0, 0, 0, 1),
                text_wordwrap=7.5,
                text_font=ToontownGlobals.getToonFont(),
                state=DISABLED)
            if self.wantName != '':
                self.nameYourToonButton.hide()
                self.statusText['text'] = Localizer.AvatarChoiceNameReview
            elif self.approvedName != '':
                self.nameYourToonButton.hide()
                self.statusText['text'] = Localizer.AvatarChoiceNameApproved
            elif self.rejectedName != '':
                self.nameYourToonButton.hide()
                self.statusText['text'] = Localizer.AvatarChoiceNameRejected
            elif self.allowedName == 1 and toonbase.tcr.allowFreeNames(
            ) or self.hasPaid:
                self.nameYourToonButton.show()
                self.statusText['text'] = ''
            else:
                self.nameYourToonButton.hide()
                self.statusText['text'] = ''
            self.head = hidden.attachNewNode('head')
            self.head.setPosHprScale(0, 5, -0.10000000000000001, 180, 0, 0,
                                     0.23999999999999999, 0.23999999999999999,
                                     0.23999999999999999)
            self.head.reparentTo(self.stateNodePath[0], 20)
            self.head.instanceTo(self.stateNodePath[1], 20)
            self.head.instanceTo(self.stateNodePath[2], 20)
            self.headModel = ToonHead.ToonHead()
            self.headModel.setupHead(self.dna, forGui=1)
            self.headModel.reparentTo(self.head)
            self.headModel.startBlink()
            self.headModel.startLookAround()
            trashcanGui = loader.loadModelOnce(
                'phase_3/models/gui/trashcan_gui')
            self.deleteButton = DirectButton(
                parent=self,
                image=(trashcanGui.find('**/TrashCan_CLSD'),
                       trashcanGui.find('**/TrashCan_OPEN'),
                       trashcanGui.find('**/TrashCan_RLVR')),
                text=('', Localizer.AvatarChoiceDelete,
                      Localizer.AvatarChoiceDelete),
                text_fg=(1, 1, 1, 1),
                text_shadow=(0, 0, 0, 1),
                text_scale=0.14999999999999999,
                text_pos=(0, -0.10000000000000001),
                text_font=ToontownGlobals.getInterfaceFont(),
                relief=None,
                pos=(0.27000000000000002, 0, -0.25),
                scale=0.45000000000000001,
                command=self._AvatarChoice__handleDelete)
            trashcanGui.removeNode()
        self.resetFrameSize()
        return None
예제 #18
0
 def load(self):
     gui = loader.loadModelOnce('phase_3/models/gui/laff_o_meter')
     if self.isToon:
         hType = self.style.getType()
         if hType == 'dog':
             headModel = gui.find('**/doghead')
         else:
             if hType == 'cat':
                 headModel = gui.find('**/cathead')
             else:
                 if hType == 'mouse':
                     headModel = gui.find('**/mousehead')
                 else:
                     if hType == 'horse':
                         headModel = gui.find('**/horsehead')
                     else:
                         if hType == 'rabbit':
                             headModel = gui.find('**/bunnyhead')
                         else:
                             if hType == 'fowl':
                                 headModel = gui.find('**/duckhead')
                             else:
                                 raise StandardError(
                                     'unknown toon species: ', hType)
         self.color = self.style.getHeadColor()
         self.container['image'] = headModel
         self.container['image_color'] = self.color
         self.resetFrameSize()
         self.setScale(0.1)
         self.frown = DirectFrame(parent=self.container,
                                  relief=None,
                                  image=gui.find('**/frown'))
         self.smile = DirectFrame(parent=self.container,
                                  relief=None,
                                  image=gui.find('**/smile'))
         self.eyes = DirectFrame(parent=self.container,
                                 relief=None,
                                 image=gui.find('**/eyes'))
         self.openSmile = DirectFrame(parent=self.container,
                                      relief=None,
                                      image=gui.find('**/open_smile'))
         self.tooth1 = DirectFrame(parent=self.openSmile,
                                   relief=None,
                                   image=gui.find('**/tooth_1'))
         self.tooth2 = DirectFrame(parent=self.openSmile,
                                   relief=None,
                                   image=gui.find('**/tooth_2'))
         self.tooth3 = DirectFrame(parent=self.openSmile,
                                   relief=None,
                                   image=gui.find('**/tooth_3'))
         self.tooth4 = DirectFrame(parent=self.openSmile,
                                   relief=None,
                                   image=gui.find('**/tooth_4'))
         self.tooth5 = DirectFrame(parent=self.openSmile,
                                   relief=None,
                                   image=gui.find('**/tooth_5'))
         self.tooth6 = DirectFrame(parent=self.openSmile,
                                   relief=None,
                                   image=gui.find('**/tooth_6'))
         self.maxLabel = DirectLabel(
             parent=self.eyes,
             relief=None,
             pos=(0.442, 0, 0.051),
             text='120',
             text_scale=0.4,
             text_font=ToontownGlobals.getInterfaceFont())
         self.hpLabel = DirectLabel(
             parent=self.eyes,
             relief=None,
             pos=(-0.398, 0, 0.051),
             text='120',
             text_scale=0.4,
             text_font=ToontownGlobals.getInterfaceFont())
         self.teeth = [
             self.tooth6, self.tooth5, self.tooth4, self.tooth3,
             self.tooth2, self.tooth1
         ]
         self.fractions = [0.0, 0.166666, 0.333333, 0.5, 0.666666, 0.833333]
     gui.removeNode()
     return
 def load(self):
     ShtikerPage.ShtikerPage.load(self)
     self.title = DirectLabel(parent=self,
                              relief=None,
                              text=Localizer.FishPageTitle,
                              text_scale=0.12,
                              pos=(0, 0, 0.59999999999999998))
     self.fishPanel = DirectLabel(
         parent=self,
         pos=(0.45000000000000001, 0, 0),
         relief=None,
         state=NORMAL,
         image=getDefaultDialogGeom(),
         image_scale=(0.59999999999999998, 1, 0.59999999999999998),
         text='',
         text_scale=0.055,
         text_fg=(0, 0, 0, 1),
         text_pos=(0, 0.22500000000000001, 0),
         text_font=ToontownGlobals.getInterfaceFont(),
         text_wordwrap=7.25)
     buttons = loader.loadModelOnce(
         'phase_3/models/gui/dialog_box_buttons_gui')
     self.fishPanelCancel = DirectButton(
         parent=self.fishPanel,
         pos=(0.25, 0, -0.25),
         relief=None,
         state=NORMAL,
         image=(buttons.find('**/CloseBtn_UP'),
                buttons.find('**/CloseBtn_DN'),
                buttons.find('**/CloseBtn_Rllvr')),
         image_scale=(0.59999999999999998, 1, 0.59999999999999998),
         command=self.hideFishPanel)
     self.fishPanel.hide()
     del buttons
     self.releasePanel = DirectFrame(
         relief=None,
         geom=getDefaultDialogGeom(),
         geom_color=ToontownGlobals.GlobalDialogColor,
         geom_scale=(1, 1, 1.75),
         text=Localizer.FishPageOverflow,
         text_pos=(0, 0.69999999999999996),
         text_scale=0.070000000000000007,
         pos=(0, 0, 0))
     self.releasePanel.hide()
     self.newFishLabel = DirectLabel(parent=self.releasePanel,
                                     relief=None,
                                     text=Localizer.FishingItemFound,
                                     text_scale=0.070000000000000007,
                                     pos=(-0.29999999999999999, 0,
                                          0.45000000000000001))
     self.newFishButton = DirectButton(
         parent=self.releasePanel,
         text='',
         text_scale=0.070000000000000007,
         text_align=TextNode.ALeft,
         text1_bg=Vec4(1, 1, 0, 1),
         text2_bg=Vec4(0.5, 0.90000000000000002, 1, 1),
         text3_fg=Vec4(0.40000000000000002, 0.80000000000000004,
                       0.40000000000000002, 1),
         command=self.releaseFish,
         pos=(-0.25, 0, 0.32500000000000001))
     self.oldFishLabel = DirectLabel(parent=self.releasePanel,
                                     relief=None,
                                     text=Localizer.FishPageOldFish,
                                     text_scale=0.070000000000000007,
                                     pos=(-0.22, 0, 0.155))
     self.makePicker()
     self.updatePage()
예제 #20
0
 def __init__(self, trackId, callback):
     DirectFrame.__init__(self, relief = None)
     self.initialiseoptions(TrackPoster)
     bookModel = loader.loadModelOnce('phase_3.5/models/gui/stickerbook_gui')
     trackName = ToontownBattleGlobals.Tracks[trackId].capitalize()
     self.poster = DirectFrame(parent = self, relief = None, image = bookModel.find('**/questCard'), image_scale = (0.80000000000000004, 0.57999999999999996, 0.57999999999999996))
     invModel = loader.loadModelOnce('phase_3.5/models/gui/inventory_icons')
     iconGeom = invModel.find('**/' + ToontownBattleGlobals.AvPropsNew[trackId][1])
     invModel.removeNode()
     self.pictureFrame = DirectFrame(parent = self.poster, relief = None, image = bookModel.find('**/questPictureFrame'), image_scale = 0.25, image_color = (0.45000000000000001, 0.80000000000000004, 0.45000000000000001, 1), text = trackName, text_font = ToontownGlobals.getInterfaceFont(), text_pos = (0, -0.16), text_fg = self.normalTextColor, text_scale = 0.050000000000000003, text_align = TextNode.ACenter, text_wordwrap = 8.0, textMayChange = 0, geom = iconGeom, pos = (-0.20000000000000001, 0, 0.059999999999999998))
     bookModel.removeNode()
     if trackId == ToontownBattleGlobals.HEAL_TRACK:
         help = Localizer.TrackChoiceGuiHEAL
     elif trackId == ToontownBattleGlobals.TRAP_TRACK:
         help = Localizer.TrackChoiceGuiTRAP
     elif trackId == ToontownBattleGlobals.LURE_TRACK:
         help = Localizer.TrackChoiceGuiLURE
     elif trackId == ToontownBattleGlobals.SOUND_TRACK:
         help = Localizer.TrackChoiceGuiSOUND
     elif trackId == ToontownBattleGlobals.DROP_TRACK:
         help = Localizer.TrackChoiceGuiDROP
     else:
         help = ''
     self.helpText = DirectFrame(parent = self.poster, relief = None, text = help, text_font = ToontownGlobals.getInterfaceFont(), text_fg = self.normalTextColor, text_scale = 0.050000000000000003, text_align = TextNode.ALeft, text_wordwrap = 8.0, textMayChange = 0, pos = (-0.050000000000000003, 0, 0.14000000000000001))
     guiButton = loader.loadModelOnce('phase_3/models/gui/quit_button')
     self.chooseButton = DirectButton(parent = self.poster, relief = None, image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale = (0.69999999999999996, 1, 1), text = Localizer.TrackChoiceGuiChoose, text_scale = 0.059999999999999998, text_pos = (0, -0.02), command = callback, extraArgs = [
         trackId], pos = (0, 0, -0.16), scale = 0.80000000000000004)
     guiButton.removeNode()
예제 #21
0
 def __init__(self, av = None, position = 0, paid = 0):
     DirectButton.__init__(self, relief = None, text = '', text_font = ToontownGlobals.getSignFont())
     self.initialiseoptions(AvatarChoice)
     self.hasPaid = paid
     if not av:
         self.create = 1
         self.name = ''
         self.dna = None
     else:
         self.create = 0
         self.name = av.name
         self.dna = AvatarDNA.AvatarDNA(av.dna)
         self.wantName = av.wantName
         self.approvedName = av.approvedName
         self.rejectedName = av.rejectedName
         self.allowedName = av.allowedName
     self.position = position
     self.doneEvent = 'avChoicePanel-' + str(self.position)
     self.deleteWithPasswordFrame = None
     self.pickAToonGui = loader.loadModelOnce('phase_3/models/gui/pick_a_toon_gui')
     self['image'] = self.pickAToonGui.find('**/av-chooser_Square_UP')
     self.setScale(1.01)
     if self.create:
         self['command'] = self._AvatarChoice__handleCreate
         self['text'] = (Localizer.AvatarChoiceMakeAToon,)
         self['text_pos'] = (0, 0)
         self['text0_scale'] = 0.10000000000000001
         self['text1_scale'] = 0.12
         self['text2_scale'] = 0.12
         self['text0_fg'] = (0, 1, 0.80000000000000004, 0.5)
         self['text1_fg'] = (0, 1, 0.80000000000000004, 1)
         self['text2_fg'] = (0.29999999999999999, 1, 0.90000000000000002, 1)
     else:
         self['command'] = self._AvatarChoice__handleChoice
         self['text'] = ('', Localizer.AvatarChoicePlayThisToon, Localizer.AvatarChoicePlayThisToon)
         self['text_scale'] = 0.12
         self['text_fg'] = (1, 0.90000000000000002, 0.10000000000000001, 1)
         self.nameText = DirectLabel(parent = self, relief = None, scale = 0.089999999999999997, pos = (0, 0, 0.27000000000000002), text = self.name, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_wordwrap = 7.5, text_font = ToontownGlobals.getToonFont(), state = DISABLED)
         if self.approvedName != '':
             self.nameText['text'] = self.approvedName
         
         guiButton = loader.loadModelOnce('phase_3/models/gui/quit_button')
         self.nameYourToonButton = DirectButton(parent = self, relief = None, image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), text = (Localizer.AvatarChoiceNameYourToon, Localizer.AvatarChoiceNameYourToon, Localizer.AvatarChoiceNameYourToon), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_scale = 0.14999999999999999, text_pos = (0, 0.029999999999999999), text_font = ToontownGlobals.getInterfaceFont(), pos = (-0.20000000000000001, 0, -0.29999999999999999), scale = 0.45000000000000001, image_scale = (2, 1, 3), command = self._AvatarChoice__handleNameYourToon)
         guiButton.removeNode()
         self.statusText = DirectLabel(parent = self, relief = None, scale = 0.089999999999999997, pos = (0, 0, -0.23999999999999999), text = '', text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_wordwrap = 7.5, text_font = ToontownGlobals.getToonFont(), state = DISABLED)
         if self.wantName != '':
             self.nameYourToonButton.hide()
             self.statusText['text'] = Localizer.AvatarChoiceNameReview
         elif self.approvedName != '':
             self.nameYourToonButton.hide()
             self.statusText['text'] = Localizer.AvatarChoiceNameApproved
         elif self.rejectedName != '':
             self.nameYourToonButton.hide()
             self.statusText['text'] = Localizer.AvatarChoiceNameRejected
         elif self.allowedName == 1 and toonbase.tcr.allowFreeNames() or self.hasPaid:
             self.nameYourToonButton.show()
             self.statusText['text'] = ''
         else:
             self.nameYourToonButton.hide()
             self.statusText['text'] = ''
         self.head = hidden.attachNewNode('head')
         self.head.setPosHprScale(0, 5, -0.10000000000000001, 180, 0, 0, 0.23999999999999999, 0.23999999999999999, 0.23999999999999999)
         self.head.reparentTo(self.stateNodePath[0], 20)
         self.head.instanceTo(self.stateNodePath[1], 20)
         self.head.instanceTo(self.stateNodePath[2], 20)
         self.headModel = ToonHead.ToonHead()
         self.headModel.setupHead(self.dna, forGui = 1)
         self.headModel.reparentTo(self.head)
         self.headModel.startBlink()
         self.headModel.startLookAround()
         trashcanGui = loader.loadModelOnce('phase_3/models/gui/trashcan_gui')
         self.deleteButton = DirectButton(parent = self, image = (trashcanGui.find('**/TrashCan_CLSD'), trashcanGui.find('**/TrashCan_OPEN'), trashcanGui.find('**/TrashCan_RLVR')), text = ('', Localizer.AvatarChoiceDelete, Localizer.AvatarChoiceDelete), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_scale = 0.14999999999999999, text_pos = (0, -0.10000000000000001), text_font = ToontownGlobals.getInterfaceFont(), relief = None, pos = (0.27000000000000002, 0, -0.25), scale = 0.45000000000000001, command = self._AvatarChoice__handleDelete)
         trashcanGui.removeNode()
     self.resetFrameSize()
     return None