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


Python RequestButton.setScale方法代码示例

本文整理汇总了Python中pirates.piratesgui.RequestButton.RequestButton.setScale方法的典型用法代码示例。如果您正苦于以下问题:Python RequestButton.setScale方法的具体用法?Python RequestButton.setScale怎么用?Python RequestButton.setScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pirates.piratesgui.RequestButton.RequestButton的用法示例。


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

示例1: PotionResults

# 需要导入模块: from pirates.piratesgui.RequestButton import RequestButton [as 别名]
# 或者: from pirates.piratesgui.RequestButton.RequestButton import setScale [as 别名]
class PotionResults(GuiPanel):
    
    def __init__(self, potionGame):
        self.potionGame = potionGame
        GuiPanel.__init__(self, '', 1.5, 1.0, showClose = False, titleSize = 1.5)
        self.setPos((-0.75, 0, -0.40000000000000002))
        self.bQuit = RequestButton(width = 1.5, text = PLocalizer.PotionGui['StopButton'], command = self.quit)
        self.bQuit.reparentTo(self)
        self.bQuit.setPos(0.14999999999999999, 0, 0.050000000000000003)
        self.bQuit.setScale(1.2, 1.2, 1.2)
        self.bAgain = RequestButton(width = 1.5, text = PLocalizer.PotionGui['PlayAgainButton'], command = self.playAgain)
        self.bAgain.reparentTo(self)
        self.bAgain.setPos(1.25, 0, 0.050000000000000003)
        self.bAgain.setScale(1.2, 1.2, 1.2)
        self.titleText = PLocalizer.PotionGui['WinTitle']
        self.messageText = PLocalizer.PotionGui['WinText']
        self.Title = DirectLabel(parent = self, relief = None, text = self.titleText, text_scale = PiratesGuiGlobals.TextScaleTitleJumbo, text_font = PiratesGlobals.getPirateOutlineFont(), text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextLT14, pos = (0.75, 0, 0.82999999999999996), textMayChange = 0)
        self.message = DirectLabel(parent = self, relief = None, text = self.messageText, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.75, 0, 0.71999999999999997), textMayChange = 0)
        self.potionName = None
        self.potionDesc = None
        self.potionXp = None
        self.potionImg = None

    
    def destroy(self):
        self.bQuit.destroy()
        self.bAgain.destroy()
        GuiPanel.destroy(self)

    
    def show(self):
        if self.potionName is not None:
            self.potionName.removeNode()
        
        if self.potionDesc is not None:
            self.potionDesc.removeNode()
        
        if self.potionXp is not None:
            self.potionXp.removeNode()
        
        if self.potionImg is not None:
            self.potionImg.removeNode()
        
        self.potionName = DirectLabel(parent = self, relief = None, text = self.potionGame.currentRecipe.name, text_scale = PiratesGuiGlobals.TextScaleTitleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.75, 0, 0.65000000000000002), textMayChange = 0)
        self.potionDesc = DirectLabel(parent = self, relief = None, text = self.potionGame.currentRecipe.desc, text_scale = PiratesGuiGlobals.TextScaleExtraLarge, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 34, pos = (0.75, 0, 0.22), textMayChange = 0)
        xpAmt = PotionGlobals.getPotionBuffXP(self.potionGame.currentRecipe.potionID)
        xpAmt = int(math.ceil(float(xpAmt) / 2.0))
        xpBonus = self.potionGame.dist.getXpBonus()
        labelTxt = '+ ' + str(xpAmt) + ' ' + PLocalizer.PotionGui['XPLabel']
        if xpBonus:
            xpAmt = xpAmt + xpBonus
            labelTxt = PLocalizer.PotionGui['XPLabelBonus'] % (str(xpAmt), str(xpBonus))
        
        self.potionXp = DirectLabel(parent = self, relief = None, text = labelTxt, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.75, 0, 0.28999999999999998), textMayChange = 0)
        asset = ItemGlobals.getIcon(PotionGlobals.potionBuffIdToInventoryTypeId(self.potionGame.currentRecipe.potionID))
        skillIcons = loader.loadModel('models/textureCards/skillIcons')
        geom = skillIcons.find('**/%s' % asset)
        if geom.isEmpty():
            geom = skillIcons.find('**/base')
        
        geom_scale = 0.23999999999999999
        self.potionImg = DirectFrame(parent = self, geom = geom, geom_scale = geom_scale, pos = (0.75, 0, 0.5), image = None, relief = None)
        self.unstash()
        self.potionGame.closeCurrentDialog = self.cleanUp
        self.potionGame.disableButtons()
        skillIcons.removeNode()

    
    def cleanUp(self):
        self.stash()
        self.potionGame.closeCurrentDialog = None
        self.potionGame.enableButtons()

    
    def playAgain(self):
        if self.potionGame.gameFSM.getCurrentOrNextState() not in [
            'Anim',
            'ChestOpened']:
            self.cleanUp()
            self.potionGame.gameFSM.request('Reset')
        

    
    def quit(self):
        if self.potionGame.gameFSM.getCurrentOrNextState() not in [
            'Anim']:
            self.cleanUp()
            self.potionGame.gameFSM.request('Exit')
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:90,代码来源:PotionResults.py

示例2: FishingResults

# 需要导入模块: from pirates.piratesgui.RequestButton import RequestButton [as 别名]
# 或者: from pirates.piratesgui.RequestButton.RequestButton import setScale [as 别名]
class FishingResults(NodePath):
    
    def __init__(self, fishingGame):
        NodePath.__init__(self, 'FishingResults')
        self.reparentTo(base.a2dRightCenter)
        self.gameObject = fishingGame
        self.setPos(-1.0, 0.0, -0.25)
        self.background = loader.loadModel('models/minigames/pir_m_gui_fsh_rewardScreen')
        self.background.reparentTo(self)
        self.background.setScale(0.80000000000000004, 0.75, 0.75)
        self.background.setPos(0.65000000000000002, 0.75, 0.75)
        self.bAgain = RequestButton(width = 1.5, text = PLocalizer.FishingGui['PlayAgainButton'], command = self.playAgain)
        self.bAgain.reparentTo(self)
        self.bAgain.setPos(0.57999999999999996, 0, 0.10000000000000001)
        self.bAgain.setScale(1.2, 1.2, 1.2)
        self.titleText = PLocalizer.FishingGui['WinTitle']
        self.messageText = PLocalizer.FishingGui['WinText']
        self.title = DirectLabel(parent = self, relief = None, text = self.titleText, text_scale = PiratesGuiGlobals.TextScaleTitleJumbo, text_font = PiratesGlobals.getPirateOutlineFont(), text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextLT14, pos = (0.62, 0, 1.3), textMayChange = 0)
        self.message = DirectLabel(parent = self, relief = None, text = self.messageText, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.64000000000000001, 0, 1.1499999999999999), textMayChange = 0)
        self.fishName = None
        self.levelUnlockDetails = None
        self.fishWeight = None
        self.fishXpAmt = 0
        self.fishXp = None
        self.fishXpBonus = None
        self.fishGoldAmt = 0
        self.fishGold = None
        self.fishGoldBonus = None
        self.collectionCard = loader.loadModel('models/gui/treasure_gui')

    
    def destroy(self):
        self.bAgain.destroy()

    
    def showAll(self):
        if self.fishName is not None:
            self.fishName.removeNode()
        
        if self.levelUnlockDetails is not None:
            self.levelUnlockDetails.removeNode()
        
        if self.fishWeight is not None:
            self.fishWeight.removeNode()
        
        if self.fishXp is not None:
            self.fishXp.removeNode()
        
        if self.fishGold is not None:
            self.fishGold.removeNode()
        
        self.fishName = DirectLabel(parent = self, relief = None, text = self.gameObject.fishManager.activeFish.myData['name'], text_scale = PiratesGuiGlobals.TextScaleTitleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.64000000000000001, 0, 1.04), textMayChange = 0)
        unlockText = ''
        newLevel = self.gameObject.getPredictedPlayerFishingLevel(int(self.gameObject.fishManager.activeFish.myData['experience']))
        if newLevel > self.gameObject.levelAtCastStart:
            self.gameObject.currentFishingLevel = newLevel
            unlockText = PLocalizer.FishingGui['LevelUp'] + ' ' + PLocalizer.Minigame_Fishing_Level_Unlocks[newLevel]
            self.gameObject.tutorialManager.showTutorial(InventoryType.FishingLevelGain)
            if newLevel == 10:
                self.gameObject.tutorialManager.showTutorial(InventoryType.FishingLevel10)
            
            if FishingGlobals.unlockLevelToSkillId.has_key(newLevel):
                unlock = FishingGlobals.unlockLevelToSkillId[newLevel]
                if FishingGlobals.skillIdToTutorialId.has_key(unlock):
                    tutorialContext = FishingGlobals.skillIdToTutorialId[unlock]
                    self.gameObject.tutorialManager.showTutorial(tutorialContext)
                
            
        
        self.levelUnlockDetails = DirectLabel(parent = self, relief = None, text = unlockText, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 16, pos = (0.64000000000000001, 0.0, 0.41999999999999998), textMayChange = 0)
        self.fishXpAmt = self.gameObject.fishManager.activeFish.myData['experience']
        self.fishXp = DirectLabel(parent = self, relief = None, text = '+ ' + str(self.fishXpAmt) + ' ' + PLocalizer.FishingGui['XPLabel'], text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.90000000000000002, 0, 0.63), textMayChange = 1)
        self.fishGoldAmt = int(self.gameObject.fishManager.activeFish.myData['gold'] * self.gameObject.fishManager.activeFish.weight)
        self.fishGold = DirectLabel(parent = self, relief = None, text = '+ ' + str(self.fishGoldAmt) + ' ' + PLocalizer.FishingGui['GoldText'], text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.90000000000000002, 0, 0.54000000000000004), textMayChange = 1)
        self.updateGoldAndXpBonus()
        self.fishWeight = DirectLabel(parent = self, relief = None, text = str(self.gameObject.fishManager.activeFish.weight) + ' ' + PLocalizer.FishingGui['WeightLabel'], text_scale = PiratesGuiGlobals.TextScaleTitleLarge, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.40000000000000002, 0, 0.59999999999999998), textMayChange = 0)
        pic_name = CollectionMap.Assets[self.gameObject.fishManager.activeFish.myData['id']]
        fishIcon = self.collectionCard.find('**/%s*' % pic_name)
        self.glow = DirectFrame(parent = self, geom = fishIcon, geom_scale = 1.0, pos = (0.64000000000000001, 0.0, 0.84999999999999998), image = None, relief = None)
        self.setScale(0.75, 0.75, 0.75)
        self.show()

    
    def updateGoldAndXpBonus(self):
        if self.fishXpBonus is not None:
            self.fishXpBonus.removeNode()
        
        xpBonus = self.gameObject.distributedFishingSpot.getXpBonus()
        if xpBonus:
            self.fishXp['text'] = '+ ' + str(self.fishXpAmt + xpBonus) + ' ' + PLocalizer.FishingGui['XPLabel']
            self.fishXpBonus = DirectLabel(parent = self, relief = None, text = PLocalizer.FishingGui['XPBonusLabel'] % str(xpBonus), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG4, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.90000000000000002, 0, 0.59999999999999998), textMayChange = 0)
        
        if self.fishGoldBonus is not None:
            self.fishGoldBonus.removeNode()
        
        goldBonus = self.gameObject.distributedFishingSpot.getGoldBonus()
        if goldBonus:
            self.fishGold['text'] = '+ ' + str(self.fishGoldAmt + goldBonus) + ' ' + PLocalizer.FishingGui['GoldText']
            self.fishGoldBonus = DirectLabel(parent = self, relief = None, text = PLocalizer.FishingGui['GoldBonusLabel'] % str(goldBonus), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG4, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 17, pos = (0.90000000000000002, 0, 0.51000000000000001), textMayChange = 0)
        
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:FishingResults.py


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