def run(self, debug=False):
try:
self.conn = self.__lirc_conn();
while True:
if self.active and self.__find_sync():
schedule = sched.scheduler(time.time, time.sleep)
for _, p in self.players.items():
if p.moving():
schedule.enter(Race.DELAY * p.nth, 1, self.__send, (p,))
schedule.run()
# Apply state changes as per requests from TCP server.
while not self.q.empty():
self.__handle_message(self.q.get(False))
if debug:
break
except KeyboardInterrupt:
logging.warn("Terminating Race")
finally:
if self.conn:
self.conn.close()
评论列表
文章目录