Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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