예제 #1
0
def import_game_data(game_dir: str):
    assets_dir = join(game_dir, 'cultistsimulator_Data', 'StreamingAssets')
    content_dir = join(assets_dir, 'content')
    with get_session() as session:
        game_contents = GameContents()
        for group in FileGroup:
            decks = _load_content(Deck, content_dir, group, FileCategory.DECKS,
                                  game_contents)
            elements = _load_content(Element, content_dir, group,
                                     FileCategory.ELEMENTS, game_contents)
            legacies = _load_content(Legacy, content_dir, group,
                                     FileCategory.LEGACIES, game_contents)
            recipes = _load_content(Recipe, content_dir, group,
                                    FileCategory.RECIPES, game_contents)
            verbs = _load_content(Verb, content_dir, group, FileCategory.VERBS,
                                  game_contents)

            # Create the dynamically generated secondary tables
            Base.metadata.create_all()

            session.add_all(decks)
            session.add_all(elements)
            session.add_all(legacies)
            session.add_all(recipes)
            session.add_all(verbs)
def import_game_data(game_dir: str):
    assets_dir = Path(game_dir) / DATA_DIR / 'StreamingAssets'
    content_dir = assets_dir / 'content'
    with get_session() as session:

        # Load the content from the regular files
        game_contents = GameContents()
        for group in FileGroup:
            decks = _load_content(Deck, content_dir, group, FileCategory.DECKS,
                                  game_contents)
            elements = _load_content(Element, content_dir, group,
                                     FileCategory.ELEMENTS, game_contents)
            endings = _load_content(Ending, content_dir, group,
                                    FileCategory.ENDINGS, game_contents)
            legacies = _load_content(Legacy, content_dir, group,
                                     FileCategory.LEGACIES, game_contents)
            recipes = _load_content(Recipe, content_dir, group,
                                    FileCategory.RECIPES, game_contents)
            verbs = _load_content(Verb, content_dir, group, FileCategory.VERBS,
                                  game_contents)

            # Create the dynamically generated secondary tables
            Base.metadata.create_all()

            session.add_all(decks)
            session.add_all(elements)
            session.add_all(endings)
            session.add_all(legacies)
            session.add_all(recipes)
            session.add_all(verbs)