35 lines
1.7 KiB
JavaScript
35 lines
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.GameModelLoader = void 0;
|
|
const StoredGameModel_1 = require("../StoredGameModel");
|
|
const path = require("node:path");
|
|
const ModelComponentFileDirectory_1 = require("../ModelComponentFileDirectory");
|
|
const ScriptAccountLoader_1 = require("./ScriptAccountLoader");
|
|
const GamesystemLoader_1 = require("./GamesystemLoader");
|
|
class GameModelLoader {
|
|
constructor(gameModelDir) {
|
|
this.gameModelDir = gameModelDir;
|
|
}
|
|
loadGameModel() {
|
|
const gameModelName = path.basename(this.gameModelDir);
|
|
const gameModelComponents = this.loadGameModelComponents();
|
|
return new StoredGameModel_1.StoredGameModel(gameModelName, gameModelComponents);
|
|
}
|
|
loadGameModelComponents() {
|
|
let gameModelComponents = this.loadScriptAccountComponents();
|
|
gameModelComponents = gameModelComponents.concat(this.loadGamesystems());
|
|
return gameModelComponents;
|
|
}
|
|
loadScriptAccountComponents() {
|
|
const scriptAccountDir = path.join(this.gameModelDir, ModelComponentFileDirectory_1.ModelComponentFileDirectory.SCRIPTACCOUNT_DIR_NAME);
|
|
const scriptAccountLoader = new ScriptAccountLoader_1.ScriptAccountLoader(scriptAccountDir);
|
|
return scriptAccountLoader.loadScriptAccounts();
|
|
}
|
|
loadGamesystems() {
|
|
const gamesystemDir = path.join(this.gameModelDir, ModelComponentFileDirectory_1.ModelComponentFileDirectory.GAMESYSTEM_DIR_NAME);
|
|
const gamesystemLoader = new GamesystemLoader_1.GamesystemLoader(gamesystemDir);
|
|
return gamesystemLoader.loadGamesystems();
|
|
}
|
|
}
|
|
exports.GameModelLoader = GameModelLoader;
|
|
//# sourceMappingURL=GameModelLoader.js.map
|