本文整理汇总了Python中Menu.destroyAllMenus方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.destroyAllMenus方法的具体用法?Python Menu.destroyAllMenus怎么用?Python Menu.destroyAllMenus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.destroyAllMenus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ControlHandler
# 需要导入模块: import Menu [as 别名]
# 或者: from Menu import destroyAllMenus [as 别名]
class ControlHandler():
fsmState = True
def __init__(self, update, bulletDebugNode, camera, windowProps, player, timerTask, bulletWorld, collisions, music):
#args
self.update = update
self.debugNP = bulletDebugNode
self.camera = camera
self.music = music
#self.cameraTask = camera.thisTask - ill need some camera shit later prolly
self.wp = windowProps
self.player = player
#self.level = level
self.timerTask = timerTask
self.world = bulletWorld
self.collisions = collisions
self.filters = Filters()
self.frustumIsEnabled = False
self.parseControlFile()
self.createControls()
self.singleSM(self.pauseGame, self.resumeGame)
base.messenger.send("1")
def parseControlFile(self):
self.f = open("./controls/ControlsFileConfig.txt")
self.lines = self.f.readlines()
self.f.close()
#validLetters = "abcdefghijklmnopqrstuvwxyz"
#for x in range(len(self.lines)):
# for char in self.lines[x]:
# for char in validLetters:
# self.lines[x] += char
#gotta figure out how aND WHY THE NEWLINES ARENT GOIGN AWAY!
print(self.lines)
for x in range(len(self.lines)):
if self.lines[x].strip() == "forward":
self.forward = str(self.lines[x + 1].rstrip("\n"))
if self.lines[x].strip() == "reverse":
self.reverse = str(self.lines[x + 1].rstrip("\n"))
if self.lines[x].strip() == "left":
self.left = str(self.lines[x + 1].rstrip("\n"))
if self.lines[x].strip() == "right":
self.right = str(self.lines[x + 1].rstrip("\n"))
def singleSM(self, onFunction, offFunction):
'''"Single State Machine"
Takes two methods as args, runs onFunction
when self.fsmState = False(Default state),
runs offFunction when self.fsmState = True'''
if self.fsmState:
self.fsmState = False
offFunction()
else:
self.fsmState = True
onFunction()
def escMenu(self):
'''Runs functions when escape is pressed'''
self.singleSM(self.pauseGame, self.resumeGame)
def pauseGame(self):
'''Pauses the game by removing any taskmgr'''
self.wp.setCursorHidden(False)
base.win.requestProperties(self.wp)
mat = Mat4(camera.getMat())
mat.invertInPlace()
base.mouseInterfaceNode.setMat(mat)
base.enableMouse()
self.menu = Menu(self.escMenu, self.wp, self.collisions)
taskMgr.remove('update')
taskMgr.remove('timerTask')
self.menu.loadPauseMenu()
def resumeGame(self):
self.wp.setCursorHidden(True)
base.win.requestProperties(self.wp)
try:
self.menu.destroyAllMenus("meh")
except AttributeError:
print("Nothing to destroy!")
taskMgr.add(self.update, 'update')
taskMgr.add(self.timerTask, 'timerTask')
base.disableMouse()
def debugBullet(self):
if self.debugNP.isHidden():
self.debugNP.show()
#.........这里部分代码省略.........