本文整理汇总了Python中toontown.toonbase.TTLocalizer类的典型用法代码示例。如果您正苦于以下问题:Python TTLocalizer类的具体用法?Python TTLocalizer怎么用?Python TTLocalizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTLocalizer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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: __handleFlowerPlantingDone
def __handleFlowerPlantingDone(self, willPlant = 0, recipeStr = '', special = -1):
self.ignore(self.plantingGuiDoneEvent)
self.ignore('stoppedAsleep')
self.plantingGui.destroy()
self.plantingGui = None
base.localAvatar.showGardeningGui()
base.localAvatar.removeShovelRelatedDoId(self.doId)
successPlanting = False
if willPlant:
recipeKey = GardenGlobals.getRecipeKey(recipeStr, special)
if recipeKey >= 0:
species, variety = GardenGlobals.getSpeciesVarietyGivenRecipe(recipeKey)
if species >= 0 and variety >= 0:
self.sendUpdate('plantFlower', [species, variety])
successPlanting = True
else:
self.notify.debug('%s %d is not a valid recipe' % (recipeStr, special))
burntBeans = len(recipeStr)
self.sendUpdate('plantNothing', [burntBeans])
if successPlanting:
flowerName = GardenGlobals.getFlowerVarietyName(species, variety)
stringToShow = TTLocalizer.getResultPlantedSomethingSentence(flowerName)
elif willPlant:
self.resultDialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.ResultPlantedNothing, command=self.popupFlowerPlantingGuiAgain)
else:
self.finishInteraction()
示例3: __showData
def __showData(self):
av = self.avatar
online = 1
if base.cr.isFriend(self.avId):
online = base.cr.isFriendOnline(self.avId)
if online:
shardName = base.cr.getShardName(av.defaultShard)
hoodName = base.cr.hoodMgr.getFullnameFromId(av.lastHood)
if ZoneUtil.isWelcomeValley(av.lastHood):
shardName = '%s (%s)' % (TTLocalizer.WelcomeValley[-1], shardName)
if self.playerInfo:
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
self.gotoAvatarButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=1.1, text=TTLocalizer.AvatarShowPlayer, text_scale=0.07, text_pos=(0.0, -0.02), textMayChange=0, pos=(0.44, 0, 0.41), command=self.__showAvatar)
text = TTLocalizer.AvatarDetailPanelOnlinePlayer % {'district': shardName,
'location': hoodName,
'player': self.playerInfo.playerName}
else:
text = TTLocalizer.AvatarDetailPanelOnline % {'district': shardName,
'location': hoodName}
else:
text = TTLocalizer.AvatarDetailPanelOffline % {'last_seen': TTLocalizer.getLastSeenString(self.avatar.getLastSeen())}
self.dataText['text'] = text
self.__updateTrackInfo()
self.__updateTrophyInfo()
self.__updateLaffInfo()
return
示例4: doResultDialog
def doResultDialog(self):
self.startInteraction()
flowerName = GardenGlobals.getFlowerVarietyName(self.species, self.variety)
stringToShow = TTLocalizer.getResultPlantedSomethingSentence(flowerName)
self.resultDialog = TTDialog.TTDialog(
style=TTDialog.Acknowledge, text=stringToShow, command=self.resultsCallback
)
示例5: getCardName
def getCardName(value):
if value == Unknown:
return TTLocalizer.PlayingCardUnknown
else:
rank = value % MaxRank
suit = value / MaxRank
return TTLocalizer.getPlayingCardName(suit, rank)
示例6: doResultDialog
def doResultDialog(self):
self.startInteraction()
curTrack, curLevel = GardenGlobals.getTreeTrackAndLevel(self.typeIndex)
species = GardenGlobals.getTreeTypeIndex(curTrack, curLevel)
treeName = GardenGlobals.PlantAttributes[species]['name']
stringToShow = TTLocalizer.getResultPlantedSomethingSentence(treeName)
self.resultDialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=stringToShow, command=self.resultsCallback)
示例7: getPetInfoFromSeed
def getPetInfoFromSeed(seed, safezoneId):
S = random.getstate()
random.seed(seed)
dnaArray = PetDNA.getRandomPetDNA(safezoneId)
gender = PetDNA.getGender(dnaArray)
nameString = TTLocalizer.getRandomPetName(gender=gender, seed=seed)
traitSeed = PythonUtil.randUint31()
random.setstate(S)
return (nameString, dnaArray, traitSeed)
示例8: display
def display(self, pTrackTitle = 'Track Title', pPeriodTitle = 'Period Title', pLeaderList = []):
self.titleTextNode.setText(pPeriodTitle)
self.trackNameNode.setText(pTrackTitle)
self.updateCount += 1
for i in xrange(10):
if i >= len(pLeaderList):
self.nameTextNodes[i].setText('-')
self.timeTextNodes[i].setText('-')
else:
self.nameTextNodes[i].setText(pLeaderList[i][0][:22])
self.timeTextNodes[i].setText(TTLocalizer.convertSecondsToDate(pLeaderList[i][1]))
示例9: getPlantItWithString
def getPlantItWithString(special):
retval = ''
recipeKey = getRecipeKeyUsingSpecial(special)
if not recipeKey == -1:
beanTuple = []
beanStr = Recipes[recipeKey]['beans']
for letter in beanStr:
index = BeanColorLetters.index(letter)
beanTuple.append(index)
beanText = TTLocalizer.getRecipeBeanText(beanTuple)
retval += TTLocalizer.PlantItWith % beanText
return retval
示例10: generateAchievementInfo
def generateAchievementInfo(self):
acievementInfo = TTLocalizer.getAchievementInfo(self.achievementId)
title = TextNode('title')
title.setText(acievementInfo[0])
title.setFont(ToontownGlobals.getSignFont())
title.setTextColor(1, 1, 1, 1)
title.setAlign(TextNode.ACenter)
titleNode = self.attachNewNode(title)
titleNode.setScale(0.2)
titleNode.setZ(0.2)
description = TextNode('description')
description.setText(acievementInfo[1])
description.setFont(ToontownGlobals.getSignFont())
description.setTextColor(1, 1, 1, 1)
description.setAlign(TextNode.ACenter)
descriptionNode = self.attachNewNode(description)
descriptionNode.setScale(0.15)
descriptionNode.setZ(-0.14)
示例11: __handleItemPlantingDone
def __handleItemPlantingDone(self, willPlant = 0, recipeStr = '', selectedSpecial = -1):
self.ignore(self.plantingGuiDoneEvent)
self.ignore('stoppedAsleep')
self.plantingGui.destroy()
self.plantingGui = None
base.localAvatar.showGardeningGui()
base.localAvatar.removeShovelRelatedDoId(self.doId)
gardenSpecials = base.localAvatar.getGardenSpecials()
special = -1
if selectedSpecial >= 0:
special = gardenSpecials[selectedSpecial][0]
successPlanting = False
successToonStatue = False
if willPlant:
recipeKey = GardenGlobals.getRecipeKey(recipeStr, special)
if recipeKey >= 0:
species, variety = GardenGlobals.getSpeciesVarietyGivenRecipe(recipeKey)
if species >= 0 and variety >= 0:
if GardenGlobals.PlantAttributes[species]['plantType'] == GardenGlobals.STATUARY_TYPE:
successPlanting = True
if species >= 205 and species <= 208:
successToonStatue = True
else:
self.sendUpdate('plantStatuary', [species])
else:
self.notify.debug('%s %d is not a valid recipe' % (recipeStr, special))
burntBeans = len(recipeStr)
self.sendUpdate('plantNothing', [burntBeans])
if successPlanting:
itemName = GardenGlobals.PlantAttributes[species]['name']
stringToShow = TTLocalizer.getResultPlantedSomethingSentence(itemName)
elif willPlant:
self.resultDialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.ResultPlantedNothing, command=self.popupItemPlantingGuiAgain)
else:
self.finishInteraction()
if successToonStatue:
self.popupToonStatueSelectionGui(species)
return
示例12: createNewPetFromSeed
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)
示例13: doResultDialog
def doResultDialog(self):
self.startInteraction()
itemName = GardenGlobals.PlantAttributes[self.typeIndex]['name']
stringToShow = TTLocalizer.getResultPlantedSomethingSentence(itemName)
self.resultDialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=stringToShow, command=self.resultsCallback)
示例14: getName
def getName(self):
return TTLocalizer.getHouseNameById(self.houseType)