1 class NotImplementedException(Exception): pass
4 '''The generic user interface.'''
5 class_name
= "Generic UI"
7 def ni(self
, function
= None):
8 '''Throws a "not implemented" exception. If function name is provided, it is included in the exception.'''
10 raise NotImplementedException(function
+ " is not implemented by " + self
.class_name
)
11 raise NotImplementedException("This function is not implemented by " + self
.class_name
)
14 '''Iself.nitializes the user interface.'''
18 '''Invokes the main control loop.'''
21 def map_mode(self
, map):
22 '''Puts the UI in map mode.'''
25 def shop_mode(self
, shop
):
26 '''Puts the UI in shop mode.'''
29 def battle_mode(self
, battle
):
30 '''Puts the UI in battle mode.'''
31 self
.ni('battle_mode')
33 def conversation_mode(self
, conversation
):
34 '''Puts the UI in conversation mode.'''
35 self
.ni('conversation_mode')
37 def hp_tick(self
, character
, amount
):
38 '''Reports a gain in health.'''
41 def mp_tick(self
, character
, amount
):
42 '''Reports a gain in mana.'''
45 def gained_ability_level(self
, character
, ability
):
46 '''Reports an ability level gain.'''
47 self
.ni('gained_ability_level')
49 def gained_level(self
, character
):
50 '''Reports a level gain.'''
51 self
.ni('gained_level')