本文整理汇总了Python中rules.Rules.clickListener方法的典型用法代码示例。如果您正苦于以下问题:Python Rules.clickListener方法的具体用法?Python Rules.clickListener怎么用?Python Rules.clickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rules.Rules
的用法示例。
在下文中一共展示了Rules.clickListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Main
# 需要导入模块: from rules import Rules [as 别名]
# 或者: from rules.Rules import clickListener [as 别名]
#.........这里部分代码省略.........
self.state = STATE.game
def startedNewGame(self, level):
print "open room", level
self.gameNet.openRoom(level)
def leaveServer(self, gameID):
self.gameNet.leaveServer(self.gameID)
self.state = STATE.menu
def backToMenu(self):
self.initContext()
self.state = STATE.menu
def addScore(self):
self.game.addScore()
def enemyAddScore(self):
self.game.enemyAddScore()
def getRooms(self, matching, page, num):
self.gameNet.getRooms(matching, page, num)
def update(self):
self.clock.tick(60)
self.screen.fill(0)
self.gameNet.pump()
if STATE.exit == self.state:
exit()
elif STATE.setLevel == self.state:
var = self.setLevel.draw(self.screen)
if (var in STATE):
self.state = var
else:
self.startedNewGame(var)
self.enterGame(var)
elif STATE.game == self.state:
self.state = self.game.draw()
if (self.state != STATE.game):
self.initContext()
elif STATE.matching == self.state:
self.state = self.matching.draw(self.screen)
elif STATE.menu == self.state:
self.menu.draw(self.screen)
self.state = self.menu.clickListener()
elif STATE.rules == self.state:
self.rules.draw(self.screen)
self.state = self.rules.clickListener()
elif STATE.finish == self.state:
var = self.finish.draw(self.screen)
if (var != STATE.finish):
self.backToMenu()
for event in pygame.event.get():
if (event.type == pygame.QUIT):
if STATE.game == self.state:
self.gameNet.exitFlag = True
self.gameNet.leaveServer(self.game.gameID)
sleep(0.5)
pygame.quit()
exit()
else:
pygame.quit()
exit()
# exit()
# if (event.type == pygame.KEYDOWN):
# if (event.key == pygame.K_ESCAPE):
# exit()
# pygame.quit()
pygame.display.flip()
def winning(self):
self.finish.setWin(self.game.gameID)
self.enterFinish()
def lost(self):
self.finish.setLost(self.game.gameID)
self.enterFinish()
def drawGame(self):
self.finish.setDraw(self.game.gameID)
self.enterFinish()
def enterFinish(self):
self.state = STATE.finish
def run(self):
while self.running:
self.update()
def exit(self):
pygame.quit()
exit()