1 # This file is part of Realism, which is Copyright FunnyMan3595 (Charlie Nolan)
2 # and licensed under the GNU GPL v3. For more details, see LICENSE in the main
5 '''Holds the generic user interface, UI.'''
7 class NotImplementedException(Exception): pass
10 '''The generic user interface.'''
11 class_name
= "Generic UI"
13 def ni(self
, function
= None):
14 '''Throws a "not implemented" exception. If function name is provided, it is included in the exception.'''
16 raise NotImplementedException(function
+ " is not implemented by " + self
.class_name
)
17 raise NotImplementedException("This function is not implemented by " + self
.class_name
)
20 '''Initializes the user interface.'''
24 '''Invokes the main control loop.'''
27 def map_mode(self
, map):
28 '''Puts the UI in map mode.'''
31 def shop_mode(self
, shop
):
32 '''Puts the UI in shop mode.'''
35 def battle_mode(self
, battle
):
36 '''Puts the UI in battle mode.'''
37 self
.ni('battle_mode')
39 def conversation_mode(self
, conversation
):
40 '''Puts the UI in conversation mode.'''
41 self
.ni('conversation_mode')
43 def hp_tick(self
, character
, amount
):
44 '''Reports a gain in health.'''
47 def mp_tick(self
, character
, amount
):
48 '''Reports a gain in mana.'''
51 def gained_ability_level(self
, character
, ability
):
52 '''Reports an ability level gain.'''
53 self
.ni('gained_ability_level')
55 def gained_level(self
, character
):
56 '''Reports a level gain.'''
57 self
.ni('gained_level')
60 '''Returns the UI to the map after winning a battle.'''