Exemplo n.º 1
0
 def addNewPiece(self):
     currentRecipe = self.potionGame.currentRecipe
     if self.leftPreviewPiece is None:
         self.leftPreviewPiece = PotionBoardPiece(self,
                                                  recipe=currentRecipe)
         self.rightPreviewPiece = PotionBoardPiece(self,
                                                   recipe=currentRecipe)
         self.leftPreviewPiece.setBoardPos(-4, self.numRows - 1)
         self.rightPreviewPiece.setBoardPos(-3, self.numRows - 1)
     self.leftPlayerPiece = self.leftPreviewPiece
     self.rightPlayerPiece = self.rightPreviewPiece
     self.leftPreviewPiece = PotionBoardPiece(
         self, colorSet=self.potionGame.dist.colorSet, recipe=currentRecipe)
     self.rightPreviewPiece = PotionBoardPiece(
         self, colorSet=self.potionGame.dist.colorSet, recipe=currentRecipe)
     self.leftPreviewPiece.setBoardPos(-4, self.numRows - 1)
     self.rightPreviewPiece.setBoardPos(-3, self.numRows - 1)
     self.leftPlayerPiece.setY(-5)
     self.leftPlayerPiece.reparentTo(self)
     self.rightPlayerPiece.setY(-5)
     self.rightPlayerPiece.reparentTo(self)
     self.leftPlayerPiece.moveFast = True
     self.rightPlayerPiece.moveFast = True
     self.potionGame.animationList.append(
         Sequence(
             self.leftPlayerPiece.moveToBoard(self.lastLeftCol,
                                              self.numRows - 1),
             Func(self.leftPlayerPiece.setY, 0)))
     self.potionGame.animationList.append(
         Sequence(
             self.rightPlayerPiece.moveToBoard(self.lastRightCol,
                                               self.numRows - 1),
             Func(self.rightPlayerPiece.setY, 0)))
     return
Exemplo n.º 2
0
    def __init__(self, potionGame):
        self.potionGame = potionGame
        DirectFrame.__init__(self, parent=potionGame.dialogs, relief=None)
        self.setPos((-0.5, 0, 0.075))
        guiAssets = loader.loadModel('models/minigames/pir_m_gui_pot_textureCard')
        parch = guiAssets.find('**/pir_t_gui_pot_potionIngredients')
        parch.setScale(3.45, 1, 3.45)
        parch.setPos(0.5, 0, -0.02)
        self.background = parch.copyTo(self)
        self.bQuit = GuiButton(image=(guiAssets.find('**/pir_t_gui_pot_exitIngredients'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredientsOn'), guiAssets.find('**/pir_t_gui_pot_exitIngredients')), scale=(0.3,
                                                                                                                                                                                                                                                                  0.3,
                                                                                                                                                                                                                                                                  0.3), command=self.quit)
        self.bQuit.reparentTo(self)
        self.bQuit.setPos(1.673, 0, 0.767)
        self.messageText = PLocalizer.PotionGui['InfoText']
        self.message = DirectLabel(parent=self, relief=None, text=self.messageText, text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_align=TextNode.ARight, text_fg=PotionGlobals.TextColor, text_shadow=None, pos=(-0.17, 0, 0.72), textMayChange=0)
        self.pieces = []
        self.pieceLabels = []
        for color in range(6):
            for level in range(6):
                piece = PotionBoardPiece(self, color, level + 1)
                piece.setPiecePosition(level * 0.112 - 0.277, 0.17 - color * 0.0709)
                piece.background.setDepthTest(False)
                piece.background.setDepthWrite(False)
                piece.setScale(0.35)
                self.pieces.append(piece)
                piecelabel = self.message = DirectLabel(parent=self, relief=None, text=PLocalizer.PotionIngredients[color][level], text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ACenter, text_fg=PotionGlobals.TextColor, text_shadow=None, pos=(level * 0.386 - 0.452, 0, 0.438 - color * 0.245), textMayChange=0)
                self.pieceLabels.append(piecelabel)

        guiAssets.removeNode()
        return
Exemplo n.º 3
0
 def loadIngredients(self):
     cm = CardMaker('card')
     cm.setFrame(0, 0.80000000000000004, 0, 0.29999999999999999)
     self.background = self.attachNewNode(cm.generate())
     self.background.setTransparency(True)
     self.background.setColor(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 0)
     self.islandReq = 0
     if len(self.ingredientData) > 0:
         if False:
             self.nameText = PLocalizer.PotionGui['UnknownRecipeName']
             self.descText = PLocalizer.PotionGui['UnknownRecipe']
             if len(self.ingredients) > 0:
                 for ingredient in self.ingredients:
                     if ingredient.colorIndex > -1:
                         ingredient.setColor(-1, -1)
                         continue
                 
             else:
                 for ingredientData in self.ingredientData:
                     ingredient = PotionBoardPiece(self, -1, -1)
                     ingredient.setHiddenInfo(ingredientData['color'], ingredientData['level'])
                     if ingredientData['color'] > 2:
                         self.islandReq = ingredientData['color']
                     
                     ingredient.showName()
                     self.ingredients.append(ingredient)
                 
         else:
             self.nameText = self.name
             self.descText = self.desc
             if len(self.ingredients) > 0:
                 for ingredient in self.ingredients:
                     if ingredient.colorIndex < 0:
                         ingredient.setColor(ingredientData['color'], ingredientData['level'])
                     
                     if ingredient.colorIndex > 2:
                         self.islandReq = ingredient.colorIndex
                         continue
                 
             else:
                 for ingredientData in self.ingredientData:
                     ingredient = PotionBoardPiece(self, ingredientData['color'], ingredientData['level'])
                     if ingredientData['color'] > 2:
                         self.islandReq = ingredientData['color']
                     
                     ingredient.showName()
                     self.ingredients.append(ingredient)
                 
         for ingredient in self.ingredients:
             ingredient.setCompleted(False)
             ingredient.setBoardPos(0, (5.2999999999999998 - self.ingredients.index(ingredient)) * 1.05)
         
     else:
         self.nameText = self.name
         self.descText = self.desc
         if self.ingredientCount is not None:
             self.ingredientCount.removeNode()
         
         self.ingredientCount = DirectLabel(parent = self.background, relief = None, text = str(self.ingredientsMade), text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ARight, text_fg = PotionGlobals.TextColor, text_wordwrap = 30, pos = (0.17000000000000001, 0, 0.94999999999999996), textMayChange = 1)
         if self.ingredientLabel is not None:
             self.ingredientLabel.removeNode()
         
         self.ingredientLabel = DirectLabel(parent = self.background, relief = None, text = PLocalizer.PotionGui['IngredientCount'], text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ALeft, text_fg = PotionGlobals.TextColor, text_wordwrap = 30, pos = (0.25, 0, 0.94999999999999996), textMayChange = 1)
         if self.tileCount is not None:
             self.tileCount.removeNode()
         
         self.tileCount = DirectLabel(parent = self.background, relief = None, text = str(self.tilesUsed), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ARight, text_fg = PotionGlobals.TextColor, text_wordwrap = 30, pos = (0.17000000000000001, 0, 0.75), textMayChange = 1)
         if self.tileLabel is not None:
             self.tileLabel.removeNode()
         
         self.tileLabel = DirectLabel(parent = self.background, relief = None, text = PLocalizer.PotionGui['TileCount'], text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_fg = PotionGlobals.TextColor, text_wordwrap = 30, pos = (0.25, 0, 0.75), textMayChange = 1)
         if self.soulCount is not None:
             self.soulCount.removeNode()
         
         self.soulCount = DirectLabel(parent = self.background, relief = None, text = str(self.soulsCleared), text_scale = PiratesGuiGlobals.TextScaleExtraLarge, text_align = TextNode.ARight, text_fg = PotionGlobals.TextColor, text_wordwrap = 30, pos = (0.17000000000000001, 0, 0.84999999999999998), textMayChange = 1)
         if self.soulLabel is not None:
             self.soulLabel.removeNode()
         
         self.soulLabel = DirectLabel(parent = self.background, relief = None, text = PLocalizer.PotionGui['SoulCount'], text_scale = PiratesGuiGlobals.TextScaleExtraLarge, text_align = TextNode.ALeft, text_fg = PotionGlobals.TextColor, text_wordwrap = 30, pos = (0.25, 0, 0.84999999999999998), textMayChange = 1)
     self.leveltext = PLocalizer.PotionGui['LevelLabel'] + str(self.level)
     if self.islandReq > 0:
         self.islandtext = PLocalizer.PotionGui['IslandName' + str(self.islandReq)]
     else:
         self.islandtext = PLocalizer.PotionGui['IslandName']
     if not self.enabled:
         self.levelColor = PiratesGuiGlobals.TextOV6
     elif not self.available:
         self.levelColor = PotionGlobals.TextColorDisabled
     else:
         self.levelColor = PotionGlobals.TextColor
     if not self.available:
         self.islandColor = PiratesGuiGlobals.TextOV6
     elif not self.enabled:
         self.islandColor = PotionGlobals.TextColorDisabled
     else:
         self.islandColor = PotionGlobals.TextColor
     if self.available and self.enabled:
         self.titleColor = PotionGlobals.TextColor
     else:
         self.titleColor = PotionGlobals.TextColorDisabled
     if self.title is not None:
         self.title.removeNode()
     
     self.title = DirectLabel(parent = self.background, relief = None, text = self.nameText, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_fg = self.titleColor, text_wordwrap = 30, pos = (0.37, 0, 1.23), textMayChange = 0)
     if self.subtitle1 is not None:
         self.subtitle1.removeNode()
     
     self.subtitle1 = DirectLabel(parent = self.background, relief = None, text = self.leveltext, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ARight, text_fg = self.levelColor, text_wordwrap = 30, pos = (0.34999999999999998, 0, 1.1799999999999999), textMayChange = 0)
     if self.subtitle2 is not None:
         self.subtitle2.removeNode()
     
     self.subtitle2 = DirectLabel(parent = self.background, relief = None, text = self.islandtext, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_fg = self.islandColor, text_wordwrap = 30, pos = (0.39000000000000001, 0, 1.1799999999999999), textMayChange = 0)
     if self.subtitle3 is not None:
         self.subtitle3.removeNode()
     
     self.subtitle3 = DirectLabel(parent = self.background, relief = None, text = self.descText, text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = self.titleColor, text_wordwrap = 30, pos = (0.37, 0, 1.1299999999999999), textMayChange = 0)
     self.stash()