base.py 987B

123456789101112131415161718192021222324252627282930313233343536
  1. # coding: utf-8
  2. from sandbox.tile.simulation.subject import Man as ManSubject
  3. from sandbox.tile.gui.actor import Man as ManActor
  4. from synergine2_cocos2d.terminal import GameTerminal
  5. from synergine2_xyz.move import MoveEvent
  6. class CocosTerminal(GameTerminal):
  7. subscribed_events = [
  8. MoveEvent,
  9. ]
  10. def __init__(self, *args, asynchronous: bool, map_dir_path: str, **kwargs):
  11. super().__init__(*args, **kwargs)
  12. self.asynchronous = asynchronous
  13. self.map_dir_path = map_dir_path
  14. def run(self):
  15. from sandbox.tile.gui.base import Game
  16. from synergine2_cocos2d.gui import SubjectMapper
  17. self.gui = Game(
  18. self.config,
  19. self.logger,
  20. self,
  21. map_dir_path=self.map_dir_path,
  22. )
  23. # TODO: Defind on some other place ?
  24. self.gui.subject_mapper_factory.register_mapper(
  25. ManSubject,
  26. SubjectMapper(ManActor),
  27. )
  28. self.gui.run()