コード例 #1
0
 def pause(self, pauser):
     if self.gameState < self.STOPPED:
         wasPaused = self.isPaused
         self.__pauseTracker[pauser] = None #value is arbitrary
         if not wasPaused: #just paused
             self.__playPauseLerp()
             CToolbar.getClock().pause()
コード例 #2
0
 def resume(self, resumer):
     if self.gameState < self.STOPPED:
         if resumer in self.__pauseTracker:
             del self.__pauseTracker[resumer]
             if not self.isPaused: #just resumed
                 self.__playPauseLerp()
                 CToolbar.getClock().resume()
コード例 #3
0
 def instantiateField(self, dims, nMines):
     self.__minesToLay = nMines #lay mines after first click
     field = GuiField(self, dims, 0, self.__setFinalizeConstruct, ())
     
     #NodePath.__init__(self, "Funky Chicken")
     CToolbar.getMineCounter().setNumMines(nMines)
     return field
コード例 #4
0
 def onMouseClickCancelled(self, source, coords, button):
     if button == MouseDispatcher.LEFT_BUTTON:
         if source:
             source.unhighlight() #revert
     elif button == MouseDispatcher.RIGHT_BUTTON | \
                    MouseDispatcher.LEFT_BUTTON:
         self.disengageSweeper()
     if self.game.gameState < GuiGame.STOPPED:
         #make sure the game didn't end on last click
         CToolbar.getSmiley().setSmileTex()
コード例 #5
0
 def start(self, startCell):
     if self.gameState == self.IDLE:
         self.field.layMines(self.__minesToLay, (startCell,))
         self.__minesToLay = 0
         self.__winTgt = reduce(operator.mul, self.field.dims) - \
                     self.field.nMines
         if not self.isPaused:
             CToolbar.getClock().start()
         else:
         	CToolbar.getClock().reset()
         self.__gameState = self.PLAYING
コード例 #6
0
 def onMouseClickPrep(self, source, coords, button):
     messenger.send("hideChildren")
     if button == MouseDispatcher.LEFT_BUTTON:
         if source and (source.state == GuiCell.UNEXPLORED or
                        source.state == GuiCell.QUESTIONMARK):
             source.highlight()
             CToolbar.getSmiley().setOTex()
     elif button == MouseDispatcher.RIGHT_BUTTON | \
                    MouseDispatcher.LEFT_BUTTON:
         self.engageSweeper()
         CToolbar.getSmiley().setOTex()
コード例 #7
0
 def dispose(self):
     self.cTool = None
 	CToolbar.getClock().stop()
     if self.__cameraControl:
         self.disposeCameraControl()
     self.removeNode()
コード例 #8
0
 def stop(self):
     if self.gameState < self.STOPPED:
         CToolbar.getClock().pause()
         self.__gameState = self.STOPPED
コード例 #9
0
 def setFlags(self, value):
     self.__flags = value
     CToolbar.getMineCounter().setTextures(self.nMines - value)