本文整理汇总了Python中game_state.GameState.interrupt_handler方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.interrupt_handler方法的具体用法?Python GameState.interrupt_handler怎么用?Python GameState.interrupt_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game_state.GameState
的用法示例。
在下文中一共展示了GameState.interrupt_handler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from game_state import GameState [as 别名]
# 或者: from game_state.GameState import interrupt_handler [as 别名]
class Game:
def __init__(self, slack_client):
self.slack_client = slack_client
self.game_state = GameState(slack_client)
self.invalid_handler = InvalidHandler(self.game_state)
def process(self, data):
# TODO: quit handler
try:
is_invalid = self.invalid_handler.is_invalid(data)
if is_invalid and not isinstance(self.game_state.handler, InvalidHandler):
self.game_state.interrupt_handler(self.invalid_handler)
self.invalid_handler.request_invalid_confirmation(data['user'])
else:
if self.game_state.handler:
self.game_state.handler.process(data)
except GameEndException:
self.__init__(self.slack_client)
def tick(self):
try:
if self.game_state.handler:
self.game_state.handler.tick()
except GameEndException:
self.__init__(self.slack_client)