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()
示例#2
0
 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)
    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()
 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)
示例#5
0
    def updatePage(self):
        #import pdb; pdb.set_trace()
        assert self.notify.debugStateCall(self)


        if hasattr(self, "collectedTotal"):
            # update the total  collection
            self.collectedTotal['text'] = (
                TTLocalizer.GardenPageCollectedTotal %
                (len(base.localAvatar.flowerCollection),
                GardenGlobals.getNumberOfFlowerVarieties()))

        if hasattr(self, "shovelBar"):
            # update the shovel info on the picker
            shovel = base.localAvatar.shovel
            shovelName = TTLocalizer.ShovelNameDict[shovel]
            curShovelSkill = base.localAvatar.shovelSkill
            maxShovelSkill = GardenGlobals.ShovelAttributes[shovel]['skillPts']

            #check if he's on the last shovel, if he is decrease max by 1
            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']

            #check if he's on the last watering can, if he is decrease max by 1
            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
            #self.shovel['text'] = textToUse

        else:
            print("no shovel bar")

        if self.mode == GardenPage_Collection:
            if hasattr(self, "browser"):
                # the flower collection  may have changed, update the browser
                self.browser.update()
        elif self.mode == GardenPage_Basket:
            if hasattr(self, "picker"):
                # the flower list may have changed, update the picker
                newBasketFlower = base.localAvatar.flowerBasket.getFlower()
                self.picker.update(newBasketFlower)
        elif self.mode == GardenPage_Trophy:
            if hasattr(self, "trophies"):
                # the garden trophy list may have changed, update the display
                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':
                #this gets called when we get the fertilizer from the mailbox
                #with the result that we see statue photo floating on the screen
                #so now make sure it doesn't happen
                self.specialsPhoto.hide()

        pass