source: branches/active/character_customization/game/scripts/charactercreationcontroller.py @ 734

Revision 734, 7.9 KB checked in by beliar, 8 years ago (diff)

Patch by Beliar

  • Added skeleton functions to charactercreationcontroller.py.

references[t:305]

Line 
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"""Provides the controller that defines the behavior of the character creation
16   screen."""
17from controllerbase import ControllerBase
18from gamescenecontroller import GameSceneController
19from gamesceneview import GameSceneView
20
21class CharacterCreationController(ControllerBase):
22    """Controller defining the behavior of the character creation screen."""
23    def __init__(self, engine, view, model, application):
24        """Construct a new L{CharacterCreationController} instance.
25           @param engine: Rendering engine used to display the associated view.
26           @type engine: L{fife.Engine}
27           @param view: View used to display the character creation screen.
28           @type view: L{ViewBase}
29           @param model: Model of the game state.
30           @type model: L{GameModel}
31           @param application: Application used to glue the various MVC
32               components together.
33           @type application:
34               L{fife.extensions.basicapplication.ApplicationBase}"""
35        ControllerBase.__init__(self, engine, view, model, application)
36        self.view.start_new_game_callback = self.startNewGame
37        self.view.cancel_new_game_callback = self.cancelNewGame
38        self.view.show()
39   
40    def startNewGame(self):
41        """Create the new character and start a new game.
42           @return: None"""
43        view = GameSceneView(self.engine, self.model)
44        controller = GameSceneController(self.engine, view, self.model,
45                                         self.application)
46        self.application.view = view
47        self.application.switchController(controller)
48        start_map = self.model.settings.get("PARPG", "Map")
49        self.model.changeMap(start_map)
50   
51    def cancelNewGame(self):
52        """Exit the character creation view and return the to main menu.
53           @return: None"""
54        # KLUDGE Technomage 2010-12-24: This is to prevent a circular import
55        #     but a better fix needs to be thought up.
56        from mainmenucontroller import MainMenuController
57        from mainmenuview import MainMenuView
58        view = MainMenuView(self.engine, self.model)
59        controller = MainMenuController(self.engine, view, self.model,
60                                        self.application)
61        self.application.view = view
62        self.application.switchController(controller)
63   
64    def onStop(self):
65        """Called when the controller is removed from the list.
66           @return: None"""
67        self.view.hide()
68
69    def increaseStatistic(self, statistic):
70        """Increases the given statistic by one.
71        @param statistic: Name of the statistic to increase
72        @type statistic: string""" 
73        #TODO: Add Code
74        pass
75   
76    def canIncreaseStatistic(self, statistic):
77        """Checks whether the given statistic can be increased or not
78        @param statistic: Name of the statistic to check
79        @type statistic: string
80        @return: True if the statistic can be increased, False if not."""
81        #TODO: Add Code
82        return False
83   
84    def decreaseStatistic(self, statistic):
85        """Decreases the given statistic by one.
86        @param statistic: Name of the statistic to decrease
87        @type statistic: string""" 
88        #TODO: Add Code
89        pass
90   
91    def canDecreaseStatistic(self, statistic):
92        """Checks whether the given statistic can be decreased or not
93        @param statistic: Name of the statistic to check
94        @type statistic: string
95        @return: True if the statistic can be decreased, False if not."""
96        #TODO: Add Code
97        return False
98
99    def setName(self, name):
100        """Sets the name of the character to the given value.
101        @param name: New name
102        @type name: string"""
103        #TODO: Add Code
104        pass
105   
106    def isNameValid(self, name):
107        """Checks whether the name is valid.
108        @param name: Name to check
109        @type name: string
110        @return: True if the name is valid, False if not"""
111        #TODO: Add Code
112        return False
113   
114    def changeOrigin(self, origin):
115        """Changes the origin of the character to the given value.
116        @param origin: New origin
117        @type origin: string?"""
118        #TODO: Add Code
119        pass 
120   
121    def isOriginValid(self, origin):
122        """Checks whether the origin is valid.
123        @param origin: Origin to check
124        @type origin: string?
125        @return: True if the origin is valid, False if not"""
126        #TODO: Add Code
127        return False
128   
129    def changeGender(self, gender):
130        """Changes the gender of the character to the given value.
131        @param gender: New gender
132        @param gender: string?"""
133        #TODO: Add Code
134        pass
135   
136    def isGenderValid(self, gender):
137        """Checks whether the gender is valid.
138        @param gender: Gender to check
139        @type gender: string?
140        @return: True if the origin is valid, False if not"""
141        #TODO: Add Code
142        return False
143   
144    def changeAge(self, age):
145        """Sets the age of the character to the given value.
146        @param age: New age
147        @type age: integer
148        """
149        #TODO: Add Code
150        pass
151   
152    def isAgeValid(self, age):
153        """Checks whether the age is valid.
154        @param age: Age to check
155        @type age: integer
156        @return: True if the origin is valid, False if not"""
157        #TODO: Add Code
158        return False
159   
160    def setPicture(self, picture):
161        """Set picture of the character.
162        @param picture: ID of the new picture
163        @type picture: string"""
164        pass
165   
166    def isPictureValid(self, picture):
167        """Checks whether the picture is valid.
168        @param picture: ID of the picture to check
169        @type picture: string
170        @return: True if the picture is valid, False if not"""
171        #TODO: Add Code
172        return False
173   
174    def addTrait(self, trait):
175        """Adds a trait to the character.
176        @param trait: ID of the trait to add
177        @type trait: string"""
178        #TODO: Add Code
179        pass
180   
181    def canAddAnotherTrait(self):
182        """Checks whether another trait can be added.
183        @return: True if another trait can be added, False if not"""
184        #TODO: Add Code
185        return False
186   
187    def removeTrait(self, trait):
188        """Remove trait from character.
189        @param trait: ID of the trait to remove
190        @type trait: string"""
191        #TODO: Add Code
192        pass
193   
194    def hasTrait(self, trait):
195        """Checks whether the character has the trait.
196        @param trait: ID of the trait to check
197        @type trait: string
198        @return: True if the character has the trait, False if not"""
199        #TODO: Add Code
200        return False
201   
202    def isTraitValid(self, trait):
203        """Checks whether the trait is valid.
204        @param trait: ID of the trait to check
205        @type trait: string
206        @return: True if the trait is valid, False if not"""
207        #TODO: Add Code
208        return False
209   
210    def areCurrentTraitsValid(self):
211        """Checks whether the characters traits are valid.
212        @return: True if the traits are valid, False if not"""
213        #TODO: Add Code
214        return False
215   
216    def isCharacterValid(self):
217        """Checks whether the character as a whole is valid."""
218        #TODO: Add code
219        return False
Note: See TracBrowser for help on using the repository browser.