def __init__(self, quest, rewards):
        self.width = 1
        self.rewards = rewards
        QuestDetailBase.__init__(self, parent=base.a2dBottomRight, pos=(0.6, 0, 0.52), text_fg=PiratesGuiGlobals.TextFG0)
        self.initialiseoptions(QuestRewardGUI)
        self.questComplete = DirectLabel(parent=self, relief=None, text=PLocalizer.QuestCompleted, text_fg=PiratesGuiGlobals.TextFG4, text_font=PiratesGlobals.getPirateOutlineFont(), text_shadow=(0,
                                                                                                                                                                                                    0,
                                                                                                                                                                                                    0,
                                                                                                                                                                                                    1), pos=(-1.32,
                                                                                                                                                                                                             0,
                                                                                                                                                                                                             0.13), scale=PiratesGuiGlobals.TextScaleTitleMed)
        gui = loader.loadModel('models/gui/toplevel_gui')
        gcButton = gui.find('**/treasure_w_coin*')
        goldCoin = gcButton.copyTo(gcButton)
        goldCoin.setScale(3)
        tpMgr.setGraphic('goldCoin', goldCoin)
        self.popupSfx = loadSfx(SoundGlobals.SFX_GUI_REWARD_POPUP)
        self.popupSfx.setVolume(0.4)
        self.reputation = self.rewards.get('reputation', 0)
        self.totalReputation = 0
        self.rewardsContainer = None
        self.items = self.rewards.get('items', [])
        if self.items:
            scale = 0.12 * len(self.items)
            self.rewardsContainer = InventoryUIRewardsContainer.InventoryUIRewardsContainer(localAvatar.guiMgr.inventoryUIManager, sizeX=scale, sizeZ=scale, countX=len(self.items), countZ=1)
            self.rewardsContainer.setPos(-0.1, 0, -0.225 - 0.06 * len(self.items))
            self.rewardsContainer.reparentTo(self)
            for itemId in self.items:
                self.rewardsContainer.addRewardIntoGrid(itemId, self.items.index(itemId), 0)

        inv = localAvatar.getInventory()
        if inv:
            self.totalReputation = localAvatar.getInventory().getReputation(InventoryType.OverallRep)
        oldLevel, leftoverValue = ReputationGlobals.getLevelFromTotalReputation(InventoryType.OverallRep, self.totalReputation)
        newLevel, leftoverValue = ReputationGlobals.getLevelFromTotalReputation(InventoryType.OverallRep, self.totalReputation + self.reputation)
        if oldLevel != newLevel:
            self.showLevelUp = True
        else:
            self.showLevelUp = False
        self.buildIvals()
        self.setQuestInfoFromQuest(quest)
        self.showPanel()
        return
示例#2
0
    def destroy(self):
        self.showIval.pause()
        self.showIval = None
        self.hideIval.pause()
        self.hideIval = None
        self.questCompleteScaleSeq.pause()
        self.questCompleteScaleSeq = None
        self.colorChangeParallel.pause()
        self.colorChangeParallel = None
        self.gameGui.destroy()
        self.gameGui = None
        self.questComplete.destroy()
        self.questComplete = None
        self.rewards = None
        if self.rewardsContainer:
            self.rewardsContainer.destroy()

        loader.unloadSfx(self.popupSfx)
        del self.popupSfx
        QuestDetailBase.destroy(self)
 def destroy(self):
     self.showIval.pause()
     self.showIval = None
     self.hideIval.pause()
     self.hideIval = None
     self.questCompleteScaleSeq.pause()
     self.questCompleteScaleSeq = None
     self.colorChangeParallel.pause()
     self.colorChangeParallel = None
     self.gameGui.destroy()
     self.gameGui = None
     self.questComplete.destroy()
     self.questComplete = None
     self.rewards = None
     if self.rewardsContainer:
         self.rewardsContainer.destroy()
     
     loader.unloadSfx(self.popupSfx)
     del self.popupSfx
     QuestDetailBase.destroy(self)
 def __init__(self, quest, rewards):
     self.width = 1
     self.rewards = rewards
     QuestDetailBase.__init__(self, parent = base.a2dBottomRight, pos = (0.59999999999999998, 0, 0.52000000000000002), text_fg = PiratesGuiGlobals.TextFG0)
     self.initialiseoptions(QuestRewardGUI)
     self.questComplete = DirectLabel(parent = self, relief = None, text = PLocalizer.QuestCompleted, text_fg = PiratesGuiGlobals.TextFG4, text_font = PiratesGlobals.getPirateOutlineFont(), text_shadow = (0, 0, 0, 1), pos = (-1.3200000000000001, 0, 0.13), scale = PiratesGuiGlobals.TextScaleTitleMed)
     gui = loader.loadModel('models/gui/toplevel_gui')
     gcButton = gui.find('**/treasure_w_coin*')
     goldCoin = gcButton.copyTo(gcButton)
     goldCoin.setScale(3)
     tpMgr.setGraphic('goldCoin', goldCoin)
     self.popupSfx = loadSfx(SoundGlobals.SFX_GUI_REWARD_POPUP)
     self.popupSfx.setVolume(0.40000000000000002)
     self.reputation = self.rewards.get('reputation', 0)
     self.totalReputation = 0
     self.rewardsContainer = None
     self.items = self.rewards.get('items', [])
     if self.items:
         scale = 0.12 * len(self.items)
         self.rewardsContainer = InventoryUIRewardsContainer.InventoryUIRewardsContainer(localAvatar.guiMgr.inventoryUIManager, sizeX = scale, sizeZ = scale, countX = len(self.items), countZ = 1)
         self.rewardsContainer.setPos(-0.10000000000000001, 0, -0.22500000000000001 - 0.059999999999999998 * len(self.items))
         self.rewardsContainer.reparentTo(self)
         for itemId in self.items:
             self.rewardsContainer.addRewardIntoGrid(itemId, self.items.index(itemId), 0)
         
     
     inv = localAvatar.getInventory()
     if inv:
         self.totalReputation = localAvatar.getInventory().getReputation(InventoryType.OverallRep)
     
     (oldLevel, leftoverValue) = ReputationGlobals.getLevelFromTotalReputation(InventoryType.OverallRep, self.totalReputation)
     (newLevel, leftoverValue) = ReputationGlobals.getLevelFromTotalReputation(InventoryType.OverallRep, self.totalReputation + self.reputation)
     if oldLevel != newLevel:
         self.showLevelUp = True
     else:
         self.showLevelUp = False
     self.buildIvals()
     self.setQuestInfoFromQuest(quest)
     self.showPanel()