当前位置: 首页>>代码示例>>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;未经允许,请勿转载。