Mercurial > traipse_dev
comparison orpg/orpgCore.py @ 66:c54768cffbd4 ornery-dev
Traipse Dev 'OpenRPG' {090818-00}
Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc''s main goal is to offer more advanced features and enhance the productivity of the user.
Update Summary:
*Unstable*
This is the first wave of Code Refinement updates. Includes new material from Core Beta; new debugger material (partially implemented), beginnings of switch to etree, TerminalWriter, and a little more. open_rpg has been renamed to component; functioning now as component.get(), component.add(), component.delete(). This version has known bugs, specifically with the gametree and nodes. I think the XML files where not removed during testing of Core and switching back.
author | sirebral |
---|---|
date | Tue, 18 Aug 2009 06:33:37 -0500 |
parents | 73d9286c22cf |
children | b84e0799fed2 68c7bd272f27 |
comparison
equal
deleted
inserted
replaced
65:4840657c23c5 | 66:c54768cffbd4 |
---|---|
58 ######################## | 58 ######################## |
59 | 59 |
60 class ORPGStorage(object): | 60 class ORPGStorage(object): |
61 __components = {} | 61 __components = {} |
62 | 62 |
63 def add_component(self, key, com): | 63 def add(self, key, com): |
64 self.__components[key] = com | 64 self.__components[key] = com |
65 | 65 |
66 def get_component(self, key): | 66 def get(self, key): |
67 if self.__components.has_key(key): | 67 if self.__components.has_key(key): return self.__components[key] |
68 return self.__components[key] | 68 else: return None |
69 else: | |
70 return None | |
71 | 69 |
72 def del_component(self, key): | 70 def delete(self, key): |
73 if self.__components.has_key(key): | 71 if self.__components.has_key(key): del self.__components[key] |
74 del self.__components[key] | 72 else: return |
75 else: | |
76 return | |
77 | 73 |
78 def singleton(cls): | 74 def singleton(cls): |
79 instances = {} | 75 instances = {} |
80 def getinstance(): | 76 def getinstance(): |
81 if cls not in instances: | 77 if cls not in instances: |
82 instances[cls] = cls() | 78 instances[cls] = cls() |
83 return instances[cls] | 79 return instances[cls] |
84 return getinstance | 80 return getinstance |
85 | 81 |
86 ORPGStorage = singleton(ORPGStorage) | 82 ORPGStorage = singleton(ORPGStorage) |
87 open_rpg = ORPGStorage() | 83 component = ORPGStorage() |