本文整理汇总了Python中toontown.estate.GardenGlobals类的典型用法代码示例。如果您正苦于以下问题:Python GardenGlobals类的具体用法?Python GardenGlobals怎么用?Python GardenGlobals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GardenGlobals类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handlePicking
def handlePicking(self):
messenger.send('wakeup')
fullName = GardenGlobals.getFlowerVarietyName(self.species, self.variety)
if self.isWilted():
self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.ConfirmWiltedFlower % {'plant': fullName}, command=self.confirmCallback)
elif not self.isFruiting():
self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.ConfirmUnbloomingFlower % {'plant': fullName}, command=self.confirmCallback)
elif base.localAvatar.isFlowerBasketFull():
self.confirmDialog = TTDialog.TTDialog(style=TTDialog.CancelOnly, text=TTLocalizer.ConfirmBasketFull, command=self.confirmCallback)
else:
shovel = base.localAvatar.shovel
skill = base.localAvatar.shovelSkill
shovelPower = GardenGlobals.getShovelPower(shovel, skill)
giveSkillUp = True
beansRequired = GardenGlobals.getNumBeansRequired(self.species, self.variety)
if not shovelPower == beansRequired:
giveSkillUp = False
if giveSkillUp:
if skill == GardenGlobals.getMaxShovelSkill():
text = (TTLocalizer.ConfirmMaxedSkillFlower % {'plant': fullName},)
else:
text = TTLocalizer.ConfirmSkillupFlower % {'plant': fullName}
self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=text, command=self.confirmCallback)
else:
self.confirmDialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.ConfirmNoSkillupFlower % {'plant': fullName}, command=self.confirmCallback)
self.confirmDialog.show()
base.localAvatar.setInGardenAction(self)
base.cr.playGame.getPlace().detectedGardenPlotUse()
示例2: waterPlant
def waterPlant(self):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
if self.waterLevel < GardenGlobals.getMaxWateringCanPower():
self.waterLevel += GardenGlobals.getWateringCanPower(av.wateringCan, av.wateringCanSkill)
self.d_setWaterLevel(self.waterLevel)
self.gardenManager.updateGardenData()
self.setMovie(GardenGlobals.MOVIE_WATER, self.air.getAvatarIdFromSender())
示例3: getRequestPurchaseErrorText
def getRequestPurchaseErrorText(self, retcode):
retval = CatalogItem.CatalogItem.getRequestPurchaseErrorText(self, retcode)
origText = retval
if retval == TTLocalizer.CatalogPurchaseItemAvailable or retval == TTLocalizer.CatalogPurchaseItemOnOrder:
recipeKey = GardenGlobals.getRecipeKeyUsingSpecial(self.gardenIndex)
if not recipeKey == -1:
retval += GardenGlobals.getPlantItWithString(self.gardenIndex)
if self.gardenIndex == GardenGlobals.GardenAcceleratorSpecial:
if GardenGlobals.ACCELERATOR_USED_FROM_SHTIKER_BOOK:
retval = origText
retval += TTLocalizer.UseFromSpecialsTab
retval += TTLocalizer.MakeSureWatered
return retval
示例4: __init__
def __init__(self, doneEvent, specialBoxActive = False):
if specialBoxActive:
instructions = TTLocalizer.GardeningChooseBeansItem
instructionsPos = (0, 0.4)
else:
instructions = TTLocalizer.GardeningChooseBeans
instructionsPos = (0, 0.35)
DirectFrame.__init__(self, relief=None, state='normal', geom=DGG.getDefaultDialogGeom(), geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=(1.5, 1.0, 1.0), frameSize=(-1, 1, -1, 1), pos=(0, 0, 0), text=instructions, text_wordwrap=20, text_scale=0.08, text_pos=instructionsPos)
self.initialiseoptions(PlantingGUI)
self.doneEvent = doneEvent
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
okImageList = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
cancelImageList = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr'))
resetImageList = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr'))
self.cancelButton = DirectButton(parent=self, relief=None, image=cancelImageList, pos=(-0.3, 0, -0.35), text=TTLocalizer.PlantingGuiCancel, text_scale=0.06, text_pos=(0, -0.1), command=self.__cancel)
self.okButton = DirectButton(parent=self, relief=None, image=okImageList, pos=(0.3, 0, -0.35), text=TTLocalizer.PlantingGuiOk, text_scale=0.06, text_pos=(0, -0.1), command=self.__doPlant)
self.resetButton = DirectButton(parent=self, relief=None, image=resetImageList, pos=(0.0, 0, -0.35), text=TTLocalizer.PlantingGuiReset, text_scale=0.06, text_pos=(0, -0.1), command=self.__reset)
buttons.removeNode()
self.availableBoxes = base.localAvatar.getBoxCapability()
self.maxBoxes = GardenGlobals.getNumberOfShovelBoxes()
self.activeBoxesList = []
self.specialBox = None
self.specialBoxActive = specialBoxActive
self.boxList = []
self.jellyBeanPicker = None
self.jellyBeanPickerInterval = None
self.createBoxes()
guiItems = loader.loadModel('phase_5.5/models/gui/catalog_gui')
self.beanBank = DirectLabel(self, relief=None, image=guiItems.find('**/bean_bank'), text=str(base.localAvatar.getMoney() + base.localAvatar.getBankMoney()), text_align=TextNode.ARight, text_scale=0.11, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.75, -0.81), text_font=ToontownGlobals.getSignFont(), pos=(-0.85, 0, 0.2), scale=0.5)
self.matchBoxesToAvailableMoney()
if PICKER_ALWAYS_UP:
self.spiffyBeanBoxClicked(0)
return
示例5: __init__
def __init__(self, parent, recipe, **kw):
left = 0
right = 0.445
bottom = 0
top = 0.08
borderWidth = 0.01
optiondefs = [('relief', DGG.RIDGE, None),
('state', 'normal', None),
('pos', (0, 0, 0), None),
('frameSize', (left,
right,
bottom,
top), None),
('borderWidth', (borderWidth, borderWidth), self.setBorderWidth)]
self.defineoptions(kw, optiondefs)
DirectFrame.__init__(self, parent)
self.initialiseoptions(BeanRecipeGui)
self.jellyBeanBoxList = []
xIncrement = 0.052
for i in range(len(recipe)):
beanIndex = GardenGlobals.BeanColorLetters.index(recipe[i])
self.createJellyBeanBox(beanIndex, borderWidth + xIncrement * i, borderWidth)
for j in range(len(recipe), GardenGlobals.getNumberOfShovelBoxes()):
self.createEmptyBeanBox(borderWidth + xIncrement * j, borderWidth)
return
示例6: 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
)
示例7: construct
def construct(self, gardenData):
DistributedPlantBaseAI.construct(self, gardenData)
self.wilted = gardenData.getUint8()
if self.waterLevel == -1:
self.wilted = True
self.gagTrack, self.gagLevel = GardenGlobals.getTreeTrackAndLevel(self.typeIndex)
示例8: waterPlantDone
def waterPlantDone(self):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
currSkill = av.getWateringCanSkill()
if self.waterLevel < GardenGlobals.getMaxWateringCanPower():
av.b_setWateringCanSkill(currSkill + 1 + self.getGrowthState())
self.setMovie(GardenGlobals.MOVIE_CLEAR, self.air.getAvatarIdFromSender())
示例9: createBlankGarden
def createBlankGarden(self):
gardenData = PyDatagram()
plots = GardenGlobals.getGardenPlots(self.house.housePos)
gardenData.addUint8(len(plots))
for i, plotData in enumerate(plots):
gardenData.addUint8(GardenGlobals.EmptyPlot)
gardenData.addUint8(i)
self.house.b_setGardenData(gardenData.getMessage())
self.loadGarden()
示例10: updatePage
def updatePage(self):
if hasattr(self, "collectedTotal"):
self.collectedTotal["text"] = TTLocalizer.GardenPageCollectedTotal % (
len(base.localAvatar.flowerCollection),
GardenGlobals.getNumberOfFlowerVarieties(),
)
if hasattr(self, "shovelBar"):
shovel = base.localAvatar.shovel
shovelName = TTLocalizer.ShovelNameDict[shovel]
curShovelSkill = base.localAvatar.shovelSkill
maxShovelSkill = GardenGlobals.ShovelAttributes[shovel]["skillPts"]
if shovel == GardenGlobals.MAX_SHOVELS - 1:
maxShovelSkill -= 1
wateringCan = base.localAvatar.wateringCan
wateringCanName = TTLocalizer.WateringCanNameDict[wateringCan]
curWateringCanSkill = base.localAvatar.wateringCanSkill
maxWateringCanSkill = GardenGlobals.WateringCanAttributes[wateringCan]["skillPts"]
if wateringCan == GardenGlobals.MAX_WATERING_CANS - 1:
maxWateringCanSkill -= 1
textToUse = TTLocalizer.GardenPageShovelInfo % (shovelName, curShovelSkill, maxShovelSkill)
self.shovelBar["text"] = textToUse
self.shovelBar["value"] = float(curShovelSkill) / float(maxShovelSkill) * self.barLength + self.FUDGE_FACTOR
textToUse = TTLocalizer.GardenPageWateringCanInfo % (
wateringCanName,
curWateringCanSkill,
maxWateringCanSkill,
)
self.wateringCanBar["text"] = textToUse
self.wateringCanBar["value"] = (
float(curWateringCanSkill) / float(maxWateringCanSkill) * self.barLength + self.FUDGE_FACTOR
)
else:
print "no shovel bar"
if self.mode == GardenPage_Collection:
if hasattr(self, "browser"):
self.browser.update()
elif self.mode == GardenPage_Basket:
if hasattr(self, "picker"):
newBasketFlower = base.localAvatar.flowerBasket.getFlower()
self.picker.update(newBasketFlower)
elif self.mode == GardenPage_Trophy:
if hasattr(self, "trophies"):
for trophy in self.trophies:
trophy.setLevel(-1)
for trophyId in base.localAvatar.getGardenTrophies():
self.trophies[trophyId].setLevel(trophyId)
elif self.mode == GardenPage_Specials:
self.createGardenSpecialsList()
if not base.cr.playGame.getPlace().getState() == "stickerBook":
self.specialsPhoto.hide()
示例11: isSkillTooLow
def isSkillTooLow(self, avatar):
recipeKey = GardenGlobals.getRecipeKeyUsingSpecial(self.gardenIndex)
recipe = GardenGlobals.Recipes[recipeKey]
numBeansRequired = len(recipe['beans'])
canPlant = avatar.getBoxCapability()
result = False
if canPlant < numBeansRequired:
result = True
if not result and GardenGlobals.Specials.has_key(self.gardenIndex) and GardenGlobals.Specials[self.gardenIndex].has_key('minSkill'):
minSkill = GardenGlobals.Specials[self.gardenIndex]['minSkill']
if avatar.shovelSkill < minSkill:
result = True
else:
result = False
return result
示例12: constructTree
def constructTree(self, plotIndex, gagTrack, gagLevel):
dg = PyDatagram()
dg.addUint8(plotIndex)
dg.addUint8(GardenGlobals.getTreeTypeIndex(gagTrack, gagLevel)) # Type Index
dg.addInt8(0) # Water Level
dg.addInt8(0) # Growth Level
dg.addUint32(self.getTimestamp())
dg.addUint8(0) # Wilted State (False)
gardenData = PyDatagramIterator(dg)
plot = occupier2Class[GardenGlobals.TreePlot](self.air, self, self.house.housePos)
plot.construct(gardenData)
self.plots[plotIndex] = plot
self.updateGardenData()
示例13: awardedTrophy
def awardedTrophy(self, avId):
if base.localAvatar.doId == avId:
base.cr.playGame.getPlace().detectedGardenPlotUse()
msg = TTLocalizer.GardenTrophyAwarded % (len(base.localAvatar.getFlowerCollection()), GardenGlobals.getNumberOfFlowerVarieties())
self.awardDialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=msg, command=self.closedAwardDialog)
示例14: construct
def construct(self, gardenData):
self.plotIndex = gardenData.getUint8()
self.plotType = GardenGlobals.getPlotType(self.ownerIndex, self.plotIndex)
self.pos = GardenGlobals.getPlotPos(self.ownerIndex, self.plotIndex)
self.heading = GardenGlobals.getPlotHeading(self.ownerIndex, self.plotIndex)