예제 #1
0
    def create_game(self,
                    visibility=VisibilityState.PUBLIC,
                    game_mode: str=None,
                    host: Player=None,
                    name: str=None,
                    mapname: str=None,
                    password: str=None):
        """
        Main entrypoint for creating new games
        """
        id = self.createUuid()
        args = {
            "id": id,
            "host": host,
            "name": name,
            "map": mapname,
            "game_mode": game_mode,
            "game_service": self,
            "game_stats_service": self.game_stats_service
        }
        if game_mode == 'ladder1v1':
            game = LadderGame(**args)
        elif game_mode == 'coop':
            game = CoopGame(**args)
        elif game_mode == 'faf' or game_mode == 'fafbeta' or game_mode == 'equilibrium':
            game = CustomGame(**args)
        else:
            game = Game(**args)
        self.games[id] = game

        game.visibility = visibility
        game.password = password

        self.mark_dirty(game)
        return game
예제 #2
0
def custom_game(loop, game_service, game_stats_service):
    game = CustomGame(42, game_service, game_stats_service)
    yield game
    loop.run_until_complete(game.clear_data())
예제 #3
0
def custom_game(event_loop, database, game_service, game_stats_service):
    return CustomGame(42, database, game_service, game_stats_service)
예제 #4
0
def custom_game(loop, game_service, game_stats_service):
    game = CustomGame(42, game_service, game_stats_service)
    yield game
    loop.run_until_complete(game.clear_data())
예제 #5
0
def custom_game(event_loop, database, game_service, game_stats_service):
    game = CustomGame(42, database, game_service, game_stats_service)
    yield game