def __init__(self, mainScreen, num_player=None): self.current_lock = 0 self._listen_to_input = True self.crew_list = list() self.main_screen = mainScreen self.max_lock = num_player if num_player is not None else self.main_screen.gameEngine.params( "default_num_player") # done after since it needs crew_list Screen.__init__(self, mainScreen, image_name="crew_lock", entry_gimp_pos=(375, 357), entry_size=0, max_char=6) self.name = "lock_screen" self.wait_logo = LoadIcon(self.main_screen) # tell the game that the screen is locked self.main_screen.gameEngine.update_soft_state('crew_screen_unlocked', False) self.add_on_screen_text( 97, 352, text="test", size=2, name="crew", may_change=True, ) self.set_screen() self._update() self._update()
def __init__(self, mainScreen): Screen.__init__(self, mainScreen, "coordinates_lock", entry_gimp_pos=(275, 305), entry_size=0.5, max_char=12) # getting the base name self.target_name = list(self.passwords)[0] self.name = "target_screen" self._listen_to_input = True self._current_target = None self.wait_logo = LoadIcon(self.main_screen) # tell the game that the screen is locked self.main_screen.gameEngine.update_soft_state('target_screen_unlocked', False) self.add_on_screen_text(250, 250, text="Longitude (N) de la base " + self.target_name, size=1, may_change=True, name="text") self.add_on_screen_text(450, 310, text="", size=2, name="target") self.hide_on_screen_texts("target") # do it twice to secure self._update()
def __init__(self, mainScreen, image_name): self._listen_to_input = False self.main_screen = mainScreen Screen.__init__(self, mainScreen, image_name=image_name, ) self.texts = [] self._update()
def _update(self): # take correction into account self.lock_text["text"] = self.lock_text["text"].replace(" ", "") text = "" for i, a in enumerate(self.lock_text["text"]): text += a if i in [1, 3]: text += " " self.lock_text["text"] = text Screen._update(self)
def __init__(self, mainScreen): self.current_task = 0 self.task_list = list() Screen.__init__(self, mainScreen, "alert", entry_gimp_pos=(508, 430), entry_size=0.3) self.name = "alert_screen" self._listen_to_input = False # tell the game that the screen is locked self.main_screen.gameEngine.update_soft_state('alert_screen_unlocked', False) self.add_on_screen_text(319, 440, name="task", may_change=True, size=0, text="") self.hide_on_screen_texts() self.main_screen.gameEngine.sound_manager.play( "alarm", loop=True, volume=self.main_screen.gameEngine.params("alarm_volume")) self.wait_logo = LoadIcon(mainScreen, x=0.3, y=-0.38) self.wait_logo.start() self._update() # showing the unlock screen in a few secs. def task(t): self._listen_to_input = True self.wait_logo.stop() self.main_screen.set_background_image("alert_lock") self.set_screen() self.main_screen.gameEngine.sound_manager.play("voice_mdp") self.main_screen.info_text( "Entrer le mot de passe inscrit sur la valve O2-5 qui se trouve dans la navette" ) self._update() self.main_screen.gameEngine.taskMgr.doMethodLater( 2, self.main_screen.gameEngine.sound_manager.play, "as1", extraArgs=['voice_alert']) self.main_screen.gameEngine.taskMgr.doMethodLater(10.0, task, "as2")
def __init__(self, mainScreen): Screen.__init__(self, mainScreen, "screen") self.name = "unlocked_screen" self.gauges = dict() self.gauges["main_O2"] = Gauge(self.main_screen, name="main_O2", x=775, low_value=70) self.gauges["main_CO2"] = Gauge(self.main_screen, name="main_CO2", x=844, low_value=30, high_value=70) self.gauges["main_power"] = Gauge(self.main_screen, name="main_power", x=912, low_value=0, min=-100, max=100) self.gauges["main_power"].half_sec_step_for_goto = 2.0 for counter, g in enumerate(self.gauges): self.gauges[g].show() self.lock_text.hide() # list of software variables that appear in the defautl screen, in the state list self.global_variables = [ 'batterie1', 'batterie2', 'batterie3', 'batterie4', 'offset_ps_x', 'offset_ps_y', 'recyclage_O2', 'recyclage_CO2', 'recyclage_H2O', 'tension_secteur1', 'oxygene_secteur1', 'thermique_secteur1', 'tension_secteur2', 'oxygene_secteur2', 'thermique_secteur2', 'tension_secteur3', 'oxygene_secteur3', 'thermique_secteur3', 'target_name' ] for i, gb in enumerate(self.global_variables): self.add_on_screen_text(269, 109 + i * 24, size=0, text="", name=gb, may_change=True) # to be modified self.add_on_screen_text(427, 100, size=2, text="", name="freq_comm", may_change=True) self.add_on_screen_text(417, 243, size=3, text="ON", color='green', name="pilote_automatique", may_change=True) self.add_on_screen_text(440, 542, size=2, text="", name="sp_power", may_change=True) self.add_on_screen_text(518, 383, size=0, text="actif", name="moteur1", may_change=True, color="green") self.add_on_screen_text(518, 410, size=0, text="actif", name="moteur2", may_change=True, color="green") self.add_on_screen_text(518, 437, size=0, text="actif", name="moteur3", may_change=True, color="green") self.add_on_screen_text(617, 229, size=0, text="on", name="correction_roulis", may_change=True, color="green") self.add_on_screen_text(617, 249, size=0, text="on", name="correction_direction", may_change=True, color="green") self.add_on_screen_text(617, 269, size=0, text="on", name="correction_stabilisation", may_change=True, color="green") self.set_all_elements()
def destroy(self): for g in self.gauges: self.gauges[g].destroy() Screen.destroy(self)