本文整理汇总了Python中toontown.toonbase.TTLocalizer.getPetName方法的典型用法代码示例。如果您正苦于以下问题:Python TTLocalizer.getPetName方法的具体用法?Python TTLocalizer.getPetName怎么用?Python TTLocalizer.getPetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.toonbase.TTLocalizer
的用法示例。
在下文中一共展示了TTLocalizer.getPetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from toontown.toonbase import TTLocalizer [as 别名]
# 或者: from toontown.toonbase.TTLocalizer import getPetName [as 别名]
def __init__(self, doneEvent, petSeed, petNameIndex):
zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId())
name, dna, traitSeed = PetUtil.getPetInfoFromSeed(petSeed, zoneId)
name = TTLocalizer.getPetName(petNameIndex)
cost = PetUtil.getPetCostFromSeed(petSeed, zoneId)
model = loader.loadModel('phase_4/models/gui/AdoptPet')
modelPos = (0, 0, -0.3)
modelScale = 0.055
DirectFrame.__init__(self, relief=None, state='normal', geom=model, geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=modelScale, frameSize=(-1, 1, -1, 1), pos=modelPos, text=TTLocalizer.PetshopAdoptConfirm % (name, cost), text_wordwrap=12, text_scale=0.05, text_pos=(0, 0.55), text_fg=text0Color)
self.initialiseoptions(PetshopGUI.AdoptPetDlg)
self.petView = self.attachNewNode('petView')
self.petView.setPos(-0.13, 0, 0.8)
self.petModel = Pet.Pet(forGui=1)
self.petModel.setDNA(dna)
self.petModel.fitAndCenterHead(0.395, forGui=1)
self.petModel.reparentTo(self.petView)
self.petModel.setH(130)
self.petModel.setScale(0.125)
self.petModel.enterNeutralHappy()
self.moneyDisplay = DirectLabel(parent=self, relief=None, text=str(base.localAvatar.getTotalMoney()), text_scale=0.075, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.225, 0.33), text_font=ToontownGlobals.getSignFont())
self.accept(localAvatar.uniqueName('moneyChange'), self.__moneyChange)
self.accept(localAvatar.uniqueName('bankMoneyChange'), self.__moneyChange)
okImageList = (model.find('**/CheckButtonUp'), model.find('**/CheckButtonDown'), model.find('**/CheckButtonRollover'))
cancelImageList = (model.find('**/CancelButtonUp'), model.find('**/CancelButtonDown'), model.find('**/CancelRollover'))
cancelIcon = model.find('**/CancelIcon')
checkIcon = model.find('**/CheckIcon')
self.cancelButton = DirectButton(parent=self, relief=None, image=cancelImageList, geom=cancelIcon, scale=modelScale, text=('', TTLocalizer.PetshopGoBack), text_pos=(-5.8, 4.4), text_scale=0.7, pressEffect=False, command=lambda : messenger.send(doneEvent, [0]))
self.okButton = DirectButton(parent=self, relief=None, image=okImageList, geom=checkIcon, scale=modelScale, text=('', TTLocalizer.PetshopAdopt), text_pos=(5.8, 4.4), text_scale=0.7, pressEffect=False, command=lambda : messenger.send(doneEvent, [1]))
model.removeNode()
return
示例2: createNewPetFromSeed
# 需要导入模块: from toontown.toonbase import TTLocalizer [as 别名]
# 或者: from toontown.toonbase.TTLocalizer import getPetName [as 别名]
def createNewPetFromSeed(self, avId, seed, nameIndex, gender, safeZoneId):
av = self.air.doId2do[avId]
name = TTLocalizer.getPetName(nameIndex)
_, dna, traitSeed = PetUtil.getPetInfoFromSeed(seed, safeZoneId)
head, ears, nose, tail, body, color, cs, eye, _ = dna
numGenders = len(PetDNA.PetGenders)
gender %= numGenders
fields = {'setOwnerId' : avId, 'setPetName' : name, 'setTraitSeed' : traitSeed, 'setSafeZone' : safeZoneId,
'setHead' : head, 'setEars' : ears, 'setNose' : nose, 'setTail' : tail, 'setBodyTexture' : body,
'setColor' : color, 'setColorScale' : cs, 'setEyeColor' : eye, 'setGender' : gender}
def response(doId):
if not doId:
self.air.notify.warning("Cannot create pet for %s!" % avId)
return
self.air.writeServerEvent('bought-pet', avId, doId)
av.b_setPetId(doId)
self.air.dbInterface.createObject(self.air.dbId, self.air.dclassesByName['DistributedPetAI'],
{k: (v,) for k,v in fields.items()}, response)