Пример #1
0
    def set_talking(self):
        # If there is a voice line play it (first we stop it)
        if self.voice_line != -1:
            try:
                sfx = load_sadl(
                    f"data_lt2/stream/event/?/{str(self.voice_line).zfill(3)}_{self.current_pause}.SAD"
                )
            except FileNotFoundError:
                sfx = load_sadl(
                    f"data_lt2/stream/event/{str(self.voice_line).zfill(3)}_{self.current_pause}.SAD"
                )
            self.voice_player.start_sound(sfx, loops=False)

        if self.character_talking is not None:
            self.character_talking.set_talking()
Пример #2
0
    def progress_text(self):
        # Commands starting with & (event 10060) and @s
        if self.text_left_to_do.startswith("@p"):  # Pause
            self.current_pause += 1
            self.pause()
            self.text_left_to_do = self.text_left_to_do[2:]
            return
        elif self.text_left_to_do.startswith("\n\n"):  # Next page
            self.reset_texts()
            self.text_left_to_do = self.text_left_to_do[2:]
            return
        elif self.text_left_to_do.startswith("&"):
            command = ""
            self.text_left_to_do = self.text_left_to_do[1:]
            while not self.text_left_to_do.startswith("&") and len(
                    self.text_left_to_do) > 0:
                command += self.text_left_to_do[0]
                self.text_left_to_do = self.text_left_to_do[1:]
            self.text_left_to_do = self.text_left_to_do[1:]
            if self.character_talking is not None:
                self.event_player.execute_str_command(command)
            if self.finished:
                self.pause()
            return
        elif self.text_left_to_do.startswith("@s"):
            self.text_left_to_do = self.text_left_to_do[2:]
            if self.dialogue_sfx_id != -1:
                sadl = load_sadl(
                    f"data_lt2/stream/ST_{str(self.dialogue_sfx_id).zfill(3)}.SAD"
                )
                self.dialogue_sfx_player.start_sound(sadl)

        # Move one character from self.text_left_to_do to current_text
        self.current_text += self.text_left_to_do[:1]
        self.text_left_to_do = self.text_left_to_do[1:]

        # Update current text object
        self.inner_text.color = pg.Color(0, 0, 0)
        self.inner_text.text = self.current_text

        # If we have finished we pause
        if self.finished:
            self.pause()
Пример #3
0
 def play_sadl(self, path):
     sadl = load_sadl(path)
     self.sadl_player.start_sound(sadl, loops=False)