annotate demos/rpg/scripts/guicontroller.py @ 697:ecaa4d98f05f tip

Abstracted the GUI code and refactored the GUIChan-specific code into its own module. * Most of the GUIChan code has been refactored into its own gui/guichan module. However, references to the GuiFont class still persist in the Engine and GuiManager code and these will need further refactoring. * GuiManager is now an abstract base class which specific implementations (e.g. GUIChan) should subclass. * The GUIChan GUI code is now a concrete implementation of GuiManager, most of which is in the new GuiChanGuiManager class. * The GUI code in the Console class has been refactored out of the Console and into the GUIChan module as its own GuiChanConsoleWidget class. The rest of the Console class related to executing commands was left largely unchanged. * Existing client code may need to downcast the GuiManager pointer received from FIFE::Engine::getGuiManager() to GuiChanGuiManager, since not all functionality is represented in the GuiManager abstract base class. Python client code can use the new GuiChanGuiManager.castTo static method for this purpose.
author M. George Hansen <technopolitica@gmail.com>
date Sat, 18 Jun 2011 00:28:40 -1000
parents 69d50e751c9a
children
rev   line source
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 #!/usr/bin/env python
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
2
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
3 # -*- coding: utf-8 -*-
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5 # ####################################################################
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
6 # Copyright (C) 2005-2010 by the FIFE team
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
7 # http://www.fifengine.net
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
8 # This file is part of FIFE.
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
9 #
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 # FIFE is free software; you can redistribute it and/or
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
11 # modify it under the terms of the GNU Lesser General Public
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 # License as published by the Free Software Foundation; either
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
13 # version 2.1 of the License, or (at your option) any later version.
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
14 #
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15 # This library is distributed in the hope that it will be useful,
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 # Lesser General Public License for more details.
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
19 #
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 # You should have received a copy of the GNU Lesser General Public
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21 # License along with this library; if not, write to the
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22 # Free Software Foundation, Inc.,
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24 # ####################################################################
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26 import sys, os, re, math, random, shutil
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
27
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28 from fife import fife
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29 from fife.extensions import pychan
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 from fife.extensions.pychan import widgets
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
31
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
32 class Window(object):
512
6ddb1eb9dfa6 Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 511
diff changeset
33 def __init__(self, gamecontroller):
6ddb1eb9dfa6 Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 511
diff changeset
34 self._guicontroller = gamecontroller.guicontroller
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
35 self._gamecontroller = gamecontroller
512
6ddb1eb9dfa6 Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 511
diff changeset
36 self._settings = gamecontroller.settings
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
37
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
38 self._widget = None
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
39
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
40 def _getWidget(self):
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
41 return self._widget
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
42
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
43 widget = property(_getWidget)
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
44
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
45 class MainMenu(Window):
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
46 def __init__(self, gamecontroller):
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
47 super(MainMenu, self).__init__(gamecontroller)
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
48 self._widget = pychan.loadXML('gui/mainmenu.xml')
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
49
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
50 self._newgame = self._widget.findChild(name="new_game")
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
51 self._credits = self._widget.findChild(name="credits")
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
52 self._quit = self._widget.findChild(name="quit")
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
53
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
54 self._widget.position = (0,0)
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
55
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
56 eventMap = {
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
57 'new_game': self._gamecontroller.newGame,
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
58 'settings': self._settings.onOptionsPress,
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
59 'credits': self._guicontroller.showCredits,
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
60 'quit': self._gamecontroller.quit,
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
61 }
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
62
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
63 self._widget.mapEvents(eventMap)
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
64
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
65 class Credits(Window):
544
c9bdf145069f credits screen now comes up properly when you click on the credits button.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 536
diff changeset
66 def __init__(self, gamecontroller):
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
67 super(Credits, self).__init__(gamecontroller)
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
68 self._widget = pychan.loadXML('gui/credits.xml')
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
69
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
70 eventMap = {
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
71 'close': self._guicontroller.hideCredits,
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
72 }
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
73
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
74 self._widget.mapEvents(eventMap)
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
75
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
76 class QuestDialog(Window):
521
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
77 def __init__(self, guicontroller, questgiver):
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
78 super(QuestDialog, self).__init__(guicontroller)
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
79 self._widget = pychan.loadXML('gui/quest.xml')
521
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
80 self._questgiver = questgiver
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
81 self._quest = questgiver.getNextQuest()
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
82
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
83 self._questname = self._widget.findChild(name="questname")
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
84 self._questname.text = unicode(self._quest.name)
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
85
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
86 self._questtext = self._widget.findChild(name="questtext")
521
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
87 self._questtext.text = unicode(self._quest.text)
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
88
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
89 eventMap = {
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
90 'accept': self.questAccepted,
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
91 'decline': self._widget.hide,
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
92 }
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
93
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
94 self._widget.mapEvents(eventMap)
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
95
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
96 def questAccepted(self):
536
1afe46247ab1 Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 521
diff changeset
97 self._guicontroller._gamecontroller.logger.log_debug("Quest [" + self._quest.name + "] has been accepted")
521
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
98 self._questgiver.activateQuest(self._quest)
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
99 self._widget.hide()
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
100
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
101 class GUIController(object):
512
6ddb1eb9dfa6 Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 511
diff changeset
102 def __init__(self, gamecontroller):
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
103 self._gamecontroller = gamecontroller
512
6ddb1eb9dfa6 Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 511
diff changeset
104 self._engine = gamecontroller.engine
6ddb1eb9dfa6 Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 511
diff changeset
105 self._settings = gamecontroller.settings
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
106
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
107 self._mainmenu = None
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
108 self._credits = None
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
109
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
110 def showMainMenu(self):
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
111 if self._mainmenu:
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
112 self._mainmenu.widget.show()
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
113 else:
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
114 #load and show the main menu
512
6ddb1eb9dfa6 Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 511
diff changeset
115 self._mainmenu = MainMenu(self._gamecontroller)
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
116 self._mainmenu.widget.show()
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
117
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
118 def hideMainMenu(self):
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
119 if self._mainmenu:
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
120 self._mainmenu.widget.hide()
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
121 self._mainmenu = None
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
122
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
123 def showCredits(self):
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
124 if self._credits:
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
125 self._credits.widget.show()
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
126 else:
544
c9bdf145069f credits screen now comes up properly when you click on the credits button.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 536
diff changeset
127 self._credits = Credits(self._gamecontroller)
511
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
128 self._credits.widget.show()
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
129
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
130 def hideCredits(self):
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
131 if self._credits:
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
132 self._credits.widget.hide()
773dc1dbe69d Forgot to add guicontroller.py in my last commit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
133 self._credits = None
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
134
521
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
135 def showQuestDialog(self, questgiver):
494c60cf61cf Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 520
diff changeset
136 questdlg = QuestDialog(self._gamecontroller, questgiver)
520
b6bd314df28a Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 512
diff changeset
137 questdlg.widget.show()