base.py 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  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.simulation import FinishMoveEvent
  6. from synergine2_xyz.move.simulation import StartMoveEvent
  7. class CocosTerminal(GameTerminal):
  8. subscribed_events = [
  9. FinishMoveEvent,
  10. StartMoveEvent,
  11. ]
  12. def __init__(self, *args, asynchronous: bool, map_dir_path: str, **kwargs):
  13. super().__init__(*args, **kwargs)
  14. self.asynchronous = asynchronous
  15. self.map_dir_path = map_dir_path
  16. def run(self):
  17. from sandbox.tile.gui.base import Game
  18. from synergine2_cocos2d.gui import SubjectMapper
  19. self.gui = Game(
  20. self.config,
  21. self.logger,
  22. self,
  23. map_dir_path=self.map_dir_path,
  24. )
  25. # TODO: Defind on some other place ?
  26. self.gui.subject_mapper_factory.register_mapper(
  27. ManSubject,
  28. SubjectMapper(ManActor),
  29. )
  30. self.gui.run()