def _confirm_choice(self): if self._choice_exists() and self.choices[self.choice_index]: voice.confirmation(self.choices[self.choice_index][0][:1]) # repeat only the first part of the choice (not the help) self.choice_done = True else: debug("couldn't confirm choice (choices=%s, choice_index=%s)", self.choices, self.choice_index)
def _confirm_choice(self): psounds.play_stereo(sounds.get_sound(6116)) if self._choice_exists() and self.choices[self.choice_index]: voice.confirmation( self.choices[self.choice_index][0][:1] ) # repeat only the first part of the choice (not the help) self.choice_done = True
def _confirm_choice(self): if self._choice_exists() and self.choices[self.choice_index]: voice.confirmation( self.choices[self.choice_index][0][:1] ) # repeat only the first part of the choice (not the help) self.choice_done = True else: debug("couldn't confirm choice (choices=%s, choice_index=%s)", self.choices, self.choice_index)
def run(self, speed=config.speed): if self.record_replay: self.create_replay() self.world = World( self.default_triggers, self.seed, must_apply_equivalent_type=self.must_apply_equivalent_type) if self.world.load_and_build_map(self.map): self.map.load_style(res) try: self.map.load_resources() update_orders_list() # when style has changed self.pre_run() if self.world.objective: voice.confirmation(mp.OBJECTIVE + self.world.objective) self.interface = clientgame.GameInterface(self.me, speed=speed) b = res.get_text_file("ui/bindings", append=True, localize=True) b += "\n" + self.map.get_campaign("ui/bindings.txt") b += "\n" + self.map.get_additional("ui/bindings.txt") try: b += "\n" + open(CUSTOM_BINDINGS_PATH, "U").read() except IOError: pass self.interface.load_bindings(b) self.world.populate_map(self.players) self.nb_human_players = self.world.current_nb_human_players() t = threading.Thread(target=self.world.loop) t.daemon = True t.start() if PROFILE: import cProfile cProfile.runctx("self.interface.loop()", globals(), locals(), "interface_profile.tmp") import pstats for n in ("interface_profile.tmp", ): p = pstats.Stats(n) p.strip_dirs() p.sort_stats('time', 'cumulative').print_stats(30) p.print_callers(30) p.print_callees(20) p.sort_stats('cumulative').print_stats(50) else: self.interface.loop() self._record_stats(self.world) self.post_run() finally: self.map.unload_resources() self.world.stop() else: voice.alert(mp.BEEP + [self.world.map_error]) if self.record_replay: self._replay_file.close()
def run(self, speed=config.speed): if self.record_replay: self.create_replay() self.world = World(self.default_triggers, self.seed, must_apply_equivalent_type=self.must_apply_equivalent_type) if self.world.load_and_build_map(self.map): self.map.load_style(res) try: self.map.load_resources() update_orders_list() # when style has changed self.pre_run() if self.world.objective: voice.confirmation(mp.OBJECTIVE + self.world.objective) self.interface = clientgame.GameInterface(self.me, speed=speed) b = res.get_text_file("ui/bindings", append=True, localize=True) b += "\n" + self.map.get_campaign("ui/bindings.txt") b += "\n" + self.map.get_additional("ui/bindings.txt") try: b += "\n" + open(CUSTOM_BINDINGS_PATH, "U").read() except IOError: pass self.interface.load_bindings(b) self.world.populate_map(self.players) self.nb_human_players = self.world.current_nb_human_players() t = threading.Thread(target=self.world.loop) t.daemon = True t.start() if PROFILE: import cProfile cProfile.runctx("self.interface.loop()", globals(), locals(), "interface_profile.tmp") import pstats for n in ("interface_profile.tmp", ): p = pstats.Stats(n) p.strip_dirs() p.sort_stats('time', 'cumulative').print_stats(30) p.print_callers(30) p.print_callees(20) p.sort_stats('cumulative').print_stats(50) else: self.interface.loop() self._record_stats(self.world) self.post_run() finally: self.map.unload_resources() self.world.stop() else: voice.alert(mp.BEEP + [self.world.map_error]) if self.record_replay: self._replay_file.close()
def _confirm_choice(self): psounds.play_stereo(sounds.get_sound(CONFIRM_SOUND)) if self._choice_exists() and self.choices[self.choice_index]: voice.confirmation(self.choices[self.choice_index][0]) self.choice_done = True
def _confirm_choice(self): psounds.play_stereo(sounds.get_sound(6116)) if self._choice_exists() and self.choices[self.choice_index]: voice.confirmation(self.choices[self.choice_index][0][:1]) # repeat only the first part of the choice (not the help) self.choice_done = True