本文整理匯總了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()