예제 #1
0
 def _initAudio(self):
     if not self.moveSound:
         RepairBracingGame.moveSound = loadSfx(
             SoundGlobals.SFX_MINIGAME_REPAIR_BRACE_PIECEMOVE)
         RepairBracingGame.lineCompleteSound = loadSfx(
             SoundGlobals.SFX_MINIGAME_REPAIR_BRACE_LINECOMPLETE)
     RepairMincroGame._initAudio(self)
 def destroy(self):
     RepairMincroGame.destroy(self)
     taskMgr.remove('SawingGame.updateSawTask')
     self.sawButton.destroy()
     self.sawButton.removeNode()
     del self.sawButton
     if self.currentBoard:
         self.currentBoard.removeNode()
         self.currentBoard = None
     
     if self.onDeckBoard:
         self.onDeckBoard.removeNode()
         self.onDeckBoard = None
     
     self.sawingLine = None
     self.progressDescriptionLabel.destroy()
     self.progressDescriptionLabel = None
     self.progressLabel.destroy()
     self.progressLabel = None
     self.boardDestroyedLabel.destroy()
     self.boardDestroyedLabel = None
     for key in self.boardsPool.keys():
         board = self.boardsPool[key]
         if not board.isEmpty():
             board.removeNode()
             continue
     
     self.boardsPool.clear()
     self.newBoardSequence.clearToInitial()
     del self.newBoardSequence
     self.splitBoardSequence.clearToInitial()
     del self.splitBoardSequence
     self.dropBoardSequence.clearToInitial()
     del self.dropBoardSequence
예제 #3
0
 def _initVars(self):
     RepairMincroGame._initVars(self)
     self.boardsPool = {}
     self.currentBoard = None
     self.currentBoardIndex = 0
     self.onDeckBoard = None
     self.onDeckBoardIndex = 0
     self.totalScore = 0.0
     self.hitZone1Penalty = False
     self.hitZone2Penalty = False
     self.hitBoardPenalty = False
     self.moveDiffForSound = 0.0
     self.startPositions = (Point3(0.0, 0.0, 0.0), )
     self.currentStartIndex = 0
     self.lastMousePos = None
     self.board_left = None
     self.board_right = None
     self.cut = None
     self.zone1_right = None
     self.zone1_left = None
     self.zone2_right = None
     self.zone2_left = None
     self.piece1 = None
     self.piece2 = None
     self.lastHitIndex = -1
     self.sawWaypoints = []
 def enterGame(self):
     RepairMincroGame.enterGame(self)
     taskMgr.add(self.updateTask, 'RepairPitchingGame.updateTask')
     self.bucketPouring = False
     self.accept('mouse1', self.onMouseDown)
     self.accept('mouse1-up', self.onMouseUp)
     self.nextSpawnTime = 0.0
    def _initVisuals(self):
        RepairMincroGame._initVisuals(self)
        self.model = loader.loadModel('models/gui/pir_m_gui_srp_bracing_main')
        self.background = self.model.find('**/background')
        self.background.reparentTo(self)
        self.background.setZ(0.175)
        self.gridParent = self.attachNewNode('gridParent')
        self.grid = []
        for xpos in range(GRID_SIZE):
            col = []
            for ypos in range(GRID_SIZE):
                allWoodSquaresGeom = NodePath('wood_squares')
                for i in range(self.model.find('**/wood_squares').getNumChildren()):
                    self.model.find('**/wood_squares').getChild(i).copyTo(allWoodSquaresGeom)

                tempGeom = NodePath('tempGeom')
                self.model.find('**/wood_squares').getChild(0).copyTo(tempGeom)
                selectedOutlineGeom = NodePath('selectedOutlineGeom')
                self.model.find('**/selected').copyTo(selectedOutlineGeom)
                selectedOutlineGeom.setScale(0.9)
                piece = RepairGridPiece(name='piece%i' % (xpos * GRID_SIZE + ypos), parent=self.gridParent, allWoodSquaresGeom=allWoodSquaresGeom, selectedOutlineGeom=selectedOutlineGeom, scale=(0.9,
                                                                                                                                                                                                   0.9,
                                                                                                                                                                                                   0.9), pos=(-0.22 + xpos * SPACING, 0.0, -0.03 + ypos * SPACING), command=self.onPiecePressed, location=[xpos, ypos], clickSound=None, pressEffect=0, geom=tempGeom, relief=None)
                col.append(piece)

            self.grid.append(col)

        self.createGoalPieces()
        return
 def _initVars(self):
     RepairMincroGame._initVars(self)
     self.boardsPool = { }
     self.currentBoard = None
     self.currentBoardIndex = 0
     self.onDeckBoard = None
     self.onDeckBoardIndex = 0
     self.totalScore = 0.0
     self.hitZone1Penalty = False
     self.hitZone2Penalty = False
     self.hitBoardPenalty = False
     self.moveDiffForSound = 0.0
     self.startPositions = (Point3(0.0, 0.0, 0.0),)
     self.currentStartIndex = 0
     self.lastMousePos = None
     self.board_left = None
     self.board_right = None
     self.cut = None
     self.zone1_right = None
     self.zone1_left = None
     self.zone2_right = None
     self.zone2_left = None
     self.piece1 = None
     self.piece2 = None
     self.lastHitIndex = -1
     self.sawWaypoints = []
 def _initVisuals(self):
     RepairMincroGame._initVisuals(self)
     self.model = loader.loadModel('models/gui/pir_m_gui_srp_hammering_main')
     self.board = self.model.find('**/wood')
     self.board.reparentTo(self)
     self.board.setPos(-0.02, -2.0, 0.080000000000000002)
     self.board.setScale(1.3)
     self.board.setDepthTest(True)
     self.board.setDepthWrite(True)
     self.hammerSwinging = False
     self.nailParent = self.attachNewNode('nailParent')
     self.nails = []
     for i in range(self.config.nailCountRange[1]):
         nailModel = self.model.find('**/nail').copyTo(NodePath())
         nail = RepairNail(name = 'nail%i' % i, parent = self.nailParent, nailModel = nailModel)
         self.nails.append(nail)
     
     self.circle = aspect2d.attachNewNode('circle')
     self.circle.setHpr(0.0, 0.0, 0.0)
     self.circle.setZ(0.20000000000000001)
     self.reticleCursorPerfect = self.model.find('**/reticleCursorPerfect')
     self.reticleCursorPerfect.reparentTo(self.circle)
     self.reticleCursor = self.model.find('**/reticleCursor')
     self.reticleCursor.reparentTo(self.circle)
     self.hammer = self.model.find('**/hammerCursor')
     self.hammer.reparentTo(aspect2d)
     self.circle.stash()
     self.hammer.stash()
 def _initVisuals(self):
     RepairMincroGame._initVisuals(self)
     self.model = loader.loadModel('models/gui/pir_m_gui_srp_bracing_main')
     self.background = self.model.find('**/background')
     self.background.reparentTo(self)
     self.background.setZ(0.17499999999999999)
     self.gridParent = self.attachNewNode('gridParent')
     self.grid = []
     for xpos in range(GRID_SIZE):
         col = []
         for ypos in range(GRID_SIZE):
             allWoodSquaresGeom = NodePath('wood_squares')
             for i in range(self.model.find('**/wood_squares').getNumChildren()):
                 self.model.find('**/wood_squares').getChild(i).copyTo(allWoodSquaresGeom)
             
             tempGeom = NodePath('tempGeom')
             self.model.find('**/wood_squares').getChild(0).copyTo(tempGeom)
             selectedOutlineGeom = NodePath('selectedOutlineGeom')
             self.model.find('**/selected').copyTo(selectedOutlineGeom)
             selectedOutlineGeom.setScale(0.90000000000000002)
             piece = RepairGridPiece(name = 'piece%i' % (xpos * GRID_SIZE + ypos), parent = self.gridParent, allWoodSquaresGeom = allWoodSquaresGeom, selectedOutlineGeom = selectedOutlineGeom, scale = (0.90000000000000002, 0.90000000000000002, 0.90000000000000002), pos = (-0.22 + xpos * SPACING, 0.0, -0.029999999999999999 + ypos * SPACING), command = self.onPiecePressed, location = [
                 xpos,
                 ypos], clickSound = None, pressEffect = 0, geom = tempGeom, relief = None)
             col.append(piece)
         
         self.grid.append(col)
     
     self.createGoalPieces()
 def enterGame(self):
     RepairMincroGame.enterGame(self)
     taskMgr.add(self.updateTask, 'RepairPitchingGame.updateTask')
     self.bucketPouring = False
     self.accept('mouse1', self.onMouseDown)
     self.accept('mouse1-up', self.onMouseUp)
     self.nextSpawnTime = 0.0
 def setDifficulty(self, difficulty):
     RepairMincroGame.setDifficulty(self, difficulty)
     percent = difficulty / self.repairGame.difficultyMax
     dif = self.config.barnacleCountRange[1] - self.config.barnacleCountRange[0]
     self.barnacleCount = int(math.floor(self.config.barnacleCountRange[0] + dif * percent))
     dif = self.config.barnacleHPScaleRange[1] - self.config.barnacleHPScaleRange[0]
     self.barnacleHPScale = self.config.barnacleHPScaleRange[0] + dif * percent
 def destroy(self):
     RepairMincroGame.destroy(self)
     for leakSet in (self.activeLeaks, self.inactiveLeaks, self.patchedLeaks):
         for i in range(len(leakSet)):
             leak = leakSet.pop()
         
     
     del self.activeLeaks
     del self.inactiveLeaks
     del self.patchedLeaks
     for locator in self.locators:
         locator.removeNode()
     
     del self.locators
     self.board.removeNode()
     del self.board
     self.crossHair.removeNode()
     del self.crossHair
     self.bucket.removeNode()
     del self.bucket
     self.bucketIdle.removeNode()
     del self.bucketIdle
     if self.missSeq is not None:
         self.missSeq.finish()
     
     del self.missSeq
     self.missPatch.removeNode()
     del self.missPatch
 def _initVars(self):
     RepairMincroGame._initVars(self)
     self.circleDirection = GROW
     self.currentMin = 0.0
     self.nailCount = 0
     self.currentNails = []
     self.aim = 1.0
예제 #13
0
    def destroy(self):
        RepairMincroGame.destroy(self)
        taskMgr.remove('SawingGame.updateSawTask')
        self.sawButton.destroy()
        self.sawButton.removeNode()
        del self.sawButton
        if self.currentBoard:
            self.currentBoard.removeNode()
            self.currentBoard = None

        if self.onDeckBoard:
            self.onDeckBoard.removeNode()
            self.onDeckBoard = None

        self.sawingLine = None
        self.progressDescriptionLabel.destroy()
        self.progressDescriptionLabel = None
        self.progressLabel.destroy()
        self.progressLabel = None
        self.boardDestroyedLabel.destroy()
        self.boardDestroyedLabel = None
        for key in self.boardsPool.keys():
            board = self.boardsPool[key]
            if not board.isEmpty():
                board.removeNode()
                continue

        self.boardsPool.clear()
        self.newBoardSequence.clearToInitial()
        del self.newBoardSequence
        self.splitBoardSequence.clearToInitial()
        del self.splitBoardSequence
        self.dropBoardSequence.clearToInitial()
        del self.dropBoardSequence
 def setDifficulty(self, difficulty):
     RepairMincroGame.setDifficulty(self, difficulty)
     percent = difficulty / self.repairGame.difficultyMax
     difIndex = int(
         math.floor(percent * (len(self.config.difficultyLevels) - 1)))
     self.currentGridDimensionAndLineCount = self.config.difficultyLevels[
         difIndex]
 def setDifficulty(self, difficulty):
     RepairMincroGame.setDifficulty(self, difficulty)
     percent = difficulty / self.repairGame.difficultyMax
     dif = self.config.barnacleCountRange[1] - self.config.barnacleCountRange[0]
     self.barnacleCount = int(math.floor(self.config.barnacleCountRange[0] + dif * percent))
     dif = self.config.barnacleHPScaleRange[1] - self.config.barnacleHPScaleRange[0]
     self.barnacleHPScale = self.config.barnacleHPScaleRange[0] + dif * percent
예제 #16
0
    def reset(self):
        for key in self.boardsPool.keys():
            board = self.boardsPool[key]
            board.removeNode()

        self.boardsPool.clear()
        if self.currentBoard:
            self.currentBoard.removeNode()
            self.currentBoard = None
        if self.onDeckBoard:
            self.onDeckBoard.removeNode()
            self.onDeckBoard = None
        for boardIndex in self.currentDifficultySet:
            boardIndex -= 1
            if 'copy1_%s' % boardIndex not in self.boardsPool:
                board = self.getNewBoard(boardIndex)
                self.boardsPool['copy1_%s' % boardIndex] = board
            if 'copy2_%s' % boardIndex not in self.boardsPool:
                board = self.getNewBoard(boardIndex)
                self.boardsPool['copy2_%s' % boardIndex] = board

        self.currentBoardIndex = 0
        self.currentBoard = None
        self.moveNewBoardOnDeck()
        self.onDeckBoard.unstash()
        self.totalScore = 0
        self.startPositions = (Point3(0.0, 0.0, 0.0), )
        self.sawButton.stash()
        self.sawButton.reparentTo(self)
        self.lastHitIndex = -1
        self.moveDiffForSound = 0.0
        RepairMincroGame.reset(self)
        self.repairGame.gui.setTutorial(self.name)
        self.repairGame.gui.setTitle(self.name)
        return
 def enterGame(self):
     RepairMincroGame.enterGame(self)
     for (xpos, ypos, piece) in self.iterateCoordsAndPieces():
         if not piece.isEmptyPiece():
             piece.setEnabled(True)
             piece.request('Active')
             continue
 def _initAudio(self):
     RepairMincroGame._initAudio(self)
     if not self.pumpDownSounds:
         RepairPumpingGame.pumpDownSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_DOWN01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_DOWN02), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_DOWN03))
         RepairPumpingGame.pumpUpSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_UP01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_UP02), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_UP03))
         RepairPumpingGame.pumpGoodSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD02), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD03), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD04), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD05), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD06))
         RepairPumpingGame.pumpBadSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_BAD),)
예제 #19
0
 def _initAudio(self):
     RepairMincroGame._initAudio(self)
     if not self.pumpDownSounds:
         RepairPumpingGame.pumpDownSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_DOWN01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_DOWN02), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_DOWN03))
         RepairPumpingGame.pumpUpSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_UP01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_UP02), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_UP03))
         RepairPumpingGame.pumpGoodSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD02), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD03), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD04), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD05), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_GOOD06))
         RepairPumpingGame.pumpBadSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_PUMP_BAD),)
    def destroy(self):
        RepairMincroGame.destroy(self)
        for leakSet in (self.activeLeaks, self.inactiveLeaks,
                        self.patchedLeaks):
            for i in range(len(leakSet)):
                leak = leakSet.pop()

        del self.activeLeaks
        del self.inactiveLeaks
        del self.patchedLeaks
        for locator in self.locators:
            locator.removeNode()

        del self.locators
        self.board.removeNode()
        del self.board
        self.crossHair.removeNode()
        del self.crossHair
        self.bucket.removeNode()
        del self.bucket
        self.bucketIdle.removeNode()
        del self.bucketIdle
        if self.missSeq is not None:
            self.missSeq.finish()
        del self.missSeq
        self.missPatch.removeNode()
        del self.missPatch
        return
 def destroy(self):
     RepairMincroGame.destroy(self)
     del self.currentNails
     self.board.removeNode()
     self.circle.removeNode()
     for n in self.nails:
         n.removeNode()
 def enterGame(self):
     RepairMincroGame.enterGame(self)
     for (xpos, ypos, piece) in self.iterateCoordsAndPieces():
         if not piece.isEmptyPiece():
             piece.setEnabled(True)
             piece.request('Active')
             continue
예제 #23
0
 def _initVisuals(self):
     RepairMincroGame._initVisuals(self)
     self.setBin('fixed', 36)
     self.model = loader.loadModel('models/gui/pir_m_gui_srp_sawing_main')
     sawModel = self.model.find('**/saw')
     sawModel.setR(193)
     sawModel.setPos(0.9, 0.0, -0.165)
     sawModel.setBin('gui-popup', 0)
     self.sawButton = RepairSaw(parent=self,
                                clickDownCommand=self.sawAttachedToMouse,
                                clickUpCommand=self.sawRemovedFromMouse,
                                geom=sawModel,
                                text_pos=(0.2, -0.3),
                                text_fg=(1, 0, 0, 1),
                                scale=(0.3, 0.3, 0.3),
                                relief=None,
                                pressEffect=0,
                                frameSize=(-0.05, 1.05, -0.3, 0.05),
                                rolloverSound=None,
                                clickSound=None)
     self.sawingLine = RepairSawingLine(self,
                                        self.config.sawlineLineThickness,
                                        self.config.sawlineColor,
                                        self.config.sawlineLinespawnDist)
     self.progressDescriptionLabel = DirectLabel(
         text=PLocalizer.Minigame_Repair_Sawing_Description,
         text_fg=(1.0, 1.0, 1.0, 1.0),
         text_pos=(0.0, 0.0),
         text_shadow=(0.0, 0.0, 0.0, 1.0),
         text_font=PiratesGlobals.getPirateFont(),
         text_align=TextNode.ARight,
         relief=None,
         scale=(0.08, 0.08, 0.08),
         pos=(-0.2, 0.0, 0.5),
         parent=self)
     self.progressLabel = DirectLabel(
         text=PLocalizer.Minigame_Repair_Sawing_Thresholds[3],
         text_fg=(1.0, 1.0, 1.0, 1.0),
         text_pos=(0.0, 0.0),
         text_shadow=(0.0, 0.0, 0.0, 1.0),
         text_font=PiratesGlobals.getPirateFont(),
         text_align=TextNode.ALeft,
         relief=None,
         scale=(0.08, 0.08, 0.08),
         pos=(-0.18, 0.0, 0.5),
         parent=self)
     self.boardDestroyedLabel = DirectLabel(
         text=PLocalizer.Minigame_Repair_Sawing_Board_Destroyed,
         text_fg=(1.0, 0.0, 0.0, 1.0),
         text_pos=(0.0, 0.0),
         text_font=PiratesGlobals.getPirateFont(),
         text_shadow=(0.0, 0.0, 0.0, 1.0),
         relief=None,
         scale=(0.1, 0.1, 0.1),
         pos=(0.0, 0.0, 0.1),
         parent=self)
     self.boardDestroyedLabel.setBin('fixed', 38)
     self.boardDestroyedLabel.stash()
     return
 def enterGame(self):
     RepairMincroGame.enterGame(self)
     self.lastCompleteCount = 0
     taskMgr.add(self.updateTask, 'RepairCareeningGame.updateTask-%d' % id(self))
     self.accept('mouse1', self.onMouseDown)
     self.accept('mouse1-up', self.onMouseUp)
     if base.mouseWatcherNode.hasMouse() and base.mouseWatcherNode.isButtonDown(MouseButton.one()):
         self.onMouseDown()
 def enterGame(self):
     RepairMincroGame.enterGame(self)
     self.lastCompleteCount = 0
     taskMgr.add(self.updateTask, 'RepairCareeningGame.updateTask')
     self.accept('mouse1', self.onMouseDown)
     self.accept('mouse1-up', self.onMouseUp)
     if base.mouseWatcherNode.hasMouse() and base.mouseWatcherNode.isButtonDown(MouseButton.one()):
         self.onMouseDown()
 def reset(self):
     RepairMincroGame.reset(self)
     self.lastMousePos = Point2(0.0, 0.0)
     self.isMouseDown = False
     self.randomizeBoard()
     self.repairGame.gui.setTutorial(self.name)
     self.brush.stash()
     self.repairGame.gui.setTitle(self.name)
 def exitGame(self):
     RepairMincroGame.exitGame(self)
     self.ignore('mouse1')
     taskMgr.remove('RepairHammerGame.updateTask')
     taskMgr.remove('RepairHammerGame.updateCircleRadiusMin')
     self.circle.stash()
     self.hammer.stash()
     self.repairGame.mousePicker.clearCollisionMask()
 def _initAudio(self):
     RepairMincroGame._initAudio(self)
     if not self.hammerComplete:
         RepairHammeringGame.hammerComplete = loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_HAMMER_COMPLETE)
         RepairHammeringGame.weakHammerSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_HAMMER_WEAKHIT01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_HAMMER_WEAKHIT02))
         RepairHammeringGame.normalHammerSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_HAMMER_HIT01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_HAMMER_HIT02), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_HAMMER_HIT03))
         RepairHammeringGame.perfectHammerSound = loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_HAMMER_PERFECT)
         RepairHammeringGame.failSound = loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_FAIL)
 def exitGame(self):
     RepairMincroGame.exitGame(self)
     self.sawButton.deactivate()
     self.repairGame.mousePicker.clearCollisionMask()
     taskMgr.remove('SawingGame.updateSawTask')
     self.splitBoardSequence.clearToInitial()
     self.dropBoardSequence.clearToInitial()
     localAvatar.guiMgr._showCursor()
 def enterGame(self):
     RepairMincroGame.enterGame(self)
     self.accept('mouse1', self.onMouseClick)
     self.accept('mouse1-up', self.onMouseUp)
     taskMgr.add(self.updateTask, 'RepairHammerGame.updateTask')
     self.repairGame.mousePicker.setCollisionMask(NAIL_COLLIDE_MASK)
     for n in self.currentNails:
         n.request('Active')
 def reset(self):
     RepairMincroGame.reset(self)
     self.lastMousePos = Point2(0.0, 0.0)
     self.isMouseDown = False
     self.randomizeBoard()
     self.repairGame.gui.setTutorial(self.name)
     self.brush.stash()
     self.repairGame.gui.setTitle(self.name)
예제 #32
0
 def _initIntervals(self):
     RepairMincroGame._initIntervals(self)
     self.newBoardSequence = Sequence(
         name='RepairSawingGame.newBoardSequence')
     self.splitBoardSequence = Sequence(
         name='RepairSawGame.splitBoardSequence')
     self.dropBoardSequence = Sequence(
         name='RepairSawGame.dropBoardSequence')
예제 #33
0
 def exitGame(self):
     RepairMincroGame.exitGame(self)
     self.sawButton.deactivate()
     self.repairGame.mousePicker.clearCollisionMask()
     taskMgr.remove('SawingGame.updateSawTask')
     self.splitBoardSequence.clearToInitial()
     self.dropBoardSequence.clearToInitial()
     localAvatar.guiMgr._showCursor()
 def _initVars(self):
     RepairMincroGame._initVars(self)
     self.nextSpawnTime = 0.0
     self.inactiveLeaks = set()
     self.activeLeaks = set()
     self.patchedLeaks = set()
     self.locators = []
     self.leakCount = 0
     self.maxLeaks = 0
     self.bucketPouring = False
 def setDifficulty(self, difficulty):
     RepairMincroGame.setDifficulty(self, difficulty)
     percent = difficulty / self.repairGame.difficultyMax
     dif = self.config.pumpPowerRange[0] - self.config.pumpPowerRange[1]
     self.pumpRate = self.config.pumpPowerRange[0] - dif * percent
     dif = self.config.barStartRange[0] - self.config.barStartRange[1]
     self.currentBarRate = self.config.barStartRange[0] - dif * percent
     dif = self.config.hitRange[0] - self.config.hitRange[1]
     self.hitRange = self.config.hitRange[0] - dif * percent
     self.goalBox.setSz((self.hitRange / 0.17999999999999999) * self.goalBoxStartScale)
 def _initVars(self):
     RepairMincroGame._initVars(self)
     self.nextSpawnTime = 0.0
     self.inactiveLeaks = set()
     self.activeLeaks = set()
     self.patchedLeaks = set()
     self.locators = []
     self.leakCount = 0
     self.maxLeaks = 0
     self.bucketPouring = False
예제 #37
0
 def setDifficulty(self, difficulty):
     RepairMincroGame.setDifficulty(self, difficulty)
     percent = difficulty / self.repairGame.difficultyMax
     dif = self.config.pumpPowerRange[0] - self.config.pumpPowerRange[1]
     self.pumpRate = self.config.pumpPowerRange[0] - dif * percent
     dif = self.config.barStartRange[0] - self.config.barStartRange[1]
     self.currentBarRate = self.config.barStartRange[0] - dif * percent
     dif = self.config.hitRange[0] - self.config.hitRange[1]
     self.hitRange = self.config.hitRange[0] - dif * percent
     self.goalBox.setSz((self.hitRange / 0.17999999999999999) * self.goalBoxStartScale)
 def reset(self):
     RepairMincroGame.reset(self)
     self.randomizeBoard()
     tutorialIndex = 0
     self.linesComplete = 0
     self.lastLineCompleteTime = globalClock.getRealTime()
     if len(self.currentGridDimensionAndLineCount[1]) > 1:
         tutorialIndex = 1
     self.repairGame.gui.setTutorial(self.name, tutorialIndex)
     self.repairGame.gui.setTitle(self.name)
예제 #39
0
    def _initVisuals(self):
        RepairMincroGame._initVisuals(self)
        self.model = loader.loadModel(
            'models/gui/pir_m_gui_srp_careening_main')
        self.board = self.model.find('**/hull')
        self.board.reparentTo(self)
        self.board.setScale(1.0)
        self.board.setPos(-0.12, 0.0, 0.19)
        self.brush = self.model.find('**/brushCursor')
        self.brush.reparentTo(aspect2d)
        self.brush.stash()
        barnacleGeom = [
            self.model.find('**/barnacles/barnacle0'),
            self.model.find('**/barnacles/barnacle1'),
            self.model.find('**/barnacles/barnacle2')
        ]
        self.barnacles = []
        for i in range(self.config.barnacleCountRange[1]):
            bGeom = barnacleGeom[random.randint(0, 1)].copyTo(
                NodePath('barnacle%i' % i))
            bGeom.setBin('fixed', 36)
            if random.random() < self.config.mossPercentage:
                mGeom = barnacleGeom[2].copyTo(NodePath('moss'))
                mGeom.reparentTo(bGeom)
                mGeom.setPos(random.uniform(0,
                                            self.config.mossPosVariance), 0.0,
                             random.uniform(0, self.config.mossPosVariance))
                mGeom.setBin('fixed', 35)

            b = RepairBarnacle('barnacle%i' % i, bGeom)
            b.reparentTo(self)
            self.barnacles.append(b)
            b.stash()

        self.scrubPowerMeter = self.model.find('**/scrubMeter')
        self.scrubMeterBackground = self.model.find('**/scrubMeterBackground')
        self.scrubMeterBackground.setBin('fixed', 32)
        self.scrubMeterBar = self.model.find('**/scrubMeterBar')
        self.scrubMeterBar.setBin('fixed', 33)
        self.scrubMeterFrame = self.model.find('**/scrubMeterFrame')
        self.scrubMeterFrame.setBin('fixed', 34)
        self.scrubPowerMeter.reparentTo(self)
        self.scrubPowerMeter.setPos(0.68000000000000005, 0.0,
                                    0.20000000000000001)
        self.scrubPowerMeter.setSz(1.25)
        self.pushLabel = DirectLabel(
            text=PLocalizer.Minigame_Repair_Careening_Power,
            pos=(0.68000000000000005, 0.0, -0.27000000000000002),
            text_fg=(1.0, 1.0, 1.0, 1.0),
            text_shadow=(0.0, 0.0, 0.0, 1.0),
            text_font=PiratesGlobals.getPirateFont(),
            scale=(0.080000000000000002, 0.080000000000000002,
                   0.080000000000000002),
            parent=self,
            relief=None)
 def _initAudio(self):
     RepairMincroGame._initAudio(self)
     if not self.scrubSounds:
         RepairCareeningGame.scrubSounds = (loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_SCRUB01), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_SCRUB02), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_SCRUB03), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_SCRUB04), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_SCRUB05), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_SCRUB06), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_SCRUB07), loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_SCRUB08))
         for sound in RepairCareeningGame.scrubSounds:
             sound.setVolume(0.75)
         
         RepairCareeningGame.powerFullSound = loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_CHRGCOMP)
         RepairCareeningGame.powerFullSound.setVolume(0.75)
         RepairCareeningGame.powerEmptySound = loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_CAREEN_CHRGEMPTY)
         RepairCareeningGame.powerEmptySound.setVolume(0.75)
 def reset(self):
     RepairMincroGame.reset(self)
     self.randomizeBoard()
     tutorialIndex = 0
     self.linesComplete = 0
     self.lastLineCompleteTime = globalClock.getRealTime()
     if len(self.currentGridDimensionAndLineCount[1]) > 1:
         tutorialIndex = 1
     
     self.repairGame.gui.setTutorial(self.name, tutorialIndex)
     self.repairGame.gui.setTitle(self.name)
 def exitGame(self):
     self.bucket.stash()
     self.bucketIdle.stash()
     self.crossHair.stash()
     RepairMincroGame.exitGame(self)
     self.ignore('mouse1')
     self.ignore('mouse1-up')
     taskMgr.remove('RepairPitchingGame.updateTask')
     self.clearLeaks()
     self.bucket.stash()
     self.bucketIdle.stash()
 def exitGame(self):
     self.bucket.stash()
     self.bucketIdle.stash()
     self.crossHair.stash()
     RepairMincroGame.exitGame(self)
     self.ignore('mouse1')
     self.ignore('mouse1-up')
     taskMgr.remove('RepairPitchingGame.updateTask')
     self.clearLeaks()
     self.bucket.stash()
     self.bucketIdle.stash()
 def _initVars(self):
     RepairMincroGame._initVars(self)
     self.pumpRate = 0.0
     self.remainingWater = 1.0
     self.chainCount = 0
     self.barDirection = UP
     self.goalIndex = TOP
     self.currentBarRate = self.config.barStartRange[0]
     self.hitRange = self.config.hitRange[0]
     self.barPercent = 0.0
     self.failedPercentAndDirection = (-1.0, UP)
예제 #45
0
 def setDifficulty(self, difficulty):
     RepairMincroGame.setDifficulty(self, difficulty)
     percent = difficulty / self.repairGame.difficultyMax
     dif = self.config.leakCountRange[1] - self.config.leakCountRange[0]
     self.leakCount = int(math.floor(self.config.leakCountRange[0] + dif * percent))
     dif = self.config.maxLeaksRange[1] - self.config.maxLeaksRange[0]
     self.maxLeaks = int(math.floor(self.config.maxLeaksRange[0] + dif * percent))
     dif = self.config.spawnDelayRange[1] - self.config.spawnDelayRange[0]
     self.minSpawnTime = self.config.spawnDelayRange[0] + dif * percent
     dif = self.config.spawnDelayRange[3] - self.config.spawnDelayRange[2]
     self.maxSpawnTime = self.config.spawnDelayRange[2] + dif * percent
 def setDifficulty(self, difficulty):
     RepairMincroGame.setDifficulty(self, difficulty)
     percent = difficulty / self.repairGame.difficultyMax
     dif = self.config.leakCountRange[1] - self.config.leakCountRange[0]
     self.leakCount = int(math.floor(self.config.leakCountRange[0] + dif * percent))
     dif = self.config.maxLeaksRange[1] - self.config.maxLeaksRange[0]
     self.maxLeaks = int(math.floor(self.config.maxLeaksRange[0] + dif * percent))
     dif = self.config.spawnDelayRange[1] - self.config.spawnDelayRange[0]
     self.minSpawnTime = self.config.spawnDelayRange[0] + dif * percent
     dif = self.config.spawnDelayRange[3] - self.config.spawnDelayRange[2]
     self.maxSpawnTime = self.config.spawnDelayRange[2] + dif * percent
예제 #47
0
 def _initVars(self):
     RepairMincroGame._initVars(self)
     self.pumpRate = 0.0
     self.remainingWater = 1.0
     self.chainCount = 0
     self.barDirection = UP
     self.goalIndex = TOP
     self.currentBarRate = self.config.barStartRange[0]
     self.hitRange = self.config.hitRange[0]
     self.barPercent = 0.0
     self.failedPercentAndDirection = (-1.0, UP)
예제 #48
0
 def _initAudio(self):
     RepairMincroGame._initAudio(self)
     if not self.sawSounds:
         RepairSawingGame.sawSounds = (
             loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_SAW_INOUT01),
             loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_SAW_INOUT02),
             loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_SAW_INOUT03),
             loadSfx(SoundGlobals.SFX_MINIGAME_REPAIR_SAW_INOUT04))
         RepairSawingGame.boardComplete = loadSfx(
             SoundGlobals.SFX_MINIGAME_REPAIR_SAW_COMPLETE)
         RepairSawingGame.boardDestroyed = loadSfx(
             SoundGlobals.SFX_MINIGAME_REPAIR_SAW_FAIL)
 def _initVisuals(self):
     RepairMincroGame._initVisuals(self)
     self.model = loader.loadModel('models/gui/pir_m_gui_srp_pumping_main')
     self.visual = self.attachNewNode('visual')
     self.visual.setPos(-0.25, 0.0, 0.074999999999999997)
     goalTopLoc = self.model.find('**/locator_top')
     goalTopLoc.reparentTo(self.visual)
     goalBottomLoc = self.model.find('**/locator_bottom')
     goalBottomLoc.reparentTo(self.visual)
     self.goalPositions = (goalBottomLoc.getPos(self), goalTopLoc.getPos(self))
     self.greatLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pumping_Great, text_fg = (0.20000000000000001, 0.80000000000000004, 0.29999999999999999, 1.0), text_pos = (0.0, 0.59999999999999998), text_align = TextNode.ACenter, text_font = PiratesGlobals.getPirateFont(), relief = None, text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.46500000000000002, 0.0, 0.0), parent = self)
     self.failLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pumping_Fail, text_fg = (0.80000000000000004, 0.20000000000000001, 0.29999999999999999, 1.0), text_pos = (0.0, 0.59999999999999998), text_align = TextNode.ARight, text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), relief = None, scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.625, 0.0, 0.0), parent = self)
     self.shipBackground = self.model.find('**/static_ship_background')
     self.shipBackground.reparentTo(self.visual)
     self.waterMeter = self.model.find('**/sprite_waterBottom')
     self.waterMeter.reparentTo(self.visual)
     self.waterTop = self.model.find('**/sprite_waterTop')
     self.waterTop.reparentTo(self.visual)
     self.waterMeterTopLoc = self.waterMeter.find('**/locator_topOfShipWater')
     self.pumpBackground = self.model.find('**/pumpBackground')
     self.pumpBackground.reparentTo(self.visual)
     self.pumpWaterTop = self.model.find('**/sprite_pumpWaterTop')
     self.pumpWaterTop.reparentTo(self.visual)
     self.pumpWaterBottom = self.model.find('**/sprite_pumpWaterBottom')
     self.pumpWaterBottom.reparentTo(self.visual)
     self.pumpWaterTopLoc = self.pumpWaterBottom.find('**/locator_topOfPumpWater')
     self.pumpHandle = self.model.find('**/sprite_handle')
     self.pumpHandle.reparentTo(self.visual)
     self.pumpBar = self.model.find('**/static_pump')
     self.pumpBar.reparentTo(self.visual)
     self.goalBox = self.model.find('**/sprite_clickField')
     self.goalBox.reparentTo(self.visual)
     self.goalBox.setTransparency(1)
     self.enableGoalBox()
     self.pumpLine = self.model.find('**/sprite_bar')
     self.pumpLine.reparentTo(self.visual)
     self.ghostLine = self.visual.attachNewNode('ghostLine')
     self.pumpLine.getChild(0).copyTo(self.ghostLine)
     self.ghostLine.setScale(self.pumpLine.getScale())
     self.ghostLine.setColor(1.0, 0.20000000000000001, 0.20000000000000001, 1.0)
     self.shipForground = self.model.find('**/static_ship_foreground')
     self.shipForground.reparentTo(self.visual)
     cm = CardMaker('cardMaker')
     cm.setFrame(-0.33000000000000002, 0.33000000000000002, 0.0, 1.0)
     self.goalBox.setZ(self.goalPositions[TOP].getZ())
     self.goalBoxStartScale = self.goalBox.getSz()
     self.enableGoalBox()
     self.pumpWaterUpLerp = LerpFunc(self.setPumpWater, fromData = -0.10000000000000001, toData = 1.0, duration = 0.5)
     self.pumpWaterDownLerp = LerpFunc(self.setPumpWater, fromData = 1.0, toData = -0.10000000000000001, duration = 0.5)
     self.model.removeNode()
     del self.model
 def _initVisuals(self):
     RepairMincroGame._initVisuals(self)
     self.setBin('fixed', 36)
     self.model = loader.loadModel('models/gui/pir_m_gui_srp_sawing_main')
     sawModel = self.model.find('**/saw')
     sawModel.setR(193)
     sawModel.setPos(0.90000000000000002, 0.0, -0.16500000000000001)
     sawModel.setBin('gui-popup', 0)
     self.sawButton = RepairSaw(parent = self, clickDownCommand = self.sawAttachedToMouse, clickUpCommand = self.sawRemovedFromMouse, geom = sawModel, text_pos = (0.20000000000000001, -0.29999999999999999), text_fg = (1, 0, 0, 1), scale = (0.29999999999999999, 0.29999999999999999, 0.29999999999999999), relief = None, pressEffect = 0, frameSize = (-0.050000000000000003, 1.05, -0.29999999999999999, 0.050000000000000003), rolloverSound = None, clickSound = None)
     self.sawingLine = RepairSawingLine(self, self.config.sawlineLineThickness, self.config.sawlineColor, self.config.sawlineLinespawnDist)
     self.progressDescriptionLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Sawing_Description, text_fg = (1.0, 1.0, 1.0, 1.0), text_pos = (0.0, 0.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateFont(), text_align = TextNode.ARight, relief = None, scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.20000000000000001, 0.0, 0.5), parent = self)
     self.progressLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Sawing_Thresholds[3], text_fg = (1.0, 1.0, 1.0, 1.0), text_pos = (0.0, 0.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateFont(), text_align = TextNode.ALeft, relief = None, scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.17999999999999999, 0.0, 0.5), parent = self)
     self.boardDestroyedLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Sawing_Board_Destroyed, text_fg = (1.0, 0.0, 0.0, 1.0), text_pos = (0.0, 0.0), text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), relief = None, scale = (0.10000000000000001, 0.10000000000000001, 0.10000000000000001), pos = (0.0, 0.0, 0.10000000000000001), parent = self)
     self.boardDestroyedLabel.setBin('fixed', 38)
     self.boardDestroyedLabel.stash()
 def destroy(self):
     RepairMincroGame.destroy(self)
     self.scrubPowerMeter.detachNode()
     self.scrubPowerMeter = None
     self.scrubMeterBackground.detachNode()
     self.scrubMeterBackground = None
     self.scrubMeterBar.detachNode()
     self.scrubMeterBar = None
     self.scrubMeterFrame.detachNode()
     self.scrubMeterFrame = None
     del self.lastMousePos
     del self.currentBarnacles
     self.board.removeNode()
     del self.board
     self.brush.removeNode()
     del self.barnacles
 def reset(self):
     RepairMincroGame.reset(self)
     self.remainingWater = WATER_LEVEL_START
     self.chainCount = 0
     self.barDirection = UP
     self.goalIndex = TOP
     self.barPercent = 0.0
     self.failedPercentAndDirection = (-1.0, UP)
     actualZ = self.goalPositions[BOTTOM].getZ()
     actualZ -= self.visual.getZ()
     self.pumpLine.setZ(actualZ)
     self.setGoalIndex(TOP)
     self.pumpHandle.setR(ROTATION_MIN)
     self.waterMeter.setSz(WATER_LEVEL_START)
     self.waterTop.setZ(self.waterMeterTopLoc.getZ(self.visual))
     self.ghostLine.stash()
     self.setPumpWater(1.0)
     self.failLabel.stash()
     self.greatLabel.stash()
     self.repairGame.gui.setTutorial(self.name)
     self.repairGame.gui.setTitle(self.name)
 def _initVisuals(self):
     RepairMincroGame._initVisuals(self)
     self.model = loader.loadModel('models/gui/pir_m_gui_srp_careening_main')
     self.board = self.model.find('**/hull')
     self.board.reparentTo(self)
     self.board.setScale(1.0)
     self.board.setPos(-0.12, 0.0, 0.19)
     self.brush = self.model.find('**/brushCursor')
     self.brush.reparentTo(aspect2d)
     self.brush.stash()
     barnacleGeom = [
         self.model.find('**/barnacles/barnacle0'),
         self.model.find('**/barnacles/barnacle1'),
         self.model.find('**/barnacles/barnacle2')]
     self.barnacles = []
     for i in range(self.config.barnacleCountRange[1]):
         bGeom = barnacleGeom[random.randint(0, 1)].copyTo(NodePath('barnacle%i' % i))
         bGeom.setBin('fixed', 36)
         if random.random() < self.config.mossPercentage:
             mGeom = barnacleGeom[2].copyTo(NodePath('moss'))
             mGeom.reparentTo(bGeom)
             mGeom.setPos(random.uniform(0, self.config.mossPosVariance), 0.0, random.uniform(0, self.config.mossPosVariance))
             mGeom.setBin('fixed', 35)
         
         b = RepairBarnacle('barnacle%i' % i, bGeom)
         b.reparentTo(self)
         self.barnacles.append(b)
         b.stash()
     
     self.scrubPowerMeter = self.model.find('**/scrubMeter')
     self.scrubMeterBackground = self.model.find('**/scrubMeterBackground')
     self.scrubMeterBackground.setBin('fixed', 32)
     self.scrubMeterBar = self.model.find('**/scrubMeterBar')
     self.scrubMeterBar.setBin('fixed', 33)
     self.scrubMeterFrame = self.model.find('**/scrubMeterFrame')
     self.scrubMeterFrame.setBin('fixed', 34)
     self.scrubPowerMeter.reparentTo(self)
     self.scrubPowerMeter.setPos(0.68000000000000005, 0.0, 0.20000000000000001)
     self.scrubPowerMeter.setSz(1.25)
     self.pushLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Careening_Power, pos = (0.68000000000000005, 0.0, -0.27000000000000002), text_fg = (1.0, 1.0, 1.0, 1.0), text_shadow = (0.0, 0.0, 0.0, 1.0), text_font = PiratesGlobals.getPirateFont(), scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), parent = self, relief = None)
 def reset(self):
     RepairMincroGame.reset(self)
     self.aim = 1.0
     self.hammerSwinging = False
     self.circleDirection = GROW
     self.currentMin = 0.0
     self.circle.setScale(self.config.reticleScaleRange[1])
     spacing = 1.6000000000000001 / (self.nailCount + 2)
     self.currentNails = []
     i = 0
     for nail in self.nails:
         if i < self.nailCount:
             nail.setPos(-0.80000000000000004 + spacing * 1.5 + spacing * i, -2.0, 0.10000000000000001)
             nail.request('Active')
             nail.unstash()
             self.currentNails.append(nail)
         else:
             nail.request('Idle')
         i += 1
     
     self.repairGame.gui.setTutorial(self.name)
     self.repairGame.gui.setTitle(self.name)