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


Python GardenGlobals类代码示例

本文整理汇总了Python中GardenGlobals的典型用法代码示例。如果您正苦于以下问题:Python GardenGlobals类的具体用法?Python GardenGlobals怎么用?Python GardenGlobals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __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()
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:26,代码来源:DistributedGardenPlot.py

示例2: 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)
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:7,代码来源:DistributedGagTree.py

示例3: update

    def update(self):
        if base.localAvatar.flowerCollection.hasSpecies(self.species):
            self.flowerPanel.show(showBackground=0)
            self['text'] = TTLocalizer.FlowerSpeciesNames[self.species]
        for variety in range(len(GardenGlobals.getFlowerVarieties(self.species))):
            if base.localAvatar.flowerCollection.hasFlower(self.species, variety):
                name = GardenGlobals.getFlowerVarietyName(self.species, variety)
                self.speciesLabels[variety]['text'] = name
                self.speciesLabels[variety]['state'] = DGG.NORMAL

        self.showRecipe()
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:11,代码来源:FlowerSpeciesPanel.py

示例4: hasDependentTrees

    def hasDependentTrees(self):
        myTrack, myLevel = GardenGlobals.getTreeTrackAndLevel(self.typeIndex)
        allGagTrees = base.cr.doFindAll('DistributedGagTree')
        for gagTree in allGagTrees:
            if gagTree.getOwnerId() == localAvatar.doId:
                curTrack, curLevel = GardenGlobals.getTreeTrackAndLevel(gagTree.typeIndex)
                if curTrack == myTrack:
                    if myLevel < curLevel:
                        return True

        return False
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:11,代码来源:DistributedGagTree.py

示例5: generateRandomBasket

 def generateRandomBasket(self):
     import random
     numFish = random.randint(1, 20)
     self.flowerList = []
     for i in range(numFish):
         species, variety = GardenGlobals.getRandomFlower()
         self.addFlower(species, variety)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:7,代码来源:FlowerBasket.py

示例6: setSpecies

    def setSpecies(self, species):
        if self.species == species:
            return
        self.species = species
        if self.species != None:
            if self.flowerPanel:
                self.flowerPanel.destroy()
            varietyToUse = self.flowerCollection.getInitialVariety(self.species)
            self.variety = varietyToUse
            self.flowerPanel = FlowerPhoto.FlowerPhoto(species=self.species, variety=varietyToUse, parent=self)
            zAdj = 0.0131
            xAdj = -0.002
            self.flowerPanel.setPos(-0.229 + xAdj, 1, -0.01 + zAdj)
            self.flowerPanel.setSwimBounds(-0.2461, 0.2367, -0.207 + zAdj, 0.2664 + zAdj)
            self.flowerPanel.setSwimColor(0.75, 0.75, 0.75, 1.0)
            varietyList = GardenGlobals.getFlowerVarieties(self.species)
            self.speciesLabels = []
            offset = 0.075
            startPos = len(varietyList) / 2 * offset
            if not len(varietyList) % 2:
                startPos -= offset / 2
            for variety in range(len(varietyList)):
                label = DirectButton(parent=self, frameSize=(0,
                 0.445,
                 -0.02,
                 0.04), relief=None, state=DGG.DISABLED, pos=(0.06, 0, startPos - variety * offset), text=TTLocalizer.FlowerUnknown, text_fg=(0.2, 0.1, 0.0, 1), text_scale=(0.045, 0.045, 0.45), text_align=TextNode.ALeft, text_font=ToontownGlobals.getInterfaceFont(), command=self.changeVariety, extraArgs=[variety], text1_bg=Vec4(1, 1, 0, 1), text2_bg=Vec4(0.5, 0.9, 1, 1), text3_fg=Vec4(0.4, 0.8, 0.4, 1))
                self.speciesLabels.append(label)

        return
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:29,代码来源:FlowerSpeciesPanel.py

示例7: requestHarvest

 def requestHarvest(self, doId):
     av = simbase.air.doId2do.get(doId)
     harvested = 0
     track, level = GardenGlobals.getTreeTrackAndLevel(self.typeIndex)
     while av.inventory.addItem(track, level) > 0 and harvested < 10:
         harvested += 1
     self.sendUpdate('setMovie', [GardenGlobals.MOVIE_HARVEST, doId])
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:7,代码来源:DistributedGagTreeAI.py

示例8: __init__

 def __init__(self, parent = aspect2d, **kw):
     self.parent = parent
     gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
     optiondefs = (('parent', self.parent, None),
      ('relief', None, None),
      ('incButton_image', (gui.find('**/FndsLst_ScrollUp'),
        gui.find('**/FndsLst_ScrollDN'),
        gui.find('**/FndsLst_ScrollUp_Rllvr'),
        gui.find('**/FndsLst_ScrollUp')), None),
      ('incButton_relief', None, None),
      ('incButton_scale', (1.3, 1.3, -1.3), None),
      ('incButton_pos', (0, 0, -0.525), None),
      ('incButton_image3_color', Vec4(0.8, 0.8, 0.8, 0.5), None),
      ('decButton_image', (gui.find('**/FndsLst_ScrollUp'),
        gui.find('**/FndsLst_ScrollDN'),
        gui.find('**/FndsLst_ScrollUp_Rllvr'),
        gui.find('**/FndsLst_ScrollUp')), None),
      ('decButton_relief', None, None),
      ('decButton_scale', (1.3, 1.3, 1.3), None),
      ('decButton_pos', (0, 0, 0.525), None),
      ('decButton_image3_color', Vec4(0.8, 0.8, 0.8, 0.5), None),
      ('numItemsVisible', 1, None),
      ('items', map(str, GardenGlobals.getFlowerSpecies()), None),
      ('scrollSpeed', 4, None),
      ('itemMakeFunction', FlowerSpeciesPanel.FlowerSpeciesPanel, None),
      ('itemMakeExtraArgs', base.localAvatar.flowerCollection, None))
     gui.removeNode()
     self.defineoptions(kw, optiondefs)
     DirectScrolledList.__init__(self, parent)
     self.initialiseoptions(FlowerBrowser)
     return None
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:31,代码来源:FlowerBrowser.py

示例9: requestHarvest

    def requestHarvest(self):
        avId = self.air.getAvatarIdFromSender()
        av = self.air.doId2do.get(avId)
        if not av:
            return
        
        if avId != self.ownerDoId:
            self.air.writeServerEvent('suspicious', avId, 'tried to harvest someone else\'s tree!')
            return

        problem = self.isFruiting()
        if problem:
            self.air.writeServerEvent('suspicious', avId, 'tried to harvest a tree that\'s not fruiting!', problem=problem)
            return

        harvested = 0
        track, level = GardenGlobals.getTreeTrackAndLevel(self.typeIndex)
        while av.inventory.addItem(track, level) > 0 and harvested < 10:
            harvested += 1
  
        av.d_setInventory(av.getInventory())
        
        self.lastHarvested = int(time.time())
        self.sendUpdate('setFruiting', [self.getFruiting()])
        self.d_setMovie(GardenGlobals.MOVIE_HARVEST)
        self.update()
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:26,代码来源:DistributedGagTreeAI.py

示例10: canBeHarvested

    def canBeHarvested(self):
        myTrack, myLevel = GardenGlobals.getTreeTrackAndLevel(self.typeIndex)
        levelsInTrack = []
        levelTreeDict = {}
        allGagTrees = base.cr.doFindAll('DistributedGagTree')
        for gagTree in allGagTrees:
            if gagTree.getOwnerId() == localAvatar.doId:
                curTrack, curLevel = GardenGlobals.getTreeTrackAndLevel(gagTree.typeIndex)
                if curTrack == myTrack:
                    levelsInTrack.append(curLevel)
                    levelTreeDict[curLevel] = gagTree

        for levelToTest in xrange(myLevel):
            if levelToTest not in levelsInTrack:
                return False
            curTree = levelTreeDict[levelToTest]
            if not curTree.isGTEFullGrown():
                return False

        return True
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:20,代码来源:DistributedGagTree.py

示例11: plantSomething

 def plantSomething(self):
     whatCanBePlanted = GardenGlobals.whatCanBePlanted(self.ownerIndex, self.plot)
     if whatCanBePlanted == GardenGlobals.INVALID_TYPE:
         self.notify.warning('whatCanBePlanted returned INVALID_TYPE for %d %d' % (self.ownerIndex, self.plot))
     elif whatCanBePlanted == GardenGlobals.FLOWER_TYPE:
         self.popupFlowerPlantingGui()
         self.startInteraction()
     elif whatCanBePlanted == GardenGlobals.GAG_TREE_TYPE:
         self.popupTreePlantingGui()
         self.startInteraction()
     elif whatCanBePlanted == GardenGlobals.STATUARY_TYPE:
         self.popupItemPlantingGui()
         self.startInteraction()
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:13,代码来源:DistributedGardenPlot.py

示例12: showRecipe

 def showRecipe(self):
     if base.localAvatar.flowerCollection.hasSpecies(self.species):
         self['text'] = TTLocalizer.FlowerSpeciesNames[self.species]
         if base.localAvatar.flowerCollection.hasFlower(self.species, self.variety):
             name = GardenGlobals.getFlowerVarietyName(self.species, self.variety)
             recipeKey = GardenGlobals.PlantAttributes[self.species]['varieties'][self.variety][0]
             self['text'] = name
             self.createBeanRecipeGui(GardenGlobals.Recipes[recipeKey]['beans'])
         else:
             self.cleanupBeanRecipeGui()
     else:
         self['text'] = TTLocalizer.FlowerUnknown
         self.cleanupBeanRecipeGui()
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:13,代码来源:FlowerSpeciesPanel.py

示例13: __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
开发者ID:AdrianF98,项目名称:Toontown-Rewritten,代码行数:38,代码来源:DistributedGardenPlot.py

示例14: getPlantingText

 def getPlantingText(self):
     plantText = 'hardcoding'
     if self.canBePlanted():
         whatCanBePlanted = GardenGlobals.whatCanBePlanted(self.ownerIndex, self.plot)
         plantText = TTLocalizer.GardeningPlant
         if whatCanBePlanted == GardenGlobals.INVALID_TYPE:
             self.notify.warning('whatCanBePlanted returned INVALID_TYPE for %d %d' % (self.ownerIndex, self.plot))
         elif whatCanBePlanted == GardenGlobals.FLOWER_TYPE:
             plantText = TTLocalizer.GardeningPlantFlower
         elif whatCanBePlanted == GardenGlobals.GAG_TREE_TYPE:
             plantText = TTLocalizer.GardeningPlantTree
         elif whatCanBePlanted == GardenGlobals.STATUARY_TYPE:
             plantText = TTLocalizer.GardeningPlantItem
     return plantText
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:14,代码来源:DistributedGardenPlot.py

示例15: plantGagTree

 def plantGagTree(self, track, level, toon):
     #free for now
     #av = simbase.air.doId2do.get(toon)
     #av.inventory.useItem(track, level)
     #av.d_setInventory(av.inventory.makeNetString())
     self.planted = DistributedGagTreeAI(self.air)
     self.planted.setEstate(self.getEstate())
     self.planted.setOwnerPlot(self.doId)
     self.planted.setPlot(self.getPlot())
     self.planted.setHeading(self.getHeading())
     self.planted.setPosition(*self.getPosition())
     self.planted.setOwnerIndex(self.getOwnerIndex())
     self.planted.setTypeIndex(GardenGlobals.getTreeTypeIndex(track, level))
     self.planted.setWaterLevel(0)
     self.planted.setGrowthLevel(0)
     self.sendUpdate('setMovie', [GardenGlobals.MOVIE_PLANT, toon])
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:16,代码来源:DistributedGardenPlotAI.py


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