Imported whole engine and moved pause() handling from event_handler
This commit is contained in:
parent
8cbe1a3727
commit
9e400598a3
|
@ -1,14 +1,13 @@
|
||||||
import json
|
import json
|
||||||
from types import FunctionType
|
from types import FunctionType
|
||||||
|
|
||||||
from src.engine.event_handler import EventHandler
|
from src.engine.engine import Engine
|
||||||
|
|
||||||
|
|
||||||
class DialogsManager:
|
class DialogsManager:
|
||||||
"""Classe qui gère la lecture des dialogues."""
|
"""Classe qui gère la lecture des dialogues."""
|
||||||
def __init__(self, event_handler: EventHandler):
|
def __init__(self, engine: 'Engine'):
|
||||||
self.event_handler = event_handler
|
self.engine = engine
|
||||||
|
|
||||||
self.current_dialogs = []
|
self.current_dialogs = []
|
||||||
self.current_dialog_id = -1
|
self.current_dialog_id = -1
|
||||||
self.dialogs = {}
|
self.dialogs = {}
|
||||||
|
@ -41,7 +40,8 @@ class DialogsManager:
|
||||||
self.current_dialog_id = -1
|
self.current_dialog_id = -1
|
||||||
self.writing_dialog = False
|
self.writing_dialog = False
|
||||||
self.reading_dialog = False
|
self.reading_dialog = False
|
||||||
self.event_handler.remove_button_area("next_dialog")
|
self.engine.entity_manager.resume()
|
||||||
|
self.engine.event_handler.remove_button_area("next_dialog")
|
||||||
if self.dialogue_finished_callback is not None:
|
if self.dialogue_finished_callback is not None:
|
||||||
self.dialogue_finished_callback()
|
self.dialogue_finished_callback()
|
||||||
|
|
||||||
|
@ -50,7 +50,9 @@ class DialogsManager:
|
||||||
|
|
||||||
# Si un dialogue n'est pas déja lancé, on lance le dialogue au nom donné
|
# Si un dialogue n'est pas déja lancé, on lance le dialogue au nom donné
|
||||||
if not self.reading_dialog:
|
if not self.reading_dialog:
|
||||||
self.event_handler.register_button_area((0, 0, 1, 1), self.next_signal, "next_dialog", 2)
|
self.engine.entity_manager.pause()
|
||||||
|
|
||||||
|
self.engine.event_handler.register_button_area((0, 0, 1, 1), self.next_signal, "next_dialog", 2)
|
||||||
|
|
||||||
self.current_dialogs = self.dialogs[name]
|
self.current_dialogs = self.dialogs[name]
|
||||||
self.current_dialog_id = 0
|
self.current_dialog_id = 0
|
||||||
|
|
Loading…
Reference in a new issue