Ajout d'un locker de lancement de dialogue

This commit is contained in:
Yannis 2024-01-05 19:20:52 +01:00
parent 011c7f4895
commit 2a47bb5d60
Signed by: yannis
SSH key fingerprint: SHA256:Bz8K8QiTYUudf8MlthTM9MCLfgiYf/U1md3V9g9Wo14

View file

@ -7,6 +7,7 @@ class DialogsManager:
self.current_dialogs = []
self.current_dialog_id = -1
self.dialogs = {}
self.reading_dialog = False
def next_dialog(self):
"""Passe au dialogue suivant. Renvoie True si le dialogue est fini."""
@ -14,12 +15,18 @@ class DialogsManager:
if self.current_dialog_id == len(self.current_dialogs):
self.current_dialogs = []
self.current_dialog_id = -1
self.reading_dialog = False
def start_dialog(self, name: str):
"""Lance le dialogue au nom donné."""
if not self.reading_dialog:
self.current_dialogs = self.dialogs[name]
self.current_dialog_id = 0
print(self.current_dialogs)
self.reading_dialog = True
def get_current_dialog_sentence(self) -> str:
"""Renvoie la phrase actuelle du dialogue."""
return self.current_dialogs[self.current_dialog_id]