Mercurial > touhou
comparison pytouhou/resource/anmwrapper.py @ 97:ac2e5e1c2c3c
Refactor \o/
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 04 Sep 2011 23:50:00 +0200 |
parents | |
children | dbb1a86c0235 |
comparison
equal
deleted
inserted
replaced
96:54929d495654 | 97:ac2e5e1c2c3c |
---|---|
1 class AnmWrapper(object): | |
2 def __init__(self, anm_files): | |
3 self.anm_files = list(anm_files) | |
4 | |
5 | |
6 def get_sprite(self, sprite_index): | |
7 for anm in self.anm_files: | |
8 if sprite_index in anm.sprites: | |
9 return anm, anm.sprites[sprite_index] | |
10 raise IndexError | |
11 | |
12 | |
13 def get_script(self, script_index): | |
14 for anm in self.anm_files: | |
15 if script_index in anm.scripts: | |
16 return anm, anm.scripts[script_index] | |
17 raise IndexError |