本文整理汇总了Python中gui.Gui.showMenu方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.showMenu方法的具体用法?Python Gui.showMenu怎么用?Python Gui.showMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Gui
的用法示例。
在下文中一共展示了Gui.showMenu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import showMenu [as 别名]
class Game(DirectObject):
def __init__(self, _main):
self.main = _main
## PHYSICS HANDLER ##
self.physics = Physics(self)
## LEVEL LOADER ##
self.currentLevelName = None
self.levelloader = LevelLoader(self)
self.currentLevelName = "startLevel2-extra"
## INPUT HANDLER
self.input = Input(self)
self.movementOption = '1'
## HANDLE PLAYER ##
self.isPlayerActive = False
self.player = {}
self.activePlayerName = "player2"
## Start GuI ##
self.gui = Gui(self)
self.accept("doStart", self.startGame)
## GAME STATE VARIABLES ##
self.isMoving = False
self.isFloating = False
def startGame(self):
self.gui.hideMenu()
self.levelloader.newLevel(self.currentLevelName)
self.createPlayer(self.activePlayerName)
self.gui.showGameGui()
self.levelloader.startCounter()
## HANDLE CAMERA ##
self.camera = Camera(self)
## START PHYSICS ##
self.physics.start()
def stopGame(self):
self.gui.hideGameGui()
for object in self.levelloader.levelObjects:
object.remove()
for stateCoin in self.levelloader.levelStateCoins.keys():
self.levelloader.levelStateCoins["exit"].exitModel.remove()
self.levelloader.levelStateCoins["exit"] = None
for coin in self.levelloader.levelCoins.keys():
self.levelloader.levelCoins[coin].coinModel.remove()
self.levelloader.levelCoins[coin] = None
for node in self.physics.World.getRigidBodies():
self.physics.World.removeRigidBody(node)
for node in self.physics.World.getGhosts():
self.physics.World.removeGhost(node)
#self.levelloader.level = None
self.levelloader.stopCounter()
self.player[self.activePlayerName].removePlayer()
self.player = None
self.camera.stopCamTask()
# Reset Cursor
winProps = WindowProperties()
winProps.setCursorHidden(False)
base.win.requestProperties(winProps)
self.camera = None
self.physics.stop()
self.gui.showMenu()
def createPlayer(self, name):
self.player = {}
self.player[name] = Player(self, name)