當前位置: 首頁>>代碼示例>>Python>>正文


Python toon.ToonDNA類代碼示例

本文整理匯總了Python中toontown.toon.ToonDNA的典型用法代碼示例。如果您正苦於以下問題:Python ToonDNA類的具體用法?Python ToonDNA怎麽用?Python ToonDNA使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ToonDNA類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setupScrollInterface

 def setupScrollInterface(self):
     self.dna = self.toon.getStyle()
     gender = self.dna.getGender()
     if gender != self.gender:
         self.tops = ToonDNA.getRandomizedTops(gender, tailorId=ToonDNA.MAKE_A_TOON)
         self.bottoms = ToonDNA.getRandomizedBottoms(gender, tailorId=ToonDNA.MAKE_A_TOON)
         self.gender = gender
         self.topChoice = 0
         self.bottomChoice = 0
     self.setupButtons()
開發者ID:MasterLoopyBM,項目名稱:c0d3,代碼行數:10,代碼來源:MakeClothesGUI.py

示例2: __swapTorso

 def __swapTorso(self, offset):
     gender = self.toon.style.getGender()
     if not self.clothesPicked:
         length = len(ToonDNA.toonTorsoTypes[6:])
         torsoOffset = 6
     elif gender == "m":
         length = len(ToonDNA.toonTorsoTypes[:3])
         torsoOffset = 0
         if self.toon.style.topTex not in ToonDNA.MakeAToonBoyShirts:
             randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON)
             shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt
             self.toon.style.topTex = shirtTex
             self.toon.style.topTexColor = shirtColor
             self.toon.style.sleeveTex = sleeveTex
             self.toon.style.sleeveTexColor = sleeveColor
         if self.toon.style.botTex not in ToonDNA.MakeAToonBoyBottoms:
             botTex, botTexColor = ToonDNA.getRandomBottom(gender, ToonDNA.MAKE_A_TOON)
             self.toon.style.botTex = botTex
             self.toon.style.botTexColor = botTexColor
     else:
         length = len(ToonDNA.toonTorsoTypes[3:6])
         if self.toon.style.torso[1] == "d":
             torsoOffset = 3
         else:
             torsoOffset = 0
         if self.toon.style.topTex not in ToonDNA.MakeAToonGirlShirts:
             randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON)
             shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt
             self.toon.style.topTex = shirtTex
             self.toon.style.topTexColor = shirtColor
             self.toon.style.sleeveTex = sleeveTex
             self.toon.style.sleeveTexColor = sleeveColor
         if self.toon.style.botTex not in ToonDNA.MakeAToonGirlBottoms:
             if self.toon.style.torso[1] == "d":
                 botTex, botTexColor = ToonDNA.getRandomBottom(
                     gender, ToonDNA.MAKE_A_TOON, girlBottomType=ToonDNA.SKIRT
                 )
                 self.toon.style.botTex = botTex
                 self.toon.style.botTexColor = botTexColor
                 torsoOffset = 3
             else:
                 botTex, botTexColor = ToonDNA.getRandomBottom(
                     gender, ToonDNA.MAKE_A_TOON, girlBottomType=ToonDNA.SHORTS
                 )
                 self.toon.style.botTex = botTex
                 self.toon.style.botTexColor = botTexColor
                 torsoOffset = 0
     self.torsoChoice = (self.torsoChoice + offset) % length
     self.__updateScrollButtons(self.torsoChoice, length, self.torsoStart, self.torsoLButton, self.torsoRButton)
     torso = ToonDNA.toonTorsoTypes[torsoOffset + self.torsoChoice]
     self.dna.torso = torso
     self.toon.swapToonTorso(torso)
     self.toon.loop("neutral", 0)
     self.toon.swapToonColor(self.dna)
開發者ID:BmanGames,項目名稱:ToontownStride,代碼行數:54,代碼來源:BodyShop.py

示例3: changeBody

 def changeBody(self):
     newChoice = self.shuffleButton.getCurrChoice()
     newHead = newChoice[0]
     newSpeciesIndex = ToonDNA.toonSpeciesTypes.index(ToonDNA.getSpecies(newHead))
     newHeadIndex = ToonDNA.toonHeadTypes.index(newHead) - ToonDNA.getHeadStartIndex(ToonDNA.getSpecies(newHead))
     newTorsoIndex = ToonDNA.toonTorsoTypes.index(newChoice[1])
     newLegsIndex = ToonDNA.toonLegTypes.index(newChoice[2])
     oldHead = self.toon.style.head
     oldSpeciesIndex = ToonDNA.toonSpeciesTypes.index(ToonDNA.getSpecies(oldHead))
     oldHeadIndex = ToonDNA.toonHeadTypes.index(oldHead) - ToonDNA.getHeadStartIndex(ToonDNA.getSpecies(oldHead))
     oldTorsoIndex = ToonDNA.toonTorsoTypes.index(self.toon.style.torso)
     oldLegsIndex = ToonDNA.toonLegTypes.index(self.toon.style.legs)
     self.__swapSpecies(newSpeciesIndex - oldSpeciesIndex)
     self.__swapHead(newHeadIndex - oldHeadIndex)
     self.__swapTorso(newTorsoIndex - oldTorsoIndex)
     self.__swapLegs(newLegsIndex - oldLegsIndex)
開發者ID:AdrianF98,項目名稱:Toontown-Rewritten,代碼行數:16,代碼來源:BodyShop.py

示例4: enter

 def enter(self, toon, shopsVisited = []):
     base.disableMouse()
     self.toon = toon
     self.dna = self.toon.getStyle()
     gender = self.toon.style.getGender()
     self.speciesStart = self.getSpeciesStart()
     self.speciesChoice = self.speciesStart
     self.headStart = 0
     self.headChoice = ToonDNA.toonHeadTypes.index(self.dna.head) - ToonDNA.getHeadStartIndex(self.species)
     self.torsoStart = 0
     self.torsoChoice = ToonDNA.toonTorsoTypes.index(self.dna.torso) % 3
     self.legStart = 0
     self.legChoice = ToonDNA.toonLegTypes.index(self.dna.legs)
     if CLOTHESSHOP in shopsVisited:
         self.clothesPicked = 1
     else:
         self.clothesPicked = 0
     self.clothesPicked = 1
     if gender == 'm' or ToonDNA.GirlBottoms[self.dna.botTex][1] == ToonDNA.SHORTS:
         torsoStyle = 's'
         torsoPool = ToonDNA.toonTorsoTypes[:3]
     else:
         torsoStyle = 'd'
         torsoPool = ToonDNA.toonTorsoTypes[3:6]
     self.__swapSpecies(0)
     self.__swapHead(0)
     self.__swapTorso(0)
     self.__swapLegs(0)
     choicePool = [ToonDNA.toonHeadTypes, torsoPool, ToonDNA.toonLegTypes]
     self.shuffleButton.setChoicePool(choicePool)
     self.accept(self.shuffleFetchMsg, self.changeBody)
     self.acceptOnce('last', self.__handleBackward)
     self.accept('next', self.__handleForward)
     self.acceptOnce('MAT-newToonCreated', self.shuffleButton.cleanHistory)
     self.restrictHeadType(self.dna.head)
開發者ID:AdrianF98,項目名稱:Toontown-Rewritten,代碼行數:35,代碼來源:BodyShop.py

示例5: callback

        def callback(dclass, fields):
            if dclass is None:
                return request.result(None)

            if dclass.getName() is None:
                return request.result(None)

            name = fields['setName'][0]
            hp = fields['setHp'][0]
            maxHp = fields['setMaxHp'][0]
            dnaString = fields['setDNAString'][0]
            lastSeen = fields.get('setLastSeen', [0])[0]

            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(dnaString)

            return request.result({
                'name': name,
                'hp': hp,
                'maxHp': maxHp,
                'lastSeen': lastSeen,
                'dna': {
                    'species': ToonDNA.getSpeciesName(dna.head),
                    'headType': dna.head,
                    'headColor': list(ToonDNA.allColorsList[dna.headColor]),
                }
            })
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leaked-Source,代碼行數:27,代碼來源:ToontownRPCHandler.py

示例6: rpc_listPendingNames

    def rpc_listPendingNames(self, request, count=50):
        """Returns up to 50 pending names, sorted by time spent in the queue.

        It is recommended that the name moderation app call this periodically
        to update its database, in order to ensure that no names got lost.
        """

        cursor = self.air.mongodb.astron.objects.find({'fields.WishNameState': WISHNAME_PENDING})

        cursor.sort('fields.WishNameTimestamp', pymongo.ASCENDING)
        cursor.limit(count)

        result = []
        for item in cursor:
            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(item['fields']['setDNAString']['dnaString'])

            obj = {
                'avId': item['_id'],
                'name': item['fields']['WishName'],
                'time': item['fields']['WishNameTimestamp'],
                'dna': {
                    'species': ToonDNA.getSpeciesName(dna.head),
                    'headType': dna.head,
                    'headColor': list(ToonDNA.allColorsList[dna.headColor]),
                }
            }
            result.append(obj)

        return result
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leaked-Source,代碼行數:30,代碼來源:ToontownRPCHandler.py

示例7: rpc_getAvatarDetailsByName

    def rpc_getAvatarDetailsByName(self, request, name):
        """Fetch a list of avatars that match the provided name.
        Each element is a dict containing their hp/maxHp, lastSeen and
        a few DNA attributes.

        This list can be empty (meaning no avatars matched).
        """

        self.air.mongodb.astron.objects.ensure_index('fields.setName')
        avatars = self.air.mongodb.astron.objects.find({'fields.setName':{'name':name}})

        result = []
        for avatar in avatars:
            fields = avatar['fields']
            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(fields['setDNAString']['dnaString'])

            # In this case, we don't need to return the name, as that was already
            # a parameter should already be considered "known".
            result.append({
                'id': avatar['_id'], # Instead of a name, return the avId.
                'hp': fields['setHp']['hp'], # WTF did we do here?? hp and hitPoints, pls?
                'maxHp': fields['setMaxHp']['hitPoints'],
                'lastSeen': fields.get('setLastSeen',{}).get('timestamp',0),
                'dna': {
                    'species': ToonDNA.getSpeciesName(dna.head),
                    'headType': dna.head,
                    'headColor': list(ToonDNA.allColorsList[dna.headColor]),
                }
            })

        return result
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leaked-Source,代碼行數:32,代碼來源:ToontownRPCHandler.py

示例8: rpc_getAvatarDetails

    def rpc_getAvatarDetails(self, avId):
        """
        Summary:
            Responds with basic details on the avatar associated with the
            provided [avId].

        Parameters:
            [int avId] = The ID of the avatar to query basic details on.

        Example response:
            On success:
                {
                   'name': 'Toon Name',
                   'species': 'cat',
                   'head-color': 'Red',
                   'max-hp': 15,
                   'online': True
                }
            On failure: None
        """
        dclassName, fields = self.rpc_queryObject(avId)
        if dclassName == 'DistributedToon':
            result = {}

            result['name'] = fields['setName'][0]

            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(fields['setDNAString'][0])
            result['species'] = ToonDNA.getSpeciesName(dna.head)

            result['head-color'] = TTLocalizer.NumToColor[dna.headColor]
            result['max-hp'] = fields['setMaxHp'][0]
            result['online'] = (avId in self.air.friendsManager.onlineToons)

            return result
開發者ID:Teku16,項目名稱:ToontownPlanet,代碼行數:35,代碼來源:ToontownRPCHandler.py

示例9: swapBottomStyle

 def swapBottomStyle(self, offset):
     length = len(self.bottomStyles)
     self.bottomStyleChoice += offset
     if self.bottomStyleChoice <= 0:
         self.bottomStyleChoice = 0
     self.updateScrollButtons(self.bottomStyleChoice, length, 0, self.bottomStyleLButton, self.bottomStyleRButton)
     if self.bottomStyleChoice < 0 or self.bottomStyleChoice >= length:
     #if self.topStyleChoice < 0 or self.topStyleChoice >= len(self.topStyles) or len(self.topStyles[self.topStyleChoice]) != 4:
         self.notify.warning('bottomChoice index is out of range!')
         return None
     self.toon.style.botTex = self.bottomStyles[self.bottomStyleChoice]
     colors = ToonDNA.getBottomColors(self.gender, self.bottomStyles[self.bottomStyleChoice], tailorId=ToonDNA.MAKE_A_TOON)
     colorLength = len(colors)
     if self.bottomColorChoice < 0 or self.bottomColorChoice >= colorLength:
         self.bottomColorChoice = colorLength - 1
     self.updateScrollButtons(self.bottomColorChoice, colorLength, 0, self.bottomLButton, self.bottomRButton)
     self.toon.style.botTexColor = colors[self.bottomColorChoice]      
     #colors = ToonDNA.getTopColors(self.gender, self.topStyles[self.topStyleChoice], tailorId=ToonDNA.MAKE_A_TOON)
     #self.toon.style.topTexColor = colors[self.topColorChoice][0]
     if self.toon.generateToonClothes() == 1:
         self.toon.loop('neutral', 0)
         self.swappedTorso = 1
     if self.swapEvent != None:
         messenger.send(self.swapEvent)
     messenger.send('wakeup')
開發者ID:Kawaiikat14,項目名稱:Toontown-2-Revised,代碼行數:25,代碼來源:ClothesGUI.py

示例10: __updateHead

 def __updateHead(self):
     self.__updateScrollButtons(self.headChoice, len(self.headList), self.headStart, self.headLButton, self.headRButton)
     headIndex = ToonDNA.getHeadStartIndex(self.species) + self.headChoice
     newHead = ToonDNA.toonHeadTypes[headIndex]
     self.dna.head = newHead
     self.toon.swapToonHead(newHead)
     self.toon.loop('neutral', 0)
     self.toon.swapToonColor(self.dna)
開發者ID:Teku16,項目名稱:Toontown-Crystal-Master,代碼行數:8,代碼來源:BodyShop.py

示例11: __swapSpecies

 def __swapSpecies(self, offset):
     length = len(ToonDNA.toonSpeciesTypes)
     self.speciesChoice = (self.speciesChoice + offset) % length
     self.__updateScrollButtons(self.speciesChoice, length, self.speciesStart, self.speciesLButton, self.speciesRButton)
     self.species = ToonDNA.toonSpeciesTypes[self.speciesChoice]
     self.headList = ToonDNA.getHeadList(self.species)
     self.__changeSpeciesName(self.species)
     maxHeadChoice = len(self.headList) - 1
     if self.headChoice > maxHeadChoice:
         self.headChoice = maxHeadChoice
     self.__updateHead()
開發者ID:AdrianF98,項目名稱:Toontown-Rewritten,代碼行數:11,代碼來源:BodyShop.py

示例12: swapTopColor

 def swapTopColor(self, offset):
     self.topColorChoice += offset    
     colors = ToonDNA.getTopColors(self.gender, self.topStyles[self.topStyleChoice], tailorId=ToonDNA.MAKE_A_TOON)
     length = len(colors)
     if self.topColorChoice <= 0:
         self.topColorChoice = 0
     self.updateScrollButtons(self.topColorChoice, length, 0, self.topLButton, self.topRButton)
     if self.topColorChoice < 0 or self.topColorChoice >= length:
         self.notify.warning('topChoice index is out of range!')
         self.topColorChoice = len(colors)
         self.updateScrollButtons(self.topColorChoice, length, 0, self.topLButton, self.topRButton)
     self.toon.style.topTexColor = colors[self.topColorChoice][0]
     self.toon.style.sleeveTexColor = colors[self.topColorChoice][1]
     self.toon.generateToonClothes()
     if self.swapEvent != None:
         messenger.send(self.swapEvent)
     messenger.send('wakeup')
開發者ID:Kawaiikat14,項目名稱:Toontown-2-Revised,代碼行數:17,代碼來源:ClothesGUI.py

示例13: swapBottomColor

 def swapBottomColor(self, offset):
     self.bottomColorChoice += offset    
     colors = ToonDNA.getBottomColors(self.gender, self.bottomStyles[self.bottomStyleChoice], tailorId=ToonDNA.MAKE_A_TOON)
     length = len(colors)
     if self.bottomColorChoice <= 0:
         self.bottomColorChoice = 0
     self.updateScrollButtons(self.bottomColorChoice, length, 0, self.bottomLButton, self.bottomRButton)
     if self.bottomColorChoice < 0 or self.bottomColorChoice >= length:
         self.notify.warning('bottomColor choice index is out of range!')
         self.bottomColorChoice = len(colors)
         self.updateScrollButtons(self.bottomColorChoice, length, 0, self.bottomLButton, self.bottomRButton)            
     self.toon.style.botTexColor = colors[self.bottomColorChoice]
     if self.toon.generateToonClothes() == 1:
         self.toon.loop('neutral', 0)
         self.swappedTorso = 1
     if self.swapEvent != None:
         messenger.send(self.swapEvent)
     messenger.send('wakeup')
開發者ID:Kawaiikat14,項目名稱:Toontown-2-Revised,代碼行數:18,代碼來源:ClothesGUI.py

示例14: __init__

    def __init__(self, serverVersion, launcher = None):
        OTPClientRepository.OTPClientRepository.__init__(self, serverVersion, launcher, playGame=PlayGame.PlayGame)
        self._playerAvDclass = self.dclassesByName['DistributedToon']
        setInterfaceFont(TTLocalizer.InterfaceFont)
        setSignFont(TTLocalizer.SignFont)
        setFancyFont(TTLocalizer.FancyFont)
        nameTagFontIndex = 0
        for font in TTLocalizer.NametagFonts:
            setNametagFont(nameTagFontIndex, TTLocalizer.NametagFonts[nameTagFontIndex])
            nameTagFontIndex += 1

        self.toons = {}
        if self.http.getVerifySsl() != HTTPClient.VSNoVerify:
            self.http.setVerifySsl(HTTPClient.VSNoDateCheck)
        prepareAvatar(self.http)
        self.__forbidCheesyEffects = 0
        self.friendManager = None
        self.speedchatRelay = None
        self.trophyManager = None
        self.bankManager = None
        self.catalogManager = None
        self.welcomeValleyManager = None
        self.newsManager = None
        self.streetSign = None
        self.distributedDistrict = None
        self.partyManager = None
        self.inGameNewsMgr = None
        self.whitelistMgr = None
        self.toontownTimeManager = ToontownTimeManager.ToontownTimeManager()
        self.avatarFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_AVATAR_FRIENDS_MANAGER, 'AvatarFriendsManager')
        self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager')
        self.speedchatRelay = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_SPEEDCHAT_RELAY, 'TTSpeedchatRelay')
        self.deliveryManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager')
        if config.GetBool('want-code-redemption', 1):
            self.codeRedemptionManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_CODE_REDEMPTION_MANAGER, 'TTCodeRedemptionMgr')
        self.streetSign = None
        self.furnitureManager = None
        self.objectManager = None
        self.friendsMap = {}
        self.friendsOnline = {}
        self.friendsMapPending = 0
        self.friendsListError = 0
        self.friendPendingChatSettings = {}
        self.elderFriendsMap = {}
        self.__queryAvatarMap = {}
        self.dateObject = DateObject.DateObject()
        self.accountServerDate = AccountServerDate.AccountServerDate()
        self.hoodMgr = HoodMgr.HoodMgr(self)
        self.setZonesEmulated = 0
        self.old_setzone_interest_handle = None
        self.setZoneQueue = Queue()
        self.accept(ToontownClientRepository.SetZoneDoneEvent, self._handleEmuSetZoneDone)
        self._deletedSubShardDoIds = set()
        self.toonNameDict = {}
        self.gameFSM.addState(State.State('skipTutorialRequest', self.enterSkipTutorialRequest, self.exitSkipTutorialRequest, ['playGame', 'gameOff', 'tutorialQuestion']))
        state = self.gameFSM.getStateNamed('waitOnEnterResponses')
        state.addTransition('skipTutorialRequest')
        state = self.gameFSM.getStateNamed('playGame')
        state.addTransition('skipTutorialRequest')
        self.wantCogdominiums = base.config.GetBool('want-cogdominiums', 1)
        self.wantEmblems = base.config.GetBool('want-emblems', 0)
        if base.config.GetBool('tt-node-check', 0):
            for species in ToonDNA.toonSpeciesTypes:
                for head in ToonDNA.getHeadList(species):
                    for torso in ToonDNA.toonTorsoTypes:
                        for legs in ToonDNA.toonLegTypes:
                            for gender in ('m', 'f'):
                                print 'species: %s, head: %s, torso: %s, legs: %s, gender: %s' % (species,
                                 head,
                                 torso,
                                 legs,
                                 gender)
                                dna = ToonDNA.ToonDNA()
                                dna.newToon((head,
                                 torso,
                                 legs,
                                 gender))
                                toon = Toon.Toon()
                                try:
                                    toon.setDNA(dna)
                                except Exception as e:
                                    print e

        return
開發者ID:MasterLoopyBM,項目名稱:c0d3,代碼行數:84,代碼來源:ToontownClientRepository.py

示例15: __swapHead

 def __swapHead(self, offset):
     self.headList = ToonDNA.getHeadList(self.species)
     length = len(self.headList)
     self.headChoice = (self.headChoice + offset) % length
     self.__updateHead()
開發者ID:AdrianF98,項目名稱:Toontown-Rewritten,代碼行數:5,代碼來源:BodyShop.py


注:本文中的toontown.toon.ToonDNA類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。