Ejemplo n.º 1
0
 def create_game_api(self, app, docker_from_env):
     game_runner = GameRunner(
         worker_manager_class=LocalWorkerManager,
         game_state_generator=lambda avatar_manager: MockGameState(),
         django_api_url='http://test',
         port='0000')
     return service.GameAPI(game_state=game_runner.game_state,
                            worker_manager=game_runner.worker_manager)
Ejemplo n.º 2
0
def create_runner(port):
    settings = json.loads(os.environ["settings"])
    generator = getattr(map_generator, settings["GENERATOR"])(settings)
    return GameRunner(
        game_state_generator=generator.get_game_state,
        communicator=communicator,
        port=port,
    )
Ejemplo n.º 3
0
def create_runner(port):
    settings = json.loads(os.environ["settings"])
    generator = getattr(map_generator, settings["GENERATOR"])(settings)
    return GameRunner(
        game_state_generator=generator.get_game_state,
        django_api_url=os.environ.get(
            "GAME_API_URL", "http://localhost:8000/aimmo/api/games/"),
        port=port,
    )
Ejemplo n.º 4
0
def create_runner(port):
    settings = json.loads(os.environ["settings"])
    generator = getattr(map_generator, settings["GENERATOR"])(settings)
    turn_collector = TurnCollector(socketio_server)
    return GameRunner(
        game_state_generator=generator.get_game_state,
        communicator=communicator,
        port=port,
        turn_collector=turn_collector,
    )
Ejemplo n.º 5
0
def create_runner(port):
    settings = json.loads(os.environ['settings'])
    generator = getattr(map_generator, settings['GENERATOR'])(settings)
    worker_manager_class = WORKER_MANAGERS[os.environ.get(
        'WORKER_MANAGER', 'local')]
    return GameRunner(worker_manager_class=worker_manager_class,
                      game_state_generator=generator.get_game_state,
                      django_api_url=os.environ.get(
                          'GAME_API_URL',
                          'http://localhost:8000/aimmo/api/games/'),
                      port=port)
Ejemplo n.º 6
0
def game_api(app, turn_collector, socketio_server, game_id):
    game_runner = GameRunner(
        game_state_generator=lambda avatar_manager: MockGameState(
            None, MockAvatarManager()
        ),
        communicator=MockCommunicator(),
        port="0000",
        turn_collector=turn_collector,
    )
    return GameAPI(
        game_state=game_runner.game_state, application=app, server=socketio_server,
    )
Ejemplo n.º 7
0
def game_api(app, socketio_server, game_id):
    game_runner = GameRunner(
        game_state_generator=lambda avatar_manager: MockGameState(),
        communicator=MockCommunicator(),
        port="0000",
        worker_manager_class=MockWorkerManager,
    )
    return service.GameAPI(
        game_state=game_runner.game_state,
        worker_manager=game_runner.worker_manager,
        application=app,
        server=socketio_server,
    )
Ejemplo n.º 8
0
def game_runner():
    async def mock_callback():
        pass

    game_state = GameState(InfiniteMap(), AvatarManager())
    game_runner = GameRunner(
        game_state_generator=lambda avatar_manager: game_state,
        port="0000",
        communicator=MockCommunicator(),
        worker_manager_class=MockWorkerManager,
    )

    game_runner.set_end_turn_callback(mock_callback)
    return game_runner
Ejemplo n.º 9
0
def game_runner():
    async def mock_callback():
        pass

    game_state = GameState(InfiniteMap(), AvatarManager())
    game_runner = GameRunner(
        worker_manager_class=ConcreteWorkerManager,
        game_state_generator=lambda avatar_manager: game_state,
        port='0000',
        django_api_url='http://test')

    game_runner.communicator = MockCommunicator()
    game_runner.set_end_turn_callback(mock_callback)
    return game_runner