Mercurial > parpg-core
comparison src/parpg/gui/dialoguegui.py @ 86:2e307c4f78e3
DialogueGUI now acceps met_fnc and meet_fnc in its constructor and stores them in its game_state as "met" and "meet" respectively.
author | KarstenBock@gmx.net |
---|---|
date | Fri, 09 Sep 2011 16:12:46 +0200 |
parents | c25c734bd2a7 |
children | 5feab6555bf9 |
comparison
equal
deleted
inserted
replaced
85:cd12294d1981 | 86:2e307c4f78e3 |
---|---|
25 | 25 |
26 class DialogueGUI(object): | 26 class DialogueGUI(object): |
27 """Window that handles the dialogues.""" | 27 """Window that handles the dialogues.""" |
28 _logger = logging.getLogger('dialoguegui.DialogueGUI') | 28 _logger = logging.getLogger('dialoguegui.DialogueGUI') |
29 | 29 |
30 def __init__(self, controller, npc, quest_engine, player_character): | 30 def __init__(self, controller, npc, quest_engine, met_fnc, meet_fnc, player_character): |
31 self.active = False | 31 self.active = False |
32 self.controller = controller | 32 self.controller = controller |
33 xml_file = vfs.VFS.open('gui/dialogue.xml') | 33 xml_file = vfs.VFS.open('gui/dialogue.xml') |
34 self.dialogue_gui = pychan.loadXML(xml_file) | 34 self.dialogue_gui = pychan.loadXML(xml_file) |
35 self.npc = npc | 35 self.npc = npc |
36 # TODO Technomage 2010-11-10: the QuestEngine should probably be | 36 # TODO Technomage 2010-11-10: the QuestEngine should probably be |
37 # a singleton-like object, which would avoid all of this instance | 37 # a singleton-like object, which would avoid all of this instance |
38 # handling. | 38 # handling. |
39 self.quest_engine = quest_engine | 39 self.quest_engine = quest_engine |
40 self.player_character = player_character | 40 self.player_character = player_character |
41 self.met_fnc = met_fnc | |
42 self.meet_fnc = meet_fnc | |
41 | 43 |
42 def initiateDialogue(self): | 44 def initiateDialogue(self): |
43 """Callback for starting a quest""" | 45 """Callback for starting a quest""" |
44 self.active = True | 46 self.active = True |
45 stats_label = self.dialogue_gui.findChild(name='stats_label') | 47 stats_label = self.dialogue_gui.findChild(name='stats_label') |
51 self.dialogue_gui.show() | 53 self.dialogue_gui.show() |
52 self.setNpcName(self.npc.description.view_name) | 54 self.setNpcName(self.npc.description.view_name) |
53 self.setAvatarImage(self.npc.dialogue.dialogue.avatar_path) | 55 self.setAvatarImage(self.npc.dialogue.dialogue.avatar_path) |
54 | 56 |
55 game_state = {'npc': self.npc, 'pc': self.player_character, | 57 game_state = {'npc': self.npc, 'pc': self.player_character, |
56 'quest': self.quest_engine} | 58 'quest': self.quest_engine, 'met': self.met_fnc, 'meet': self.meet_fnc} |
57 try: | 59 try: |
58 self.dialogue_processor = DialogueProcessor(self.npc.dialogue.dialogue, | 60 self.dialogue_processor = DialogueProcessor(self.npc.dialogue.dialogue, |
59 game_state) | 61 game_state) |
60 self.dialogue_processor.initiateDialogue() | 62 self.dialogue_processor.initiateDialogue() |
61 except (TypeError) as error: | 63 except (TypeError) as error: |