diff --git a/einsteingame/formatter.py b/einsteingame/formatter.py index f86dc55..b884bfd 100644 --- a/einsteingame/formatter.py +++ b/einsteingame/formatter.py @@ -95,3 +95,13 @@ class Formatter(object): if c.type == INT_ARG or c.type == STRING_ARG or c.type == FLOAT_ARG or c.type == DOUBLE_ARG: no = c.data args[no - 1] = c.type + + self.__commands = commands + + def getMessage(self): + ret = '' + + for command in self.__commands: + ret += command['data'] + + return repr(ret) diff --git a/einsteingame/main.py b/einsteingame/main.py index 047c9f8..99bcb3f 100644 --- a/einsteingame/main.py +++ b/einsteingame/main.py @@ -82,11 +82,15 @@ def loadResources(selfPath): resources = ResourcesCollection(dirs) msg.load(resources) + return resources + def main(script, *args): ensureDirExists(os.environ["HOME"] + "/.einstein") - loadResources(sys.argv[0]) + resources = loadResources(sys.argv[0]) initScreen() initAudio() # menu() # getStorage().flush() + + resources.dump() diff --git a/einsteingame/messages.py b/einsteingame/messages.py index 96eac5d..016deae 100644 --- a/einsteingame/messages.py +++ b/einsteingame/messages.py @@ -60,6 +60,8 @@ class Messages(object): "message": Formatter(data, msgOffset), } + print("{}: {}".format(name, self.__messages[name]['message'].getMessage())) + offset += sz + 4 diff --git a/einsteingame/resources.py b/einsteingame/resources.py index f3ef771..feee40b 100644 --- a/einsteingame/resources.py +++ b/einsteingame/resources.py @@ -216,4 +216,10 @@ class ResourcesCollection: for resource in self.__groups[group]: func(resource) + def dump(self): + for name, resource in self.__resources.items(): + for variant in resource.variants: + with open('resources/' + name, 'wb') as f: + f.write(variant.getData()) + resources = None