def __init__(self, message, backtrace=None): Dialog.__init__(self) self.width = 16 / 9 * 2 self.height = 2.0 self.message = message self.backtrace = backtrace self.splitted = self.backtrace.split("\n") if not self.splitted[-1]: self.splitted = self.splitted[:-1] self.background_color = (0.0, 0.0, 0.0, 1.0) liberation_mono_bold = resources.resource_filename( "LiberationMono-Regular.ttf") self.detail_font = pygame.font.Font( liberation_mono_bold, int(0.021 * Render.get().display_height)) self.guru_font = pygame.font.Font( liberation_mono_bold, int(0.03 * Render.get().display_height)) self.start_time = time.time()
def update_state(self): if self.state == STATE_STARTING: self.gc_runner = GameCenterRunner(controller=self.controller) # prepare will unpack the game and prepare game files self.gc_runner.prepare() self.state = STATE_PREPARING self.throbber.throbber_start_time = 0 elif self.state == STATE_PREPARING: if self.gc_runner.error: pass elif self.gc_runner.done: self.wait_run_time = State.get().time FadeDialog(self.wait_run_time).show() self.state = STATE_WAITRUN elif self.state == STATE_WAITRUN: if State.get().time - self.wait_run_time > FADE_TIME: set_ingame_status() self.gc_runner.run() self.state = STATE_RUNNING elif self.state == STATE_RUNNING: InputHandler.set_inhibited(True) if self.gc_runner.error: pass elif self.gc_runner.done: self.state = STATE_STOPPING elif self.state == STATE_STOPPING: InputHandler.set_inhibited(False) State.get().history.pop() State.get().history.pop() State.get().history.pop() set_current_menu(State.get().history[-1]) back_to_menu_from_game() Dialog.get_current().close() from arcade.glui.window import main_window main_window.restore_window_if_necessary() elif self.state == STATE_ABORTING: pass