comparison dialoguecontroller.py @ 0:7a89ea5404b1

Initial commit of parpg-core.
author M. George Hansen <technopolitica@gmail.com>
date Sat, 14 May 2011 01:12:35 -0700
parents
children 708a6f651c31
comparison
equal deleted inserted replaced
-1:000000000000 0:7a89ea5404b1
1 # This file is part of PARPG.
2
3 # PARPG is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
7
8 # PARPG is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with PARPG. If not, see <http://www.gnu.org/licenses/>.
15 from controllerbase import ControllerBase
16
17 class DialogueController(ControllerBase):
18 """Controller that takes over when a dialogue is started"""
19 def __init__(self,
20 engine,
21 view,
22 model,
23 application):
24 """
25 Constructor
26 @param engine: Instance of the active fife engine
27 @type engine: fife.Engine
28 @param view: Instance of a GameSceneView
29 @param type: parpg.GameSceneView
30 @param model: The model that has the current gamestate
31 @type model: parpg.GameModel
32 @param application: The application that created this controller
33 @type application: parpg.PARPGApplication
34 @param settings: The current settings of the application
35 @type settings: fife.extensions.fife_settings.Setting
36 """
37 super(DialogueController, self).__init__(engine,
38 view,
39 model,
40 application)
41 self.dialogue = None
42 self.view = view
43
44 def startTalk(self, npc):
45 if npc.dialogue is not None:
46 self.model.active_map.centerCameraOnPlayer()
47 npc.talk(self.model.game_state.player_character)
48 self.dialogue = self.view.hud.showDialogue(npc)
49 self.dialogue.initiateDialogue()
50 self.model.pause(True)
51 self.view.hud.enabled = False
52
53
54 def pump(self):
55 if self.dialogue and not self.dialogue.active:
56 self.application.popController()
57 self.model.pause(False)
58 self.view.hud.enabled = True
59