当前位置: 首页>>代码示例>>Python>>正文


Python PetDNA.setGender方法代码示例

本文整理汇总了Python中toontown.pets.PetDNA.setGender方法的典型用法代码示例。如果您正苦于以下问题:Python PetDNA.setGender方法的具体用法?Python PetDNA.setGender怎么用?Python PetDNA.setGender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在toontown.pets.PetDNA的用法示例。


在下文中一共展示了PetDNA.setGender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: makePetList

# 需要导入模块: from toontown.pets import PetDNA [as 别名]
# 或者: from toontown.pets.PetDNA import setGender [as 别名]
        def makePetList(self):
            self.numPets = len(self.petSeeds)
            self.curPet = 0
            self.petDNA = []
            self.petName = []
            self.petDesc = []
            self.petCost = []
            for i in xrange(self.numPets):
                random.seed(self.petSeeds[i])
                zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId())
                name, dna, traitSeed = PetUtil.getPetInfoFromSeed(self.petSeeds[i], zoneId)
                cost = PetUtil.getPetCostFromSeed(self.petSeeds[i], zoneId)
                traits = PetTraits.PetTraits(traitSeed, zoneId)
                traitList = traits.getExtremeTraitDescriptions()
                numGenders = len(PetDNA.PetGenders)
                gender = i % numGenders
                PetDNA.setGender(dna, gender)
                self.petDNA.append(dna)
                self.petName.append(TTLocalizer.PetshopUnknownName)
                descList = []
                descList.append(TTLocalizer.PetshopDescGender % PetDNA.getGenderString(gender=gender))
                if traitList:
                    descList.append(TTLocalizer.PetshopDescTrait % traitList[0])
                else:
                    descList.append(TTLocalizer.PetshopDescTrait % TTLocalizer.PetshopDescStandard)
                traitList.extend(['',
                 '',
                 '',
                 ''])
                for trait in traitList[1:4]:
                    descList.append('\t%s' % trait)

                descList.append(TTLocalizer.PetshopDescCost % cost)
                self.petDesc.append('\n'.join(descList))
                self.petCost.append(cost)
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:37,代码来源:PetshopGUI.py


注:本文中的toontown.pets.PetDNA.setGender方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。