diff --git a/.eslintrc.json b/.eslintrc.json index 011e046..84baaef 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,7 +3,8 @@ "ignorePatterns": [ "app/**/*", // ignore nodeJs files "dist/**/*", - "release/**/*" + "release/**/*", + "src/**/*" ], "overrides": [ { diff --git a/app/LoadModel.js b/app/LoadModel.js deleted file mode 100644 index a376e51..0000000 --- a/app/LoadModel.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LoadModel = void 0; -class LoadModel { - constructor(jsonString, modelType) { - this.jsonString = jsonString; - this.modelType = modelType; - } -} -exports.LoadModel = LoadModel; -//# sourceMappingURL=LoadModel.js.map \ No newline at end of file diff --git a/app/LoadModel.ts b/app/LoadModel.ts deleted file mode 100644 index 9effb8d..0000000 --- a/app/LoadModel.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {ModelComponentType} from "../src/app/game-model/ModelComponentType"; - -export class LoadModel { - jsonString: string - modelType: ModelComponentType - - - constructor(jsonString: string, modelType: ModelComponentType) { - this.jsonString = jsonString; - this.modelType = modelType; - } -} diff --git a/app/LoadedProject.js b/app/LoadedProject.js deleted file mode 100644 index 66d4596..0000000 --- a/app/LoadedProject.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LoadedProject = void 0; -class LoadedProject { - constructor(projectName, loadedModels) { - this.projectName = projectName; - this.loadedModels = loadedModels; - } -} -exports.LoadedProject = LoadedProject; -//# sourceMappingURL=LoadedProject.js.map \ No newline at end of file diff --git a/app/LoadedProject.ts b/app/LoadedProject.ts deleted file mode 100644 index be710b8..0000000 --- a/app/LoadedProject.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {LoadModel} from "./LoadModel"; - -export class LoadedProject { - projectName: string - loadedModels: LoadModel[] - - - constructor(projectName: string, loadedModels: LoadModel[]) { - this.projectName = projectName; - this.loadedModels = loadedModels; - } -} diff --git a/app/RecursiveLoadModel.js b/app/RecursiveLoadModel.js deleted file mode 100644 index 7599083..0000000 --- a/app/RecursiveLoadModel.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.RecursiveLoadModel = void 0; -const LoadModel_1 = require("./LoadModel"); -class RecursiveLoadModel extends LoadModel_1.LoadModel { - constructor(jsonString, modelType, parentLoadModelname) { - super(jsonString, modelType); - this.parentLoadModelname = parentLoadModelname; - } -} -exports.RecursiveLoadModel = RecursiveLoadModel; -//# sourceMappingURL=RecursiveLoadModel.js.map \ No newline at end of file diff --git a/app/RecursiveLoadModel.ts b/app/RecursiveLoadModel.ts deleted file mode 100644 index 1b9d251..0000000 --- a/app/RecursiveLoadModel.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {LoadModel} from "./LoadModel"; -import {ModelComponentType} from "../src/app/game-model/ModelComponentType"; - -export class RecursiveLoadModel extends LoadModel { - parentLoadModelname: string - - - constructor(jsonString: string, modelType: ModelComponentType, parentLoadModelname: string) { - super(jsonString, modelType); - this.parentLoadModelname = parentLoadModelname; - } -} diff --git a/app/SaveProject.js b/app/SaveProject.js deleted file mode 100644 index 95ef547..0000000 --- a/app/SaveProject.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SaveProject = void 0; -const fs = require("fs"); -const path = require("node:path"); -const LoadModel_1 = require("./LoadModel"); -const ModelComponentType_1 = require("../src/app/game-model/ModelComponentType"); -const LoadedProject_1 = require("./LoadedProject"); -const RecursiveLoadModel_1 = require("./RecursiveLoadModel"); -class SaveProject { - static saveProject(projectDir, storageModels) { - if (!fs.existsSync(projectDir)) { - fs.mkdirSync(projectDir, { recursive: true }); - } - console.log(storageModels); - storageModels.forEach(storageModel => { - let modelDir = path.join(projectDir, storageModel.storageRootDir); - storageModel.storagePath.forEach(pathElement => modelDir = path.join(modelDir, pathElement)); - if (!fs.existsSync(modelDir)) { - fs.mkdirSync(modelDir, { recursive: true }); - } - const filePath = path.join(modelDir, storageModel.fileName + ".json"); - fs.writeFile(filePath, storageModel.jsonString, 'utf-8', (err) => { - if (err) { - console.error('Error writing JSON to file:', err); - } - else { - console.log('JSON file saved successfully:', filePath); - } - }); - }); - } - static loadProject(projectDir) { - let loadedScriptAccounts = SaveProject.loadScriptAccounts(projectDir); - loadedScriptAccounts = loadedScriptAccounts.concat(SaveProject.loadGamesystems(projectDir)); - return new LoadedProject_1.LoadedProject(path.basename(projectDir), loadedScriptAccounts); - } - static loadScriptAccounts(projectDir) { - const scriptAccountDir = path.join(projectDir, "script-accounts"); - if (!fs.existsSync(scriptAccountDir)) { - return []; - } - const loadedScriptAccounts = []; - const scriptAccountFileNames = fs.readdirSync(scriptAccountDir); - scriptAccountFileNames.forEach(scriptAccountFileName => { - const scriptAccountFile = path.join(scriptAccountDir, scriptAccountFileName); - const scriptAccountData = fs.readFileSync(scriptAccountFile, 'utf-8'); - loadedScriptAccounts.push({ - modelType: ModelComponentType_1.ModelComponentType.SCRIPTACCOUNT, - jsonString: scriptAccountData - }); - }); - return loadedScriptAccounts; - } - static loadGamesystems(projectDir) { - const gamesystemDir = path.join(projectDir, "gamesystems"); - if (fs.existsSync(gamesystemDir)) { - const loadedGamesystems = this.loadGamesystemsRecursively(gamesystemDir); - console.log("LoadedGamesystems: ", loadedGamesystems.length); - return loadedGamesystems; - } - else { - return []; - } - } - static loadGamesystemsRecursively(gamesystemDir) { - let loadedGamesystems = []; - const gamesystemFileNames = fs.readdirSync(gamesystemDir); - gamesystemFileNames.forEach(fileName => { - const gamesystemPath = path.join(gamesystemDir, fileName); - if (fs.lstatSync(gamesystemPath).isDirectory()) { - const childModels = SaveProject.loadGamesystemsRecursively(gamesystemPath); - loadedGamesystems = loadedGamesystems.concat(childModels); - } - else { - const gamesystemData = fs.readFileSync(path.join(gamesystemDir, fileName), "utf-8"); - if (path.parse(fileName).name === path.basename(gamesystemDir)) { - if ((path.basename(gamesystemDir) === path.parse(fileName).name) && path.basename(path.parse(gamesystemDir).dir) === "gamesystems") { - const loadedModel = new LoadModel_1.LoadModel(gamesystemData, ModelComponentType_1.ModelComponentType.GAMESYTEM); - loadedGamesystems.unshift(loadedModel); - } - else { - const loadedModel = new RecursiveLoadModel_1.RecursiveLoadModel(gamesystemData, ModelComponentType_1.ModelComponentType.GAMESYTEM, path.basename(gamesystemDir)); - loadedGamesystems.unshift(loadedModel); - } - } - else { - const secondCon = path.basename(gamesystemDir) === path.parse(fileName).name; - const thirdCon = path.basename(path.parse(gamesystemDir).dir) === "gamesystems"; - if (path.basename(gamesystemDir) === "gamesystems") { - const loadedModel = new LoadModel_1.LoadModel(gamesystemData, ModelComponentType_1.ModelComponentType.GAMESYTEM); - loadedGamesystems.push(loadedModel); - } - else { - const loadedModel = new RecursiveLoadModel_1.RecursiveLoadModel(gamesystemData, ModelComponentType_1.ModelComponentType.GAMESYTEM, path.basename(gamesystemDir)); - loadedGamesystems.push(loadedModel); - } - } - } - }); - return loadedGamesystems; - } -} -exports.SaveProject = SaveProject; -//# sourceMappingURL=SaveProject.js.map \ No newline at end of file diff --git a/app/SaveProject.ts b/app/SaveProject.ts deleted file mode 100644 index a042f9e..0000000 --- a/app/SaveProject.ts +++ /dev/null @@ -1,114 +0,0 @@ -import {StorageModel} from "../src/app/game-model/fs/StorageModel"; -import * as fs from "fs"; -import * as path from "node:path"; -import {LoadModel} from "./LoadModel"; -import {ModelComponentType} from "../src/app/game-model/ModelComponentType"; -import {LoadedProject} from "./LoadedProject"; -import {RecursiveLoadModel} from "./RecursiveLoadModel"; - - -export class SaveProject { - static saveProject(projectDir: string, storageModels: StorageModel[]) { - if(!fs.existsSync(projectDir)) { - fs.mkdirSync(projectDir, {recursive: true}); - } - - console.log(storageModels) - storageModels.forEach(storageModel => { - let modelDir = path.join(projectDir, storageModel.storageRootDir); - storageModel.storagePath.forEach(pathElement => modelDir = path.join(modelDir, pathElement)); - if(!fs.existsSync(modelDir)) { - fs.mkdirSync(modelDir, {recursive: true}); - } - - const filePath = path.join(modelDir, storageModel.fileName + ".json"); - fs.writeFile(filePath, storageModel.jsonString ,'utf-8', (err) => { - if (err) { - console.error('Error writing JSON to file:', err); - } else { - console.log('JSON file saved successfully:', filePath); - } - }) - }) - } - - static loadProject(projectDir: string) { - let loadedScriptAccounts: LoadModel[] = SaveProject.loadScriptAccounts(projectDir) - loadedScriptAccounts = loadedScriptAccounts.concat(SaveProject.loadGamesystems(projectDir)) - return new LoadedProject(path.basename(projectDir), loadedScriptAccounts); - } - - static loadScriptAccounts(projectDir: string): LoadModel[] { - const scriptAccountDir = path.join(projectDir, "script-accounts"); - if (!fs.existsSync(scriptAccountDir)) { - return []; - } - - const loadedScriptAccounts: LoadModel[] = []; - - const scriptAccountFileNames = fs.readdirSync(scriptAccountDir); - scriptAccountFileNames.forEach(scriptAccountFileName => { - const scriptAccountFile = path.join(scriptAccountDir, scriptAccountFileName) - const scriptAccountData: string = fs.readFileSync(scriptAccountFile, 'utf-8'); - - loadedScriptAccounts.push({ - modelType: ModelComponentType.SCRIPTACCOUNT, - jsonString: scriptAccountData - }); - }) - - return loadedScriptAccounts; - } - - static loadGamesystems(projectDir: string): LoadModel[] { - const gamesystemDir = path.join(projectDir, "gamesystems"); - if(fs.existsSync(gamesystemDir)) { - const loadedGamesystems = this.loadGamesystemsRecursively(gamesystemDir); - console.log("LoadedGamesystems: ", loadedGamesystems.length); - return loadedGamesystems; - } else { - return [] - } - } - - static loadGamesystemsRecursively(gamesystemDir: string): LoadModel[] { - let loadedGamesystems: LoadModel[] = []; - const gamesystemFileNames = fs.readdirSync(gamesystemDir); - - gamesystemFileNames.forEach(fileName => { - const gamesystemPath = path.join(gamesystemDir, fileName); - - if(fs.lstatSync(gamesystemPath).isDirectory()) { - const childModels: LoadModel[] = SaveProject.loadGamesystemsRecursively(gamesystemPath); - loadedGamesystems = loadedGamesystems.concat(childModels); - } else { - const gamesystemData = fs.readFileSync(path.join(gamesystemDir, fileName), "utf-8"); - if(path.parse(fileName).name === path.basename(gamesystemDir) ) { - if((path.basename(gamesystemDir) === path.parse(fileName).name) && path.basename(path.parse(gamesystemDir).dir) === "gamesystems") { - const loadedModel = new LoadModel(gamesystemData, ModelComponentType.GAMESYTEM); - loadedGamesystems.unshift(loadedModel) - } else { - const loadedModel = new RecursiveLoadModel(gamesystemData, ModelComponentType.GAMESYTEM, path.basename(gamesystemDir)) - loadedGamesystems.unshift(loadedModel); - } - - } else { - const secondCon = path.basename(gamesystemDir) === path.parse(fileName).name - const thirdCon = path.basename(path.parse(gamesystemDir).dir) === "gamesystems" - - if(path.basename(gamesystemDir) === "gamesystems"){ - const loadedModel = new LoadModel(gamesystemData, ModelComponentType.GAMESYTEM) - loadedGamesystems.push(loadedModel); - } else { - - const loadedModel = new RecursiveLoadModel(gamesystemData, ModelComponentType.GAMESYTEM, path.basename(gamesystemDir)) - loadedGamesystems.push(loadedModel); - } - - } - } - }) - return loadedGamesystems; - } - -} diff --git a/app/StorageModel.ts b/app/StorageModel.ts deleted file mode 100644 index 392016a..0000000 --- a/app/StorageModel.ts +++ /dev/null @@ -1,12 +0,0 @@ -class StorageModel { - jsonString: string - fileName: string - storageDir: string - - - constructor(jsonString: string, fileName: string, storageDir: string) { - this.jsonString = jsonString; - this.fileName = fileName; - this.storageDir = storageDir; - } -} diff --git a/app/main.ts b/app/main.ts index 0f784e9..f651a10 100644 --- a/app/main.ts +++ b/app/main.ts @@ -1,9 +1,11 @@ -import {app, BrowserWindow, screen, Menu, ipcMain, dialog, globalShortcut} from 'electron'; +import {app, BrowserWindow, dialog, globalShortcut, ipcMain, Menu, screen} from 'electron'; import * as path from 'path'; import * as fs from 'fs'; -import {json} from "node:stream/consumers"; -import {StorageModel} from "../src/app/game-model/fs/StorageModel"; -import {SaveProject} from "./SaveProject"; +import {GameModelLoader} from "./storage/loader/GameModelLoader"; +import {StoredGameModel} from "./storage/StoredGameModel"; +import {ScriptAccountStorage} from "./storage/storing/ScriptAccountStoring"; +import {ModelComponentFileDirectory} from "./storage/ModelComponentFileDirectory"; +import {GamesystemStorage} from "./storage/storing/GamesystemStorage"; let win: BrowserWindow | null = null; const args = process.argv.slice(1), @@ -94,11 +96,15 @@ function createWindow(): BrowserWindow { contextMenu.popup({ window: win!, x: params.x, y: params.y }); }) - ipcMain.on('save-model', (event, storageModels: StorageModel[]) => { - console.log("Save Model") - SaveProject.saveProject(projectDirectory, storageModels); + ipcMain.on('save-model', (event, storedGameModel: StoredGameModel) => { + recieveGameModelToStore(storedGameModel) }) + /*ipcMain.on('delete-component', (event, deletedComponent: DeleteModel) => { + console.log("Delete Model: ", deletedComponent) + deleteComponent(deletedComponent); + })*/ + const menuTemplate = [ { label: 'File', @@ -126,7 +132,6 @@ function createWindow(): BrowserWindow { ] const menu = Menu.buildFromTemplate(menuTemplate); Menu.setApplicationMenu(menu) - loadDevProjectAtStart() win.webContents.on('did-finish-load', () => { loadDevProjectAtStart() @@ -199,11 +204,28 @@ function loadDevProjectAtStart() { function openProjectFromFile(openProjectDir: string) { projectDirectory = openProjectDir - console.log("Open Project-Directory: ", openProjectDir) - const loadedProject = SaveProject.loadProject(openProjectDir) + const gameModelLoader = new GameModelLoader(openProjectDir); + const loadedProject = gameModelLoader.loadGameModel(); win!.webContents.send("open-project", loadedProject) } function saveProject() { win!.webContents.send('get-project-data') } + +function recieveGameModelToStore(gameModel: StoredGameModel) { + const scriptAccountStorage = new ScriptAccountStorage(path.join(projectDirectory, ModelComponentFileDirectory.SCRIPTACCOUNT_DIR_NAME)) + scriptAccountStorage.storeScriptAccounts(gameModel.storedScriptAccounts) + + const gamesystemStorage = new GamesystemStorage(path.join(projectDirectory, ModelComponentFileDirectory.GAMESYSTEM_DIR_NAME)) + gamesystemStorage.storeGamesystems(gameModel.storedGamesystems) +} + +/*function deleteComponent(component: DeleteModel) { + console.log("Delete Component") + if(component.modeltype == ModelComponentType.SCRIPTACCOUNT) { + DeleteTransaction.deleteScriptAccount(projectDirectory, component.componentName); + } else if(component.modeltype === ModelComponentType.GAMESYTEM) { + DeleteTransaction.deleteGamesystem(projectDirectory, component.componentName); + } +}*/ diff --git a/app/storage/FileUtils.js b/app/storage/FileUtils.js new file mode 100644 index 0000000..55d504f --- /dev/null +++ b/app/storage/FileUtils.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FileUtils = void 0; +const fs = require("fs"); +const path = require("node:path"); +const fs_1 = require("fs"); +class FileUtils { + static listFilesInDirectory(directory) { + if (fs.lstatSync(directory).isDirectory()) { + return fs.readdirSync(directory).map(fileName => path.join(directory, fileName)); + } + else { + return []; + } + } + static prepareFileForWriting(file) { + const parentDirectory = path.dirname(file); + if (!fs.existsSync(parentDirectory)) { + (0, fs_1.mkdirSync)(parentDirectory, { recursive: true }); + } + } + static removeFiles(files) { + files.forEach(file => { + if (fs.lstatSync(file).isDirectory()) { + fs.rmdirSync(file); + } + else { + fs.unlinkSync(file); + } + }); + } +} +exports.FileUtils = FileUtils; +//# sourceMappingURL=FileUtils.js.map \ No newline at end of file diff --git a/app/storage/FileUtils.ts b/app/storage/FileUtils.ts new file mode 100644 index 0000000..cfab96a --- /dev/null +++ b/app/storage/FileUtils.ts @@ -0,0 +1,33 @@ +import * as fs from "fs"; +import * as path from "node:path"; +import {mkdirSync} from "fs"; +import {lstatSync} from "node:fs"; + + +export class FileUtils { + public static listFilesInDirectory(directory: string) { + if(fs.lstatSync(directory).isDirectory()) { + return fs.readdirSync(directory).map(fileName => path.join(directory, fileName)) + } else { + return []; + } + } + + public static prepareFileForWriting(file: string) { + const parentDirectory = path.dirname(file) + + if(!fs.existsSync(parentDirectory)) { + mkdirSync(parentDirectory, {recursive: true}) + } + } + + public static removeFiles(files: string[]) { + files.forEach(file => { + if(fs.lstatSync(file).isDirectory()) { + fs.rmdirSync(file) + } else { + fs.unlinkSync(file); + } + }) + } +} diff --git a/app/storage/ModelComponentFileDirectory.js b/app/storage/ModelComponentFileDirectory.js new file mode 100644 index 0000000..9e2de51 --- /dev/null +++ b/app/storage/ModelComponentFileDirectory.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ModelComponentFileDirectory = void 0; +class ModelComponentFileDirectory { +} +exports.ModelComponentFileDirectory = ModelComponentFileDirectory; +ModelComponentFileDirectory.SCRIPTACCOUNT_DIR_NAME = "script-accounts"; +ModelComponentFileDirectory.GAMESYSTEM_DIR_NAME = "gamesystems"; +ModelComponentFileDirectory.GAMESYSTEM_SIMPLE_DIR_NAME = "simple"; +ModelComponentFileDirectory.GAMESYSTEM_PRODUCT_DIR_NAME = "product"; +//# sourceMappingURL=ModelComponentFileDirectory.js.map \ No newline at end of file diff --git a/app/storage/ModelComponentFileDirectory.ts b/app/storage/ModelComponentFileDirectory.ts new file mode 100644 index 0000000..35514b9 --- /dev/null +++ b/app/storage/ModelComponentFileDirectory.ts @@ -0,0 +1,6 @@ +export class ModelComponentFileDirectory { + public static SCRIPTACCOUNT_DIR_NAME = "script-accounts" + public static GAMESYSTEM_DIR_NAME = "gamesystems"; + public static GAMESYSTEM_SIMPLE_DIR_NAME = "simple"; + public static GAMESYSTEM_PRODUCT_DIR_NAME = "product"; +} diff --git a/app/storage/StoreComponent.js b/app/storage/StoreComponent.js new file mode 100644 index 0000000..a4ca044 --- /dev/null +++ b/app/storage/StoreComponent.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StoreComponent = void 0; +class StoreComponent { + constructor(jsonString, fileName, componentType) { + this.jsonString = jsonString; + this.fileName = fileName; + this.componentType = componentType; + } +} +exports.StoreComponent = StoreComponent; +//# sourceMappingURL=StoreComponent.js.map \ No newline at end of file diff --git a/app/storage/StoreComponent.ts b/app/storage/StoreComponent.ts new file mode 100644 index 0000000..95dea82 --- /dev/null +++ b/app/storage/StoreComponent.ts @@ -0,0 +1,13 @@ +import {ModelComponentType} from "../../src/app/project/game-model/ModelComponentType"; + + +export class StoreComponent { + jsonString: string + fileName: string + componentType: ModelComponentType + constructor(jsonString: string, fileName: string, componentType: ModelComponentType) { + this.jsonString = jsonString; + this.fileName = fileName; + this.componentType = componentType + } +} diff --git a/app/storage/StoredGameModel.js b/app/storage/StoredGameModel.js new file mode 100644 index 0000000..126a61b --- /dev/null +++ b/app/storage/StoredGameModel.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StoredGameModel = void 0; +class StoredGameModel { + constructor(gameModelName, storedScriptAccounts, storedGamesystems) { + this.gameModelName = gameModelName; + this.storedGamesystems = storedGamesystems; + this.storedScriptAccounts = storedScriptAccounts; + } +} +exports.StoredGameModel = StoredGameModel; +//# sourceMappingURL=StoredGameModel.js.map \ No newline at end of file diff --git a/app/storage/StoredGameModel.ts b/app/storage/StoredGameModel.ts new file mode 100644 index 0000000..8edfee0 --- /dev/null +++ b/app/storage/StoredGameModel.ts @@ -0,0 +1,15 @@ +import {StoreComponent} from "./StoreComponent"; + +export class StoredGameModel { + gameModelName: string + + storedGamesystems: StoreComponent[] + storedScriptAccounts: StoreComponent[] + + + constructor(gameModelName: string, storedScriptAccounts: StoreComponent[], storedGamesystems: StoreComponent[]) { + this.gameModelName = gameModelName; + this.storedGamesystems = storedGamesystems; + this.storedScriptAccounts = storedScriptAccounts; + } +} diff --git a/app/storage/loader/GameModelLoader.js b/app/storage/loader/GameModelLoader.js new file mode 100644 index 0000000..7139cc9 --- /dev/null +++ b/app/storage/loader/GameModelLoader.js @@ -0,0 +1,31 @@ +"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 storedScriptAccounts = this.loadScriptAccountComponents(); + const storedGamesystems = this.loadGamesystems(); + return new StoredGameModel_1.StoredGameModel(gameModelName, storedScriptAccounts, storedGamesystems); + } + 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 \ No newline at end of file diff --git a/app/storage/loader/GameModelLoader.ts b/app/storage/loader/GameModelLoader.ts new file mode 100644 index 0000000..bcbfa63 --- /dev/null +++ b/app/storage/loader/GameModelLoader.ts @@ -0,0 +1,42 @@ +import {StoredGameModel} from "../StoredGameModel"; +import {StoreComponent} from "../StoreComponent"; +import * as path from "node:path"; +import * as fs from "fs"; +import {ModelComponentFileDirectory} from "../ModelComponentFileDirectory"; +import {ScriptAccountLoader} from "./ScriptAccountLoader"; +import {GamesystemLoader} from "./GamesystemLoader"; + +export class GameModelLoader { + gameModelDir: string + + + constructor(gameModelDir: string) { + this.gameModelDir = gameModelDir; + } + + loadGameModel(): StoredGameModel { + const gameModelName = path.basename(this.gameModelDir) + + const storedScriptAccounts = this.loadScriptAccountComponents(); + const storedGamesystems = this.loadGamesystems(); + + return new StoredGameModel(gameModelName, storedScriptAccounts, storedGamesystems); + } + + private loadScriptAccountComponents() { + const scriptAccountDir = path.join(this.gameModelDir, ModelComponentFileDirectory.SCRIPTACCOUNT_DIR_NAME); + const scriptAccountLoader = new ScriptAccountLoader(scriptAccountDir); + return scriptAccountLoader.loadScriptAccounts() + } + + private loadGamesystems(): StoreComponent[] { + const gamesystemDir = path.join(this.gameModelDir, ModelComponentFileDirectory.GAMESYSTEM_DIR_NAME); + const gamesystemLoader = new GamesystemLoader(gamesystemDir); + return gamesystemLoader.loadGamesystems(); + } + + + + + +} diff --git a/app/storage/loader/GamesystemLoader.js b/app/storage/loader/GamesystemLoader.js new file mode 100644 index 0000000..551404b --- /dev/null +++ b/app/storage/loader/GamesystemLoader.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GamesystemLoader = void 0; +const StoreComponent_1 = require("../StoreComponent"); +const FileUtils_1 = require("../FileUtils"); +const fs = require("fs"); +const path = require("node:path"); +const ModelComponentType_1 = require("../../../src/app/project/game-model/ModelComponentType"); +class GamesystemLoader { + constructor(gamesystemDir) { + this.gamesystemDir = gamesystemDir; + } + loadGamesystems() { + return this.loadGamesystemsRecursivly(this.gamesystemDir); + } + loadGamesystemsRecursivly(currentGamesystemDir) { + let loadedGamesystems = []; + const gamesystemFiles = FileUtils_1.FileUtils.listFilesInDirectory(currentGamesystemDir); + gamesystemFiles.forEach(gamesystemFile => { + if (fs.lstatSync(gamesystemFile).isDirectory()) { + const childGamesystems = this.loadGamesystemsRecursivly(gamesystemFile); + loadedGamesystems = loadedGamesystems.concat(childGamesystems); + } + else if (path.basename(gamesystemFile).endsWith(".json")) { + const loadedGamesystem = this.loadGamesystem(gamesystemFile); + if (loadedGamesystem != undefined) { + loadedGamesystems.push(loadedGamesystem); + } + } + }); + return loadedGamesystems; + } + loadGamesystem(gamesystemFile) { + if (gamesystemFile.endsWith(".json")) { + const gamesystemData = fs.readFileSync(gamesystemFile, 'utf-8'); + return new StoreComponent_1.StoreComponent(gamesystemData, gamesystemFile, ModelComponentType_1.ModelComponentType.GAMESYTEM); + } + } +} +exports.GamesystemLoader = GamesystemLoader; +//# sourceMappingURL=GamesystemLoader.js.map \ No newline at end of file diff --git a/app/storage/loader/GamesystemLoader.ts b/app/storage/loader/GamesystemLoader.ts new file mode 100644 index 0000000..8ade2ca --- /dev/null +++ b/app/storage/loader/GamesystemLoader.ts @@ -0,0 +1,44 @@ +import {StoreComponent} from "../StoreComponent"; +import {FileUtils} from "../FileUtils"; +import * as fs from "fs"; +import * as path from "node:path"; +import {ModelComponentType} from "../../../src/app/project/game-model/ModelComponentType"; + +export class GamesystemLoader { + + gamesystemDir: string + + + constructor(gamesystemDir: string) { + this.gamesystemDir = gamesystemDir; + } + + loadGamesystems() { + return this.loadGamesystemsRecursivly(this.gamesystemDir) + } + + private loadGamesystemsRecursivly(currentGamesystemDir: string) { + let loadedGamesystems: StoreComponent[] = [] + const gamesystemFiles = FileUtils.listFilesInDirectory(currentGamesystemDir); + gamesystemFiles.forEach(gamesystemFile => { + if(fs.lstatSync(gamesystemFile).isDirectory()) { + const childGamesystems = this.loadGamesystemsRecursivly(gamesystemFile); + loadedGamesystems = loadedGamesystems.concat(childGamesystems); + } else if(path.basename(gamesystemFile).endsWith(".json")) { + const loadedGamesystem = this.loadGamesystem(gamesystemFile); + if(loadedGamesystem != undefined) { + loadedGamesystems.push(loadedGamesystem); + } + } + }) + + return loadedGamesystems; + } + + private loadGamesystem(gamesystemFile: string) { + if(gamesystemFile.endsWith(".json")) { + const gamesystemData = fs.readFileSync(gamesystemFile, 'utf-8'); + return new StoreComponent(gamesystemData, gamesystemFile, ModelComponentType.GAMESYTEM); + } + } +} diff --git a/app/storage/loader/ScriptAccountLoader.js b/app/storage/loader/ScriptAccountLoader.js new file mode 100644 index 0000000..5b5c1a2 --- /dev/null +++ b/app/storage/loader/ScriptAccountLoader.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ScriptAccountLoader = void 0; +const StoreComponent_1 = require("../StoreComponent"); +const FileUtils_1 = require("../FileUtils"); +const ModelComponentType_1 = require("../../../src/app/project/game-model/ModelComponentType"); +const fs = require("fs"); +class ScriptAccountLoader { + constructor(scriptAccountDir) { + this.scriptAccountDir = scriptAccountDir; + } + loadScriptAccounts() { + const scriptAccountFiles = FileUtils_1.FileUtils.listFilesInDirectory(this.scriptAccountDir); + const loadedScriptAccounts = []; + scriptAccountFiles.forEach(scriptAccountFile => { + const loadedScriptAccount = this.loadScriptAccount(scriptAccountFile); + if (loadedScriptAccount != undefined) { + loadedScriptAccounts.push(loadedScriptAccount); + } + }); + return loadedScriptAccounts; + } + loadScriptAccount(scriptAccountFile) { + if (scriptAccountFile.endsWith(".json")) { + const scriptAccountData = fs.readFileSync(scriptAccountFile, 'utf-8'); + return new StoreComponent_1.StoreComponent(scriptAccountData, scriptAccountFile, ModelComponentType_1.ModelComponentType.SCRIPTACCOUNT); + } + } +} +exports.ScriptAccountLoader = ScriptAccountLoader; +//# sourceMappingURL=ScriptAccountLoader.js.map \ No newline at end of file diff --git a/app/storage/loader/ScriptAccountLoader.ts b/app/storage/loader/ScriptAccountLoader.ts new file mode 100644 index 0000000..4914584 --- /dev/null +++ b/app/storage/loader/ScriptAccountLoader.ts @@ -0,0 +1,34 @@ +import {StoreComponent} from "../StoreComponent"; +import {FileUtils} from "../FileUtils"; +import {ModelComponentType} from "../../../src/app/project/game-model/ModelComponentType"; +import * as fs from "fs"; +import {ModelComponentFileDirectory} from "../ModelComponentFileDirectory"; +import {load} from "@angular-devkit/build-angular/src/utils/server-rendering/esm-in-memory-loader/loader-hooks"; + +export class ScriptAccountLoader { + scriptAccountDir: string + + + constructor(scriptAccountDir: string) { + this.scriptAccountDir = scriptAccountDir; + } + + loadScriptAccounts(): StoreComponent[] { + const scriptAccountFiles = FileUtils.listFilesInDirectory(this.scriptAccountDir); + const loadedScriptAccounts: StoreComponent[] = [] + scriptAccountFiles.forEach(scriptAccountFile => { + const loadedScriptAccount = this.loadScriptAccount(scriptAccountFile); + if(loadedScriptAccount != undefined) { + loadedScriptAccounts.push(loadedScriptAccount) + } + }) + return loadedScriptAccounts; + } + + private loadScriptAccount(scriptAccountFile: string) { + if(scriptAccountFile.endsWith(".json")) { + const scriptAccountData = fs.readFileSync(scriptAccountFile, 'utf-8'); + return new StoreComponent(scriptAccountData, scriptAccountFile, ModelComponentType.SCRIPTACCOUNT); + } + } +} diff --git a/app/storage/storing/GamesystemStorage.js b/app/storage/storing/GamesystemStorage.js new file mode 100644 index 0000000..003890e --- /dev/null +++ b/app/storage/storing/GamesystemStorage.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GamesystemStorage = void 0; +const FileUtils_1 = require("../FileUtils"); +const path = require("node:path"); +const fs = require("fs"); +class GamesystemStorage { + constructor(gamesystemRootDir) { + this.gamesystemRootDir = gamesystemRootDir; + } + storeGamesystems(gamesystems) { + const unreferencedFiles = this.detectUnusedGamesystemFiles(gamesystems); + FileUtils_1.FileUtils.removeFiles(unreferencedFiles); + gamesystems.forEach(gamesystem => this.storeGamesystem(gamesystem)); + } + detectUnusedGamesystemFiles(gamesystems) { + const unreferencedFiles = []; + const gamesystemFiles = FileUtils_1.FileUtils.listFilesInDirectory(this.gamesystemRootDir); + while (gamesystemFiles.length > 0) { + const currentGamesystemFile = gamesystemFiles.shift(); + const referencedGamesystemName = path.parse(path.basename(currentGamesystemFile)).name; + const referencedGamesystem = this.findReferencedGamesystem(referencedGamesystemName, gamesystems); + if (referencedGamesystem == undefined) { + unreferencedFiles.push(currentGamesystemFile); + } + else { + const decodedJSONData = JSON.parse(referencedGamesystem.jsonString); + if (decodedJSONData.childsystems != undefined) { + //Check if current file is a directory. When it is a directory, everything is fine + if (fs.lstatSync(currentGamesystemFile).isDirectory()) { + } + else { + const parentDirName = path.basename(path.dirname(currentGamesystemFile)); + if (parentDirName !== referencedGamesystemName) { + unreferencedFiles.push(currentGamesystemFile); + } + } + } + } + if (fs.lstatSync(currentGamesystemFile).isDirectory()) { + gamesystemFiles.push(...FileUtils_1.FileUtils.listFilesInDirectory(currentGamesystemFile)); + } + } + return unreferencedFiles; + } + findReferencedGamesystem(referencedName, gamesystems) { + return gamesystems.find(gamesystem => path.basename(gamesystem.fileName) === referencedName); + } + storeGamesystem(gamesystem) { + const gamesystemFile = path.join(...gamesystem.fileName.split("/")); + const completeGamesystemFile = path.join(this.gamesystemRootDir, gamesystemFile); + FileUtils_1.FileUtils.prepareFileForWriting(completeGamesystemFile); + fs.writeFileSync(completeGamesystemFile + ".json", gamesystem.jsonString, 'utf-8'); + } +} +exports.GamesystemStorage = GamesystemStorage; +//# sourceMappingURL=GamesystemStorage.js.map \ No newline at end of file diff --git a/app/storage/storing/GamesystemStorage.ts b/app/storage/storing/GamesystemStorage.ts new file mode 100644 index 0000000..c414f65 --- /dev/null +++ b/app/storage/storing/GamesystemStorage.ts @@ -0,0 +1,64 @@ +import {StoreComponent} from "../StoreComponent"; +import {FileUtils} from "../FileUtils"; +import * as path from "node:path"; +import * as fs from "fs"; + +export class GamesystemStorage { + + private gamesystemRootDir: string + + + constructor(gamesystemRootDir: string) { + this.gamesystemRootDir = gamesystemRootDir; + } + + public storeGamesystems(gamesystems: StoreComponent[]) { + const unreferencedFiles = this.detectUnusedGamesystemFiles(gamesystems) + FileUtils.removeFiles(unreferencedFiles) + gamesystems.forEach(gamesystem => this.storeGamesystem(gamesystem)) + } + + private detectUnusedGamesystemFiles(gamesystems: StoreComponent[]) { + const unreferencedFiles: string[] = [] + const gamesystemFiles = FileUtils.listFilesInDirectory(this.gamesystemRootDir); + while(gamesystemFiles.length > 0) { + const currentGamesystemFile = gamesystemFiles.shift() + const referencedGamesystemName = path.parse(path.basename(currentGamesystemFile!)).name + const referencedGamesystem = this.findReferencedGamesystem(referencedGamesystemName, gamesystems) + if(referencedGamesystem == undefined) { + unreferencedFiles.push(currentGamesystemFile!) + } else { + const decodedJSONData = JSON.parse(referencedGamesystem!.jsonString) + if(decodedJSONData.childsystems != undefined) { + //Check if current file is a directory. When it is a directory, everything is fine + if(fs.lstatSync(currentGamesystemFile!).isDirectory()) { + + } else { + const parentDirName = path.basename(path.dirname(currentGamesystemFile!)) + if(parentDirName !== referencedGamesystemName) { + unreferencedFiles.push(currentGamesystemFile!) + } + } + } + } + + if(fs.lstatSync(currentGamesystemFile!).isDirectory()) { + gamesystemFiles.push(... FileUtils.listFilesInDirectory(currentGamesystemFile!)) + } + } + + return unreferencedFiles; + } + + private findReferencedGamesystem(referencedName: string, gamesystems: StoreComponent[]): StoreComponent | undefined { + return gamesystems.find(gamesystem => + path.basename(gamesystem.fileName) === referencedName) + } + + private storeGamesystem(gamesystem: StoreComponent) { + const gamesystemFile = path.join(... gamesystem.fileName.split("/")) + const completeGamesystemFile = path.join(this.gamesystemRootDir, gamesystemFile) + FileUtils.prepareFileForWriting(completeGamesystemFile) + fs.writeFileSync(completeGamesystemFile + ".json", gamesystem.jsonString, 'utf-8') + } +} diff --git a/app/storage/storing/ScriptAccountStoring.js b/app/storage/storing/ScriptAccountStoring.js new file mode 100644 index 0000000..49b0eab --- /dev/null +++ b/app/storage/storing/ScriptAccountStoring.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ScriptAccountStorage = void 0; +const FileUtils_1 = require("../FileUtils"); +const path = require("node:path"); +const fs = require("fs"); +class ScriptAccountStorage { + constructor(scriptAccountDir) { + this.scriptAccountDir = scriptAccountDir; + } + storeScriptAccounts(scriptAccounts) { + this.persistDeletedScriptAccounts(scriptAccounts); + scriptAccounts.forEach(scriptAccount => { + this.storeScriptAccount(scriptAccount); + }); + } + persistDeletedScriptAccounts(existingScriptAccount) { + const scriptAccountFiles = FileUtils_1.FileUtils.listFilesInDirectory(this.scriptAccountDir); + scriptAccountFiles.forEach(scriptAccountFile => { + const scriptAccountFileName = path.parse(path.basename(scriptAccountFile)).name; + if (existingScriptAccount.find(scriptAccount => scriptAccount.fileName === scriptAccountFileName) == undefined) { + //No scriptAccountFile was found with that nae of the file. So the scriptAccount was deleted. Remove file + fs.unlinkSync(scriptAccountFile); + } + }); + } + storeScriptAccount(scriptAccount) { + const completeScriptAccountFile = path.join(this.scriptAccountDir, scriptAccount.fileName + ".json"); + fs.writeFileSync(completeScriptAccountFile, scriptAccount.jsonString, 'utf-8'); + } +} +exports.ScriptAccountStorage = ScriptAccountStorage; +//# sourceMappingURL=ScriptAccountStoring.js.map \ No newline at end of file diff --git a/app/storage/storing/ScriptAccountStoring.ts b/app/storage/storing/ScriptAccountStoring.ts new file mode 100644 index 0000000..6e73b17 --- /dev/null +++ b/app/storage/storing/ScriptAccountStoring.ts @@ -0,0 +1,36 @@ +import {StoreComponent} from "../StoreComponent"; +import {FileUtils} from "../FileUtils"; +import * as path from "node:path"; +import * as fs from "fs"; + +export class ScriptAccountStorage { + + private scriptAccountDir: string + + constructor(scriptAccountDir: string) { + this.scriptAccountDir = scriptAccountDir; + } + + storeScriptAccounts(scriptAccounts: StoreComponent[]) { + this.persistDeletedScriptAccounts(scriptAccounts) + scriptAccounts.forEach(scriptAccount => { + this.storeScriptAccount(scriptAccount) + }) + } + + private persistDeletedScriptAccounts(existingScriptAccount: StoreComponent[]) { + const scriptAccountFiles = FileUtils.listFilesInDirectory(this.scriptAccountDir); + scriptAccountFiles.forEach(scriptAccountFile => { + const scriptAccountFileName = path.parse(path.basename(scriptAccountFile)).name + if(existingScriptAccount.find(scriptAccount => scriptAccount.fileName === scriptAccountFileName) == undefined) { + //No scriptAccountFile was found with that nae of the file. So the scriptAccount was deleted. Remove file + fs.unlinkSync(scriptAccountFile) + } + }) + } + + private storeScriptAccount(scriptAccount: StoreComponent) { + const completeScriptAccountFile = path.join(this.scriptAccountDir, scriptAccount.fileName + ".json") + fs.writeFileSync(completeScriptAccountFile, scriptAccount.jsonString, 'utf-8') + } +} diff --git a/e2e/game-model/AddingGamesystems.spec.ts b/e2e/game-model/AddingGamesystems.spec.ts index 4d65fd0..9d6d13a 100644 --- a/e2e/game-model/AddingGamesystems.spec.ts +++ b/e2e/game-model/AddingGamesystems.spec.ts @@ -1,8 +1,8 @@ import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; import * as PATH from 'path'; -import {GameModel} from "../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; +import {GameModel} from "../../src/app/project/game-model/GameModel"; +import {Gamesystem} from "../../src/app/project/game-model/gamesystems/Gamesystem"; test.describe('Adding Gamesystems', () => { diff --git a/e2e/game-model/RemovingGamesystems.spec.ts b/e2e/game-model/RemovingGamesystems.spec.ts index e5777fe..0caa1e1 100644 --- a/e2e/game-model/RemovingGamesystems.spec.ts +++ b/e2e/game-model/RemovingGamesystems.spec.ts @@ -1,8 +1,9 @@ import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; import * as PATH from 'path'; -import {GameModel} from "../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; + +import {Gamesystem} from "../../src/app/project/game-model/gamesystems/Gamesystem"; +import {GameModel} from "../../src/app/project/game-model/GameModel"; test.describe('Removing Gamesystems', () => { diff --git a/e2e/game-model/gamesystems/CreateGamesystem.spec.ts b/e2e/game-model/gamesystems/CreateGamesystem.spec.ts index 84e01c5..fffea92 100644 --- a/e2e/game-model/gamesystems/CreateGamesystem.spec.ts +++ b/e2e/game-model/gamesystems/CreateGamesystem.spec.ts @@ -1,15 +1,6 @@ -import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; -import * as PATH from 'path'; -import {GameModel} from "../../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; -import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; -import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; -import exp = require("node:constants"); -import {end} from "electron-debug"; import {GamesystemTrainer} from "./GamesystemTrainer"; -import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem"; +import {ProductGamesystem} from "../../../src/app/project/game-model/gamesystems/ProductGamesystem"; test.describe('Test Create Gamesystems', () => { test('Test creating gamesystem with invalid name', async => { diff --git a/e2e/game-model/gamesystems/FindGamesystem.spec.ts b/e2e/game-model/gamesystems/FindGamesystem.spec.ts index 879717b..095432d 100644 --- a/e2e/game-model/gamesystems/FindGamesystem.spec.ts +++ b/e2e/game-model/gamesystems/FindGamesystem.spec.ts @@ -1,13 +1,6 @@ -import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; -import * as PATH from 'path'; -import {GameModel} from "../../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; -import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; -import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; -import exp = require("node:constants"); -import {end} from "electron-debug"; +import {GameModel} from "../../../src/app/project/game-model/GameModel"; +import {SimpleGamesystem} from "../../../src/app/project/game-model/gamesystems/SimpleGamesystem"; import {GamesystemTrainer} from "./GamesystemTrainer"; test.describe('Test Find Gamesystems', () => { const GAMEMODELNAME: string = "GameModel"; diff --git a/e2e/game-model/gamesystems/GamesystemTrainer.ts b/e2e/game-model/gamesystems/GamesystemTrainer.ts index 515882e..f70ce51 100644 --- a/e2e/game-model/gamesystems/GamesystemTrainer.ts +++ b/e2e/game-model/gamesystems/GamesystemTrainer.ts @@ -1,6 +1,6 @@ -import {GameModel} from "../../../src/app/game-model/GameModel"; -import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; -import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem"; +import {GameModel} from "../../../src/app/project/game-model/GameModel"; +import {SimpleGamesystem} from "../../../src/app/project/game-model/gamesystems/SimpleGamesystem"; +import {ProductGamesystem} from "../../../src/app/project/game-model/gamesystems/ProductGamesystem"; export class GamesystemTrainer { diff --git a/e2e/game-model/gamesystems/SimpleGamesystem.spec.ts b/e2e/game-model/gamesystems/SimpleGamesystem.spec.ts index 4c61efd..a47f181 100644 --- a/e2e/game-model/gamesystems/SimpleGamesystem.spec.ts +++ b/e2e/game-model/gamesystems/SimpleGamesystem.spec.ts @@ -1,13 +1,5 @@ -import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; -import * as PATH from 'path'; -import {GameModel} from "../../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; -import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; -import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; -import exp = require("node:constants"); -import {end} from "electron-debug"; +import {SimpleGamesystem} from "../../../src/app/project/game-model/gamesystems/SimpleGamesystem"; test.describe('Test SimpleGamesystem', () => { diff --git a/e2e/game-model/gamesystems/actions/AddActions.spec.ts b/e2e/game-model/gamesystems/actions/AddActions.spec.ts index 3e1fd12..19ea15e 100644 --- a/e2e/game-model/gamesystems/actions/AddActions.spec.ts +++ b/e2e/game-model/gamesystems/actions/AddActions.spec.ts @@ -2,8 +2,8 @@ import { test, expect } from '@playwright/test'; import {GamesystemTrainer} from "../GamesystemTrainer"; import {SimpleActionTrainer} from "./SimpleActionTrainer"; -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ScriptAccountAction} from "../../../../src/app/game-model/gamesystems/actions/ScriptAccountAction"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountAction} from "../../../../src/app/project/game-model/gamesystems/actions/ScriptAccountAction"; test.describe('Test Create SimpleActions', () => { test('Test creating gamesystem with invalid name', async => { diff --git a/e2e/game-model/gamesystems/actions/RemoveActions.spec.ts b/e2e/game-model/gamesystems/actions/RemoveActions.spec.ts index 931f7c9..40cd9a4 100644 --- a/e2e/game-model/gamesystems/actions/RemoveActions.spec.ts +++ b/e2e/game-model/gamesystems/actions/RemoveActions.spec.ts @@ -2,9 +2,9 @@ import { test, expect } from '@playwright/test'; import {GamesystemTrainer} from "../GamesystemTrainer"; import {SimpleActionTrainer} from "./SimpleActionTrainer"; -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ScriptAccountAction} from "../../../../src/app/game-model/gamesystems/actions/ScriptAccountAction"; -import {SimpleTransition} from "../../../../src/app/game-model/gamesystems/transitions/SimpleTransition"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountAction} from "../../../../src/app/project/game-model/gamesystems/actions/ScriptAccountAction"; +import {SimpleTransition} from "../../../../src/app/project/game-model/gamesystems/transitions/SimpleTransition"; test.describe('Test Remove SimpleActions', () => { test("Test Removing invalid Actions", async () => { diff --git a/e2e/game-model/gamesystems/actions/SimpleActionTrainer.ts b/e2e/game-model/gamesystems/actions/SimpleActionTrainer.ts index 219ae4d..1e0b7d3 100644 --- a/e2e/game-model/gamesystems/actions/SimpleActionTrainer.ts +++ b/e2e/game-model/gamesystems/actions/SimpleActionTrainer.ts @@ -1,8 +1,8 @@ -import {SimpleState} from "../../../../src/app/game-model/gamesystems/states/SimpleState"; -import {SimpleTransition} from "../../../../src/app/game-model/gamesystems/transitions/SimpleTransition"; +import {SimpleState} from "../../../../src/app/project/game-model/gamesystems/states/SimpleState"; +import {SimpleTransition} from "../../../../src/app/project/game-model/gamesystems/transitions/SimpleTransition"; import {Script} from "node:vm"; -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ScriptAccountAction} from "../../../../src/app/game-model/gamesystems/actions/ScriptAccountAction"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountAction} from "../../../../src/app/project/game-model/gamesystems/actions/ScriptAccountAction"; export class SimpleActionTrainer { static withEmptyActions() { diff --git a/e2e/game-model/gamesystems/conditions/AddTransitionConditions.spec.ts b/e2e/game-model/gamesystems/conditions/AddTransitionConditions.spec.ts index c9fb7a9..5cb1797 100644 --- a/e2e/game-model/gamesystems/conditions/AddTransitionConditions.spec.ts +++ b/e2e/game-model/gamesystems/conditions/AddTransitionConditions.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test'; -import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition"; -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; import exp = require("node:constants"); import {ConditionTrainer} from "./ConditionTrainer"; import {Conditional} from "@angular/compiler"; diff --git a/e2e/game-model/gamesystems/conditions/ConditionContradicting.spec.ts b/e2e/game-model/gamesystems/conditions/ConditionContradicting.spec.ts index 8a26afc..d71e5ef 100644 --- a/e2e/game-model/gamesystems/conditions/ConditionContradicting.spec.ts +++ b/e2e/game-model/gamesystems/conditions/ConditionContradicting.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test'; -import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition"; -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; import exp = require("node:constants"); import {ConditionTrainer} from "./ConditionTrainer"; import {Conditional} from "@angular/compiler"; diff --git a/e2e/game-model/gamesystems/conditions/ConditionCreation.spec.ts b/e2e/game-model/gamesystems/conditions/ConditionCreation.spec.ts index 9b1239c..112de84 100644 --- a/e2e/game-model/gamesystems/conditions/ConditionCreation.spec.ts +++ b/e2e/game-model/gamesystems/conditions/ConditionCreation.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test'; -import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition"; -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; import exp = require("node:constants"); test.describe('Test Create Gamesystems', () => { diff --git a/e2e/game-model/gamesystems/conditions/ConditionExpansion.spec.ts b/e2e/game-model/gamesystems/conditions/ConditionExpansion.spec.ts index d2b859c..bd5b2cb 100644 --- a/e2e/game-model/gamesystems/conditions/ConditionExpansion.spec.ts +++ b/e2e/game-model/gamesystems/conditions/ConditionExpansion.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test'; -import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition"; -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; import exp = require("node:constants"); import {ConditionTrainer} from "./ConditionTrainer"; test.describe('Test Expand Conditions', () => { diff --git a/e2e/game-model/gamesystems/conditions/ConditionTrainer.ts b/e2e/game-model/gamesystems/conditions/ConditionTrainer.ts index ea4587c..47718d3 100644 --- a/e2e/game-model/gamesystems/conditions/ConditionTrainer.ts +++ b/e2e/game-model/gamesystems/conditions/ConditionTrainer.ts @@ -1,5 +1,5 @@ -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition"; export class ConditionTrainer { static withSimpleCondition(): ScriptAccountCondition { diff --git a/e2e/game-model/gamesystems/conditions/TransitionConditionTrainer.ts b/e2e/game-model/gamesystems/conditions/TransitionConditionTrainer.ts index ba97347..7c94d20 100644 --- a/e2e/game-model/gamesystems/conditions/TransitionConditionTrainer.ts +++ b/e2e/game-model/gamesystems/conditions/TransitionConditionTrainer.ts @@ -1,7 +1,7 @@ -import {SimpleState} from "../../../../src/app/game-model/gamesystems/states/SimpleState"; -import {SimpleTransition} from "../../../../src/app/game-model/gamesystems/transitions/SimpleTransition"; -import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition"; +import {SimpleState} from "../../../../src/app/project/game-model/gamesystems/states/SimpleState"; +import {SimpleTransition} from "../../../../src/app/project/game-model/gamesystems/transitions/SimpleTransition"; +import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition"; export class TransitionConditionTrainer { static withTransitionWithoutConditions() { const startingState = new SimpleState("StartingState", ""); diff --git a/e2e/game-model/gamesystems/productGamesystems/CreateProductStates.spec.ts b/e2e/game-model/gamesystems/productGamesystems/CreateProductStates.spec.ts index 165f9c6..0e35828 100644 --- a/e2e/game-model/gamesystems/productGamesystems/CreateProductStates.spec.ts +++ b/e2e/game-model/gamesystems/productGamesystems/CreateProductStates.spec.ts @@ -1,17 +1,6 @@ -import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; -import * as PATH from 'path'; -import {GameModel} from "../../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; -import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; -import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; -import exp = require("node:constants"); -import {end} from "electron-debug"; -import {GamesystemTrainer} from "./GamesystemTrainer"; -import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem"; import {ProductStateTrainer} from "./ProductStateTrainer"; -import {SimpleState} from "../../../../src/app/game-model/gamesystems/states/SimpleState"; +import {SimpleState} from "../../../../src/app/project/game-model/gamesystems/states/SimpleState"; test.describe('Test Create ProductStates', () => { test("Adding already existent ProductState", async () => { diff --git a/e2e/game-model/gamesystems/productGamesystems/CreateProductTransitions.spec.ts b/e2e/game-model/gamesystems/productGamesystems/CreateProductTransitions.spec.ts index dd687f3..44b3dce 100644 --- a/e2e/game-model/gamesystems/productGamesystems/CreateProductTransitions.spec.ts +++ b/e2e/game-model/gamesystems/productGamesystems/CreateProductTransitions.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test'; import {ProductStateTrainer} from "./ProductStateTrainer"; -import {ProductState} from "../../../../src/app/game-model/gamesystems/states/ProductState"; -import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem"; +import {ProductState} from "../../../../src/app/project/game-model/gamesystems/states/ProductState"; +import {SimpleGamesystem} from "../../../../src/app/project/game-model/gamesystems/SimpleGamesystem"; test.describe('Test Create ProductTransitions', () => { test("Test ProductTransition Creation with invalid inputs", async ()=> { const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); diff --git a/e2e/game-model/gamesystems/productGamesystems/EqualInnerStates.spec.ts b/e2e/game-model/gamesystems/productGamesystems/EqualInnerStates.spec.ts index 5479bf2..070f5dc 100644 --- a/e2e/game-model/gamesystems/productGamesystems/EqualInnerStates.spec.ts +++ b/e2e/game-model/gamesystems/productGamesystems/EqualInnerStates.spec.ts @@ -1,17 +1,5 @@ -import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; -import * as PATH from 'path'; -import {GameModel} from "../../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; -import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; -import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; -import exp = require("node:constants"); -import {end} from "electron-debug"; -import {GamesystemTrainer} from "./GamesystemTrainer"; -import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem"; import {ProductStateTrainer} from "./ProductStateTrainer"; -import {SimpleState} from "../../../../src/app/game-model/gamesystems/states/SimpleState"; test.describe('Test Check Equal of Innerstates', () => { test("Test invalid input for equal checking", async()=> { diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts b/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts index 9e71230..d1ae17a 100644 --- a/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts +++ b/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts @@ -1,17 +1,4 @@ -import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; -import * as PATH from 'path'; -import {GameModel} from "../../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; -import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; -import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; -import exp = require("node:constants"); -import {end} from "electron-debug"; -import {GamesystemTrainer} from "./GamesystemTrainer"; -import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem"; -import {ProductStateTrainer} from "./ProductStateTrainer"; -import {SimpleState} from "../../../../src/app/game-model/gamesystems/states/SimpleState"; import {ProductSystemGenerationTrainer} from "./ProductSystemGenerationTrainer"; test.describe('Test Create ProductStates', () => { diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts b/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts index 797ad83..a9a2d9c 100644 --- a/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts +++ b/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts @@ -1,7 +1,7 @@ -import {ProductGamesystem} from "../../../../src/app/game-model/gamesystems/ProductGamesystem"; -import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem"; -import {ProductState} from "../../../../src/app/game-model/gamesystems/states/ProductState"; -import {ProductTransition} from "../../../../src/app/game-model/gamesystems/transitions/ProductTransition"; +import {ProductGamesystem} from "../../../../src/app/project/game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../../src/app/project/game-model/gamesystems/SimpleGamesystem"; +import {ProductState} from "../../../../src/app/project/game-model/gamesystems/states/ProductState"; +import {ProductTransition} from "../../../../src/app/project/game-model/gamesystems/transitions/ProductTransition"; export class ProductStateTrainer { static INNERSTATE_LETTER_1 = "A"; diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts b/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts index aa34557..2d6011e 100644 --- a/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts +++ b/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts @@ -1,5 +1,5 @@ -import {ProductGamesystem} from "../../../../src/app/game-model/gamesystems/ProductGamesystem"; -import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem"; +import {ProductGamesystem} from "../../../../src/app/project/game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../../src/app/project/game-model/gamesystems/SimpleGamesystem"; export class ProductSystemGenerationTrainer { diff --git a/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts b/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts index 00688ac..27aaed2 100644 --- a/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts +++ b/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts @@ -1,10 +1,10 @@ import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; import { test, expect } from '@playwright/test'; import * as PATH from 'path'; -import {GameModel} from "../../../src/app/game-model/GameModel"; -import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; -import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; -import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; +import {GameModel} from "../../../src/app/project/game-model/GameModel"; +import {Gamesystem} from "../../src/app/project/game-model/gamesystems/Gamesystem"; +import {ScriptAccount} from "../../../src/app/project/game-model/scriptAccounts/ScriptAccount"; +import {ModelComponentType} from "../../../src/app/project/game-model/ModelComponentType"; test.describe('Test ScriptAccounts', () => { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index cdc62e8..2467861 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,23 +1,25 @@ import {Component, NgZone, OnInit, ViewChild} from '@angular/core'; -import {ElectronService} from './core/services'; -import {APP_CONFIG} from '../environments/environment'; -import {ModelComponentType} from "./game-model/ModelComponentType"; import {MatDrawerContainer} from "@angular/material/sidenav"; -import {ModelComponentTypeUtillities} from "./game-model/ModelComponentTypeUtillities"; -import {GameModel} from "./game-model/GameModel"; import {EditorComponent} from "./editor/editor.component"; -import {ModelComponent} from "./game-model/ModelComponent"; import { ScriptAccountOverviewComponent } from "./side-overviews/script-account-overview/script-account-overview.component"; import {MatDialog} from "@angular/material/dialog"; import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component"; -import {ScriptAccount} from "./game-model/scriptAccounts/ScriptAccount"; import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component"; -import {LoadedProject} from "../../app/LoadedProject"; -import {ProcessLoadedProject} from "./game-model/fs/ProcessLoadedProject"; -import {StoreProject} from "./game-model/fs/store/StoreProject"; -import {Gamesystem} from "./game-model/gamesystems/Gamesystem"; +import {ModelComponentType} from "./project/game-model/ModelComponentType"; +import {ModelComponentTypeUtillities} from "./project/game-model/ModelComponentTypeUtillities"; +import {ScriptAccount} from "./project/game-model/scriptAccounts/ScriptAccount"; +import {Gamesystem} from "./project/game-model/gamesystems/Gamesystem"; +import {ModelComponent} from "./project/game-model/ModelComponent"; +import {GameModel} from "./project/game-model/GameModel"; +import {StoredGameModel} from "../../app/storage/StoredGameModel"; +import {GamesystemParser} from "./project/parser/gamesystemParser/GamesystemParser"; +import {ScriptAccountParser} from "./project/parser/ScriptAccountParser"; +import {ElectronService} from "./core/services"; +import {ScriptAccountSerializer} from "./project/serializer/ScriptAccountSerializer"; +import {StoreComponent} from "../../app/storage/StoreComponent"; +import {GamesystemSerializer} from "./project/serializer/GamesystemSerializer"; @Component({ selector: 'app-root', @@ -35,20 +37,10 @@ export class AppComponent implements OnInit{ gameModel: GameModel | undefined constructor(private electronService: ElectronService, - private zone: NgZone, - private dialog: MatDialog + private dialog: MatDialog, + private zone: NgZone ) { - console.log('APP_CONFIG', APP_CONFIG); - if(this.gameModel == undefined) { - this.gameModel = new GameModel("Unknown GameModel") - } - - if (electronService.isElectron) { - console.log(process.env); - console.log('Run in electron'); - console.log('Electron ipcRenderer', this.electronService.ipcRenderer); - console.log('NodeJS childProcess', this.electronService.childProcess); - + if(electronService.isElectron) { electronService.ipcRenderer.on('context-menu', (event: any, message: string) => { this.zone.run(() => { this.onContextMenuMessageRecieved(message); @@ -57,21 +49,18 @@ export class AppComponent implements OnInit{ electronService.ipcRenderer.on('get-project-data', (event: any, message: string) => { this.zone.run(() => { - this.saveGameModel(); + this.onSaveProject(); }) }) - electronService.ipcRenderer.on('open-project', (event: any, loadedProject: LoadedProject) => { - this.gameModel = ProcessLoadedProject.processLoadedProject(loadedProject) + electronService.ipcRenderer.on('open-project', (event: any, loadedProject: StoredGameModel) => { + this.zone.run(() => { + this.onLoadProject(loadedProject) + }) }) - } else { - console.log('Run in browser'); - } - } - saveGameModel() { - const storageModels = StoreProject.storeProject(this.gameModel!); - this.electronService.ipcRenderer.send('save-model', storageModels) + + } } onContextMenuMessageRecieved(message: string) { @@ -115,8 +104,10 @@ export class AppComponent implements OnInit{ if(res != undefined && res) { if(affectedModelComponent instanceof ScriptAccount) { this.gameModel!.removeScriptAccount(affectedModelComponent); + //this.electronService.ipcRenderer.send('delete-component', new DeleteModel(affectedModelComponent.componentName, ModelComponentType.SCRIPTACCOUNT)) } else if(affectedModelComponent instanceof Gamesystem) { this.gameModel!.removeGamesystem(affectedModelComponent); + //this.electronService.ipcRenderer.send('delete-component', new DeleteModel(affectedModelComponent.componentName, ModelComponentType.GAMESYTEM)) this.gamesystemOverview!.refresh() } } @@ -158,13 +149,13 @@ export class AppComponent implements OnInit{ private getSelectedModelComponent(): ModelComponent | undefined { if(this.openContent == ModelComponentType.SCRIPTACCOUNT) { if(this.scriptAccountOverview != undefined) { - return this.scriptAccountOverview!.selectedScriptAccount; + return this.scriptAccountOverview.selectedScriptAccount; } else { console.log("[WARN] [App.component] ScriptAccountOverview is undefined") } } else if(this.openContent == ModelComponentType.GAMESYTEM){ if(this.gamesystemOverview != undefined) { - return this.gamesystemOverview!.getSelectedGamesystem() + return this.gamesystemOverview.getSelectedGamesystem() } else { console.log("[WARN] [App.component] GamesystemOverview is undefined") } @@ -173,29 +164,36 @@ export class AppComponent implements OnInit{ } ngOnInit() { - /*this.gameModel = new GameModel("No More"); - this.gameModel.createScriptAccount("Temperature"); - this.gameModel.createScriptAccount("Luftfeuchtigkeit"); - const weather = new SimpleGamesystem("Weather"); - const season = new SimpleGamesystem("Season"); + } - const springState = season.createState("Spring", "Spring, also known as springtime, is one of the four temperate seasons, succeeding winter and preceding summer."); - const summerState = season.createState("Summer", "Summer is the hottest and brightest of the four temperate seasons, occurring after spring and before autumn. "); + onLoadProject(storedGameModel: StoredGameModel) { + const gameModel = new GameModel(storedGameModel.gameModelName) - const sunnyState = weather.createState("Sunny", "The sun is shining. No clouds, no rain, no storm."); - const rainingState = weather.createState("Raining", "It rains") + const scriptAccounts = ScriptAccountParser.parseScriptAccounts(storedGameModel.storedScriptAccounts); - season.createTransition(springState!, summerState!); - weather.createTransition(sunnyState!, rainingState!); + const gamesystemParser = new GamesystemParser(scriptAccounts); + const gamesystems = gamesystemParser.parseStoredGamesystems(storedGameModel.storedGamesystems); - const weather_season = new ProductGamesystem("Weather-Season"); - weather_season.addChildGamesystem(weather); - weather_season.addChildGamesystem(season); + gameModel.scriptAccounts = scriptAccounts + gameModel.gamesystems = gamesystems + gameModel.generateProductSystemContents() - weather_season.createState([springState!, sunnyState!]); + console.log(gameModel.scriptAccounts) - this.gameModel.addGamesystem(weather_season);*/ + this.gameModel = gameModel; + } + + onSaveProject() { + if(this.gameModel != undefined) { + const storedScriptAccounts = ScriptAccountSerializer.serializeScriptAccounts(this.gameModel.scriptAccounts) + const storedGamesystems: StoreComponent[] = GamesystemSerializer.serializeGamesystems(this.gameModel.gamesystems) + const storeModel = new StoredGameModel(this.gameModel.gameModelName, storedScriptAccounts, storedGamesystems) + + if(this.electronService.isElectron) { + this.electronService.ipcRenderer.send('save-model', storeModel) + } + } } openScriptAccountsOverview() { diff --git a/src/app/delete-confirmation-dialog/delete-confirmation-dialog.component.ts b/src/app/delete-confirmation-dialog/delete-confirmation-dialog.component.ts index 8eacb90..2f646ea 100644 --- a/src/app/delete-confirmation-dialog/delete-confirmation-dialog.component.ts +++ b/src/app/delete-confirmation-dialog/delete-confirmation-dialog.component.ts @@ -1,19 +1,24 @@ -import {Component, Inject} from '@angular/core'; +import {Component, Inject, OnInit} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import {ModelComponentTypeUtillities} from "../game-model/ModelComponentTypeUtillities"; -import {ModelComponent} from "../game-model/ModelComponent"; +import {ModelComponent} from "../project/game-model/ModelComponent"; +import {ModelComponentTypeUtillities} from "../project/game-model/ModelComponentTypeUtillities"; + @Component({ selector: 'app-delete-confirmation-dialog', templateUrl: './delete-confirmation-dialog.component.html', styleUrl: './delete-confirmation-dialog.component.scss' }) -export class DeleteConfirmationDialogComponent { +export class DeleteConfirmationDialogComponent implements OnInit{ constructor(private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public deleteModelComponent: ModelComponent) { } - protected readonly ModelComponentTypeUtillities = ModelComponentTypeUtillities; + + ngOnInit(): void { + console.log("delete Confirmation dialog here") + } + cancel() { this.dialogRef.close(false); @@ -22,4 +27,6 @@ export class DeleteConfirmationDialogComponent { confirmDelete() { this.dialogRef.close(true); } + + protected readonly ModelComponentTypeUtillities = ModelComponentTypeUtillities; } diff --git a/src/app/editor/editor.component.ts b/src/app/editor/editor.component.ts index a1e377f..887f4d8 100644 --- a/src/app/editor/editor.component.ts +++ b/src/app/editor/editor.component.ts @@ -1,11 +1,12 @@ import {Component, EventEmitter, Input, Output} from '@angular/core'; -import {GameModel} from "../game-model/GameModel"; -import {ModelComponent} from "../game-model/ModelComponent"; -import {ModelComponentType} from "../game-model/ModelComponentType"; -import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount"; -import {Gamesystem} from "../game-model/gamesystems/Gamesystem"; -import {State} from "../game-model/gamesystems/states/State"; -import {Transition} from "../game-model/gamesystems/transitions/Transition"; +import {ModelComponent} from "../project/game-model/ModelComponent"; +import {GameModel} from "../project/game-model/GameModel"; +import {ScriptAccount} from "../project/game-model/scriptAccounts/ScriptAccount"; +import {Gamesystem} from "../project/game-model/gamesystems/Gamesystem"; +import {State} from "../project/game-model/gamesystems/states/State"; +import {Transition} from "../project/game-model/gamesystems/transitions/Transition"; +import {ModelComponentType} from "../project/game-model/ModelComponentType"; + @Component({ selector: 'app-editor', @@ -43,9 +44,10 @@ export class EditorComponent { } } - protected readonly ModelComponentType = ModelComponentType; onModelNameUpdate() { this.onModelNameUpdateEmitter.emit(true); } + + protected readonly ModelComponentType = ModelComponentType; } diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts index a35cc1b..f14dda3 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts @@ -1,11 +1,10 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; -import {GameModel} from "../../game-model/GameModel"; -import {Gamesystem} from "../../game-model/gamesystems/Gamesystem"; -import {State} from "../../game-model/gamesystems/states/State"; -import {Transition} from "../../game-model/gamesystems/transitions/Transition"; -import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem"; -import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem"; -import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; +import {State} from "../../project/game-model/gamesystems/states/State"; +import {Gamesystem} from "../../project/game-model/gamesystems/Gamesystem"; +import { Transition } from '../../project/game-model/gamesystems/transitions/Transition'; +import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; +import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem"; +import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem"; @Component({ selector: 'app-gamesystem-editor', diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/LeafGamesystemCalculator.ts b/src/app/editor/gamesystem-editor/product-gamesystem-editor/LeafGamesystemCalculator.ts index d1951be..2d0c7d0 100644 --- a/src/app/editor/gamesystem-editor/product-gamesystem-editor/LeafGamesystemCalculator.ts +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/LeafGamesystemCalculator.ts @@ -1,9 +1,9 @@ -import {Gamesystem} from "../../../game-model/gamesystems/Gamesystem"; -import {SimpleGamesystem} from "../../../game-model/gamesystems/SimpleGamesystem"; -import {ProductGamesystem} from "../../../game-model/gamesystems/ProductGamesystem"; -import {State} from "../../../game-model/gamesystems/states/State"; -import {ProductState} from "../../../game-model/gamesystems/states/ProductState"; -import {SimpleState} from "../../../game-model/gamesystems/states/SimpleState"; +import {Gamesystem} from "../../../project/game-model/gamesystems/Gamesystem"; +import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem"; +import {ProductGamesystem} from "../../../project/game-model/gamesystems/ProductGamesystem"; +import {State} from "../../../project/game-model/gamesystems/states/State"; +import {SimpleState} from "../../../project/game-model/gamesystems/states/SimpleState"; +import {ProductState} from "../../../project/game-model/gamesystems/states/ProductState"; export class LeafGamesystemCalculator { diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts index eebcefd..d1f7f23 100644 --- a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts @@ -1,10 +1,9 @@ import {Component, EventEmitter, Input, Output} from '@angular/core'; -import {ProductGamesystem} from "../../../game-model/gamesystems/ProductGamesystem"; -import {ProductStateEditorComponent} from "../state-editor/product-state-editor/product-state-editor.component"; -import {SimpleGamesystem} from "../../../game-model/gamesystems/SimpleGamesystem"; import { ProductTransitionEditorComponent } from "../transition-editor/product-transition-editor/product-transition-editor.component"; +import {ProductGamesystem} from "../../../project/game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem"; diff --git a/src/app/editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component.ts b/src/app/editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component.ts index d93d81a..4eaeff9 100644 --- a/src/app/editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component.ts @@ -1,7 +1,7 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; -import {ScriptAccountCondition} from "../../../game-model/gamesystems/conditions/ScriptAccountCondition"; import {MatTableDataSource} from "@angular/material/table"; -import {ScriptAccount} from "../../../game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../project/game-model/gamesystems/conditions/ScriptAccountCondition"; +import {ScriptAccount} from "../../../project/game-model/scriptAccounts/ScriptAccount"; @Component({ selector: 'app-scriptaccount-condition-editor', diff --git a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.ts index 5baf0e9..36af424 100644 --- a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.ts +++ b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.ts @@ -1,7 +1,7 @@ import {Component, Input} from '@angular/core'; -import {SimpleGamesystem} from "../../../game-model/gamesystems/SimpleGamesystem"; import {MatTableDataSource} from "@angular/material/table"; -import {ScriptAccount} from "../../../game-model/scriptAccounts/ScriptAccount"; +import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem"; +import {ScriptAccount} from "../../../project/game-model/scriptAccounts/ScriptAccount"; @Component({ selector: 'app-simple-gamesystem-editor', diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts index a0b6afe..328928e 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts @@ -1,15 +1,13 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; -import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem"; -import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; import { MatTableDataSource } from "@angular/material/table"; -import {SimpleState} from "../../../../game-model/gamesystems/states/SimpleState"; -import {State} from "../../../../game-model/gamesystems/states/State"; import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; -import {ProductTransition} from "../../../../game-model/gamesystems/transitions/ProductTransition"; -import {ProductState} from "../../../../game-model/gamesystems/states/ProductState"; import {animate, state, style, transition, trigger} from "@angular/animations"; +import {ProductGamesystem} from "../../../../project/game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem"; +import {ProductState} from "../../../../project/game-model/gamesystems/states/ProductState"; +import {State} from "../../../../project/game-model/gamesystems/states/State"; @Component({ selector: 'app-product-state-editor', @@ -55,7 +53,6 @@ export class ProductStateEditorComponent implements OnInit{ }) } - protected readonly SimpleState = SimpleState; getLeafState(state: State, i: number) { return LeafGamesystemCalculator.calcLeafStates(state)[i]; diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts index 93dd0b1..049814c 100644 --- a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts +++ b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts @@ -1,13 +1,11 @@ import {Component, Input, OnInit} from '@angular/core'; -import {SimpleState} from "../../../../game-model/gamesystems/states/SimpleState"; import {MatTableDataSource} from "@angular/material/table"; import {animate, state, style, transition, trigger} from "@angular/animations"; import {MatSnackBar} from "@angular/material/snack-bar"; -import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; -import {ProductState} from "../../../../game-model/gamesystems/states/ProductState"; -import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; -import {ScriptAccount} from "../../../../game-model/scriptAccounts/ScriptAccount"; -import {ScriptAccountCondition} from "../../../../game-model/gamesystems/conditions/ScriptAccountCondition"; +import {SimpleState} from "../../../../project/game-model/gamesystems/states/SimpleState"; +import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem"; +import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition"; @Component({ selector: 'app-simple-state-editor', diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts index 741f8b6..2f164d6 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts @@ -1,13 +1,13 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; -import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem"; -import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; import { MatTableDataSource } from "@angular/material/table"; import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; -import {ProductTransition} from "../../../../game-model/gamesystems/transitions/ProductTransition"; -import {ProductState} from "../../../../game-model/gamesystems/states/ProductState"; import {animate, state, style, transition, trigger} from "@angular/animations"; +import {ProductGamesystem} from "../../../../project/game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem"; +import {ProductTransition} from "../../../../project/game-model/gamesystems/transitions/ProductTransition"; +import {ProductState} from "../../../../project/game-model/gamesystems/states/ProductState"; class DisplayedColumnName { displayedName: string internalName: string diff --git a/src/app/editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component.ts index b569ba1..e8392ee 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component.ts @@ -1,8 +1,8 @@ import {Component, Input, OnInit} from '@angular/core'; -import {Transition} from "../../../../game-model/gamesystems/transitions/Transition"; import {MatTableDataSource} from "@angular/material/table"; -import {ScriptAccountAction} from "../../../../game-model/gamesystems/actions/ScriptAccountAction"; -import {ScriptAccount} from "../../../../game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount"; +import {Transition} from "../../../../project/game-model/gamesystems/transitions/Transition"; +import {ScriptAccountAction} from "../../../../project/game-model/gamesystems/actions/ScriptAccountAction"; @Component({ selector: 'app-scriptaccount-action-editor', diff --git a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts index 4c0030e..d26acd6 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts @@ -1,13 +1,13 @@ import {Component, Input, OnInit} from '@angular/core'; -import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; import { MatTableDataSource } from "@angular/material/table"; -import {SimpleTransition} from "../../../../game-model/gamesystems/transitions/SimpleTransition"; import {animate, state, style, transition, trigger} from "@angular/animations"; -import {SimpleState} from "../../../../game-model/gamesystems/states/SimpleState"; -import {ScriptAccount} from "../../../../game-model/scriptAccounts/ScriptAccount"; -import {ScriptAccountCondition} from "../../../../game-model/gamesystems/conditions/ScriptAccountCondition"; +import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem"; +import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount"; +import {SimpleTransition} from "../../../../project/game-model/gamesystems/transitions/SimpleTransition"; +import {SimpleState} from "../../../../project/game-model/gamesystems/states/SimpleState"; +import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition"; @Component({ selector: 'app-simple-transition-editor', templateUrl: './simple-transition-editor.component.html', diff --git a/src/app/editor/model-component-editor/model-component-editor.component.ts b/src/app/editor/model-component-editor/model-component-editor.component.ts index c527bb5..a94547c 100644 --- a/src/app/editor/model-component-editor/model-component-editor.component.ts +++ b/src/app/editor/model-component-editor/model-component-editor.component.ts @@ -1,6 +1,6 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; -import {ModelComponent} from "../../game-model/ModelComponent"; import {FormControl, Validators} from "@angular/forms"; +import {ModelComponent} from "../../project/game-model/ModelComponent"; @Component({ selector: 'app-model-component-editor', diff --git a/src/app/editor/script-account-editor/script-account-editor.component.ts b/src/app/editor/script-account-editor/script-account-editor.component.ts index 4ee4a56..75670de 100644 --- a/src/app/editor/script-account-editor/script-account-editor.component.ts +++ b/src/app/editor/script-account-editor/script-account-editor.component.ts @@ -1,12 +1,12 @@ import {Component, Input, OnInit} from '@angular/core'; -import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; -import {ModelComponent} from "../../game-model/ModelComponent"; + import {MatFormField} from "@angular/material/form-field"; import {MatInput} from "@angular/material/input"; import {FormControl, FormGroupDirective, FormsModule, NgForm, Validators} from "@angular/forms"; import {NgIf} from "@angular/common"; import {ErrorStateMatcher} from "@angular/material/core"; import {ElectronService} from "../../core/services"; +import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; export class MyErrorStateMatcher implements ErrorStateMatcher { isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { diff --git a/src/app/game-model/GameModel.ts b/src/app/project/game-model/GameModel.ts similarity index 83% rename from src/app/game-model/GameModel.ts rename to src/app/project/game-model/GameModel.ts index ec53871..66dd46c 100644 --- a/src/app/game-model/GameModel.ts +++ b/src/app/project/game-model/GameModel.ts @@ -7,37 +7,27 @@ import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem"; import {StorageModel} from "./fs/StorageModel"; export class GameModel { - private readonly _gameModelName: string + gameModelName: string - private _gamesystems: Gamesystem[] = []; - private _scriptAccounts: ScriptAccount[] = []; + gamesystems: Gamesystem[] = []; + scriptAccounts: ScriptAccount[] = []; constructor(gameModelName: string) { - this._gameModelName = gameModelName; - } - get gameModelName(): string { - return this._gameModelName; - } - get gamesystems(): Gamesystem[] { - return this._gamesystems; - } - get scriptAccounts(): ScriptAccount[] { - return this._scriptAccounts; + this.gameModelName = gameModelName; } addGamesystem(gamesystem: Gamesystem) { if(this.findGamesystem(gamesystem.componentName) == undefined) { - this._gamesystems.push(gamesystem); + this.gamesystems.push(gamesystem); } } removeGamesystem(gamesystem : Gamesystem) { if(gamesystem.parentGamesystem == undefined) { - this._gamesystems = this._gamesystems.filter(g => g !== gamesystem); + this.gamesystems = this.gamesystems.filter(g => g !== gamesystem); } else { (gamesystem.parentGamesystem as ProductGamesystem).removeChildGamesystem(gamesystem); - console.log(gamesystem.parentGamesystem) } } @@ -77,7 +67,7 @@ export class GameModel { removeScriptAccount(scriptAccount: ScriptAccount) { if(scriptAccount != undefined) { - this._scriptAccounts = this.scriptAccounts.filter(s => s != scriptAccount); + this.scriptAccounts = this.scriptAccounts.filter(s => s != scriptAccount); } } @@ -99,4 +89,12 @@ export class GameModel { addScriptAccount(scriptAccount: ScriptAccount) { this.scriptAccounts.push(scriptAccount); } + + generateProductSystemContents() { + this.gamesystems.forEach(gamesystem => { + if(gamesystem instanceof ProductGamesystem) { + gamesystem.generateFromChildsystems(); + } + }) + } } diff --git a/src/app/game-model/ModelComponent.ts b/src/app/project/game-model/ModelComponent.ts similarity index 100% rename from src/app/game-model/ModelComponent.ts rename to src/app/project/game-model/ModelComponent.ts diff --git a/src/app/game-model/ModelComponentType.ts b/src/app/project/game-model/ModelComponentType.ts similarity index 100% rename from src/app/game-model/ModelComponentType.ts rename to src/app/project/game-model/ModelComponentType.ts diff --git a/src/app/game-model/ModelComponentTypeUtillities.ts b/src/app/project/game-model/ModelComponentTypeUtillities.ts similarity index 100% rename from src/app/game-model/ModelComponentTypeUtillities.ts rename to src/app/project/game-model/ModelComponentTypeUtillities.ts diff --git a/src/app/game-model/SaveComponent.ts b/src/app/project/game-model/SaveComponent.ts similarity index 100% rename from src/app/game-model/SaveComponent.ts rename to src/app/project/game-model/SaveComponent.ts diff --git a/src/app/project/game-model/fs/DeleteModel.ts b/src/app/project/game-model/fs/DeleteModel.ts new file mode 100644 index 0000000..186c583 --- /dev/null +++ b/src/app/project/game-model/fs/DeleteModel.ts @@ -0,0 +1,12 @@ +import {ModelComponentType} from "../ModelComponentType"; + +export class DeleteModel { + componentName: string + modeltype: ModelComponentType + + + constructor(componentName: string, modeltype: ModelComponentType) { + this.componentName = componentName; + this.modeltype = modeltype; + } +} diff --git a/src/app/game-model/fs/ProcessLoadedProject.ts b/src/app/project/game-model/fs/ProcessLoadedProject.ts similarity index 100% rename from src/app/game-model/fs/ProcessLoadedProject.ts rename to src/app/project/game-model/fs/ProcessLoadedProject.ts diff --git a/src/app/game-model/fs/StorageModel.ts b/src/app/project/game-model/fs/StorageModel.ts similarity index 100% rename from src/app/game-model/fs/StorageModel.ts rename to src/app/project/game-model/fs/StorageModel.ts diff --git a/src/app/game-model/fs/parser/ProductGamesystemParser.ts b/src/app/project/game-model/fs/parser/ProductGamesystemParser.ts similarity index 100% rename from src/app/game-model/fs/parser/ProductGamesystemParser.ts rename to src/app/project/game-model/fs/parser/ProductGamesystemParser.ts diff --git a/src/app/game-model/fs/parser/SimpleGamesystemParser.ts b/src/app/project/game-model/fs/parser/SimpleGamesystemParser.ts similarity index 100% rename from src/app/game-model/fs/parser/SimpleGamesystemParser.ts rename to src/app/project/game-model/fs/parser/SimpleGamesystemParser.ts diff --git a/src/app/game-model/fs/store/StoreProject.ts b/src/app/project/game-model/fs/store/StoreProject.ts similarity index 100% rename from src/app/game-model/fs/store/StoreProject.ts rename to src/app/project/game-model/fs/store/StoreProject.ts diff --git a/src/app/game-model/game-model.module.ts b/src/app/project/game-model/game-model.module.ts similarity index 100% rename from src/app/game-model/game-model.module.ts rename to src/app/project/game-model/game-model.module.ts diff --git a/src/app/game-model/gamesystems/Gamesystem.ts b/src/app/project/game-model/gamesystems/Gamesystem.ts similarity index 100% rename from src/app/game-model/gamesystems/Gamesystem.ts rename to src/app/project/game-model/gamesystems/Gamesystem.ts diff --git a/src/app/game-model/gamesystems/ProductGamesystem.ts b/src/app/project/game-model/gamesystems/ProductGamesystem.ts similarity index 99% rename from src/app/game-model/gamesystems/ProductGamesystem.ts rename to src/app/project/game-model/gamesystems/ProductGamesystem.ts index 087e019..83d73ec 100644 --- a/src/app/game-model/gamesystems/ProductGamesystem.ts +++ b/src/app/project/game-model/gamesystems/ProductGamesystem.ts @@ -6,7 +6,6 @@ import {Transition} from "./transitions/Transition"; import {SimpleState} from "./states/SimpleState"; import {SimpleGamesystem} from "./SimpleGamesystem"; import {GameModel} from "../GameModel"; -import {ProductStateTrainer} from "../../../../e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer"; import {ScriptAccountCondition} from "./conditions/ScriptAccountCondition"; import {ScriptAccountAction} from "./actions/ScriptAccountAction"; @@ -21,12 +20,14 @@ export class ProductGamesystem extends Gamesystem 0) { simpleGamesystem.componentName += "(Child)"; productGamesystem.addChildGamesystem(simpleGamesystem); + simpleGamesystem.parentGamesystem = productGamesystem } if(parentGamesystem != undefined) { parentGamesystem.removeChildGamesystem(simpleGamesystem); parentGamesystem.addChildGamesystem(productGamesystem); + productGamesystem.parentGamesystem = parentGamesystem } else { gameModel.removeGamesystem(simpleGamesystem); gameModel.addGamesystem(productGamesystem); diff --git a/src/app/game-model/gamesystems/SimpleGamesystem.ts b/src/app/project/game-model/gamesystems/SimpleGamesystem.ts similarity index 100% rename from src/app/game-model/gamesystems/SimpleGamesystem.ts rename to src/app/project/game-model/gamesystems/SimpleGamesystem.ts diff --git a/src/app/game-model/gamesystems/actions/ScriptAccountAction.ts b/src/app/project/game-model/gamesystems/actions/ScriptAccountAction.ts similarity index 100% rename from src/app/game-model/gamesystems/actions/ScriptAccountAction.ts rename to src/app/project/game-model/gamesystems/actions/ScriptAccountAction.ts diff --git a/src/app/game-model/gamesystems/conditions/ScriptAccountCondition.ts b/src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition.ts similarity index 100% rename from src/app/game-model/gamesystems/conditions/ScriptAccountCondition.ts rename to src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition.ts diff --git a/src/app/game-model/gamesystems/states/ProductState.ts b/src/app/project/game-model/gamesystems/states/ProductState.ts similarity index 100% rename from src/app/game-model/gamesystems/states/ProductState.ts rename to src/app/project/game-model/gamesystems/states/ProductState.ts diff --git a/src/app/game-model/gamesystems/states/SimpleState.ts b/src/app/project/game-model/gamesystems/states/SimpleState.ts similarity index 100% rename from src/app/game-model/gamesystems/states/SimpleState.ts rename to src/app/project/game-model/gamesystems/states/SimpleState.ts diff --git a/src/app/game-model/gamesystems/states/State.ts b/src/app/project/game-model/gamesystems/states/State.ts similarity index 100% rename from src/app/game-model/gamesystems/states/State.ts rename to src/app/project/game-model/gamesystems/states/State.ts diff --git a/src/app/game-model/gamesystems/transitions/ProductTransition.ts b/src/app/project/game-model/gamesystems/transitions/ProductTransition.ts similarity index 100% rename from src/app/game-model/gamesystems/transitions/ProductTransition.ts rename to src/app/project/game-model/gamesystems/transitions/ProductTransition.ts diff --git a/src/app/game-model/gamesystems/transitions/SimpleTransition.ts b/src/app/project/game-model/gamesystems/transitions/SimpleTransition.ts similarity index 100% rename from src/app/game-model/gamesystems/transitions/SimpleTransition.ts rename to src/app/project/game-model/gamesystems/transitions/SimpleTransition.ts diff --git a/src/app/game-model/gamesystems/transitions/Transition.ts b/src/app/project/game-model/gamesystems/transitions/Transition.ts similarity index 100% rename from src/app/game-model/gamesystems/transitions/Transition.ts rename to src/app/project/game-model/gamesystems/transitions/Transition.ts diff --git a/src/app/game-model/scriptAccounts/ScriptAccount.ts b/src/app/project/game-model/scriptAccounts/ScriptAccount.ts similarity index 100% rename from src/app/game-model/scriptAccounts/ScriptAccount.ts rename to src/app/project/game-model/scriptAccounts/ScriptAccount.ts diff --git a/src/app/project/parser/ScriptAccountParser.ts b/src/app/project/parser/ScriptAccountParser.ts new file mode 100644 index 0000000..72538c9 --- /dev/null +++ b/src/app/project/parser/ScriptAccountParser.ts @@ -0,0 +1,20 @@ +import {StoreComponent} from "../../../../app/storage/StoreComponent"; +import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount"; + +export class ScriptAccountParser { + + public static parseScriptAccounts(storedScriptAccounts: StoreComponent[]): ScriptAccount[] { + const scriptAccounts: ScriptAccount[] = [] + storedScriptAccounts.forEach(scriptAccount => { + scriptAccounts.push(this.parseScriptAccount(scriptAccount)) + }) + return scriptAccounts; + } + + private static parseScriptAccount(storedComponent: StoreComponent): ScriptAccount { + console.log("Parse ScriptAccount: ", storedComponent.fileName) + const parsedScriptAccount = new ScriptAccount("", ""); + Object.assign(parsedScriptAccount, JSON.parse(storedComponent.jsonString)); + return parsedScriptAccount; + } +} diff --git a/src/app/project/parser/gamesystemParser/GamesystemParser.ts b/src/app/project/parser/gamesystemParser/GamesystemParser.ts new file mode 100644 index 0000000..e085bba --- /dev/null +++ b/src/app/project/parser/gamesystemParser/GamesystemParser.ts @@ -0,0 +1,87 @@ +import {StoreComponent} from "../../../../../app/storage/StoreComponent"; +import {Gamesystem} from "../../game-model/gamesystems/Gamesystem"; +import {ParsedParentGamesystems} from "./ParsedParentGamesystems"; +import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem"; +import {StateParser} from "./StateParser"; +import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; +import {TransitionParser} from "./TransitionParser"; + +export class GamesystemParser { + + private parsedParentGamesystems: ParsedParentGamesystems[] = [] + private parsedGamesystems: Gamesystem[] = [] + + private scriptAccounts: ScriptAccount[] + + + constructor(scriptAccounts: ScriptAccount[]) { + this.scriptAccounts = scriptAccounts; + } + + + public parseStoredGamesystems(storedGamesystems: StoreComponent[]): Gamesystem[] { + storedGamesystems.forEach(storedGamesystem => { + this.parseGamesystem(storedGamesystem) + }) + + return this.computeGamesystemStructure(); + } + + private parseGamesystem(storedGamesystem: StoreComponent) { + const parsedGamesystemData = JSON.parse(storedGamesystem.jsonString) + let parsedSystem: Gamesystem + if(parsedGamesystemData.childsystems != undefined) { + parsedSystem = this.parseProductGamesystem(parsedGamesystemData) + } else { + parsedSystem = this.parseSimpleGamesystem(parsedGamesystemData) + } + this.parsedGamesystems.push(parsedSystem); + } + + parseSimpleGamesystem(gamesystemData: any): SimpleGamesystem { + const simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription) + + const stateParser = new StateParser(this.scriptAccounts); + simpleGamesystem.states = stateParser.parseStates(gamesystemData.states) + + const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts) + simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions) + return simpleGamesystem + } + + parseProductGamesystem(gamesystemData: any) { + const productGamesystem = new ProductGamesystem(gamesystemData.componentName, gamesystemData.componentDescription); + const childsystemNames: string[] = [] + for(let i=0; i[] { + const topGamesystems: Gamesystem[] = [] + this.parsedGamesystems.forEach(parsedGamesystem => { + const searchedParentsystem = this.findParentsystem(parsedGamesystem.componentName) + if(searchedParentsystem != undefined) { + searchedParentsystem.addChildGamesystem(parsedGamesystem) + parsedGamesystem.parentGamesystem = searchedParentsystem + } else { + topGamesystems.push(parsedGamesystem) + } + }) + return topGamesystems + } + + findParentsystem(childsystemName: string) { + for(let i=0; i scriptAccount.componentName === scriptAccountName); + } +} diff --git a/src/app/project/parser/gamesystemParser/StateParser.ts b/src/app/project/parser/gamesystemParser/StateParser.ts new file mode 100644 index 0000000..8da602a --- /dev/null +++ b/src/app/project/parser/gamesystemParser/StateParser.ts @@ -0,0 +1,39 @@ +import {SimpleState} from "../../game-model/gamesystems/states/SimpleState"; +import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../game-model/gamesystems/conditions/ScriptAccountCondition"; +import {ScriptAccountConditionParser} from "./ScriptAccountConditionParser"; + +export class StateParser { + + private conditionParser + + + constructor(scriptAccounts: ScriptAccount[]) { + this.conditionParser = new ScriptAccountConditionParser(scriptAccounts) + } + + public parseStates(stateData: any): SimpleState[] { + const parsedStates: SimpleState[] = [] + for(let i=0; i state.stateLabel === stateLabel); + } +} diff --git a/src/app/project/serializer/GamesystemSerializer.ts b/src/app/project/serializer/GamesystemSerializer.ts new file mode 100644 index 0000000..d071a0b --- /dev/null +++ b/src/app/project/serializer/GamesystemSerializer.ts @@ -0,0 +1,109 @@ +import {Gamesystem} from "../game-model/gamesystems/Gamesystem"; +import {StoreComponent} from "../../../../app/storage/StoreComponent"; +import {SimpleGamesystem} from "../game-model/gamesystems/SimpleGamesystem"; +import {ProductGamesystem} from "../game-model/gamesystems/ProductGamesystem"; +import {SerializeConstants} from "./SerializeConstants"; +import {ModelComponentType} from "../game-model/ModelComponentType"; + +export class GamesystemSerializer { + + private static IGNORED_SIMPLE_ATTRIBUTES = ["parentGamesystem", 'incomingTransitions', "outgoingTransitions", "unsaved", "type"] + + public static serializeGamesystems(gamesystems: Gamesystem[]): StoreComponent[] { + let storedGamesystems: StoreComponent[] = [] + gamesystems.forEach(gamesystem => storedGamesystems = storedGamesystems.concat(this.serializeSingleGamesystem(gamesystem))) + return storedGamesystems + } + + private static serializeSingleGamesystem(gamesystem: Gamesystem): StoreComponent[] { + if(gamesystem instanceof SimpleGamesystem) { + console.log("Simple Gamesystem") + return [this.serializeSimpleGamesystem(gamesystem as SimpleGamesystem)] + } else { + return this.serializeProductGamesystem(gamesystem as ProductGamesystem) + } + } + + private static serializeSimpleGamesystem(simpleGamesystem: SimpleGamesystem): StoreComponent { + const fileName = this.computeSimpleGamesystemPath(simpleGamesystem); + if(simpleGamesystem.componentName === "Weather(Child)") { + console.log(fileName) + } + const jsonString = JSON.stringify(simpleGamesystem, (key, value) => { + + if(this.IGNORED_SIMPLE_ATTRIBUTES.includes(key)) { + return undefined + } else if(key === 'startingState' || key === 'endingState') { + return value.stateLabel + } else if(key === 'scriptAccount') { + return value.componentName + } else { + return value; + } + }, SerializeConstants.JSON_INDENT) + + return new StoreComponent(jsonString, fileName, ModelComponentType.GAMESYTEM) + } + + private static serializeProductGamesystem(productGamesystem: ProductGamesystem): StoreComponent[] { + const storedGamesystems: StoreComponent[] = [] + + const fileName = this.computeProductGamesystemPath(productGamesystem) + const innerGamesystemJsonArray: {'componentName': string}[] = [] + productGamesystem.innerGamesystems.forEach(innerGamesystem => { + innerGamesystemJsonArray.push({ + 'componentName': innerGamesystem.componentName + }) + + const storedChildsystems = this.serializeSingleGamesystem(innerGamesystem); + storedChildsystems.forEach(storedChildsystem => storedGamesystems.push(storedChildsystem)) + }) + + const jsonString = { + 'componentName': productGamesystem.componentName, + 'componentDescription': productGamesystem.componentDescription, + 'childsystems': innerGamesystemJsonArray + } + + const storedProductsystem = new StoreComponent(JSON.stringify(jsonString), fileName, ModelComponentType.GAMESYTEM) + storedGamesystems.push(storedProductsystem) + + return storedGamesystems; + } + + private static computeSimpleGamesystemPath(simpleGamesystem: SimpleGamesystem): string { + if(simpleGamesystem.parentGamesystem == undefined) { + return simpleGamesystem.componentName + } else { + const pathElements: string[] = [simpleGamesystem.componentName] + let currentGamesystem: ProductGamesystem | undefined = simpleGamesystem.parentGamesystem + while(currentGamesystem != undefined) { + pathElements.unshift(currentGamesystem.componentName) + currentGamesystem = currentGamesystem.parentGamesystem + } + let output = "" + for(let i=0; i storeComponents.push(this.serializeSingleScriptAccount(scriptAccount))) + return storeComponents; + } + + private static serializeSingleScriptAccount(scriptAccount: ScriptAccount): StoreComponent { + const fileName = scriptAccount.componentName + const jsonString = JSON.stringify(scriptAccount, (key, value) => { + if(key === 'unsaved' || key === 'type') { + return undefined + } else { + return value; + } + }, SerializeConstants.JSON_INDENT) + return new StoreComponent(jsonString, fileName, ModelComponentType.SCRIPTACCOUNT); + } +} diff --git a/src/app/project/serializer/SerializeConstants.ts b/src/app/project/serializer/SerializeConstants.ts new file mode 100644 index 0000000..cc7e432 --- /dev/null +++ b/src/app/project/serializer/SerializeConstants.ts @@ -0,0 +1,3 @@ +export class SerializeConstants { + public static JSON_INDENT = 4 +} diff --git a/src/app/side-overviews/gamescript-overview/gamescript-overview.component.ts b/src/app/side-overviews/gamescript-overview/gamescript-overview.component.ts index a3341ac..3194a5f 100644 --- a/src/app/side-overviews/gamescript-overview/gamescript-overview.component.ts +++ b/src/app/side-overviews/gamescript-overview/gamescript-overview.component.ts @@ -1,13 +1,13 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; -import {Gamesystem} from "../../game-model/gamesystems/Gamesystem"; -import {State} from "../../game-model/gamesystems/states/State"; -import {Transition} from "../../game-model/gamesystems/transitions/Transition"; -import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem"; import {FlatTreeControl} from "@angular/cdk/tree"; import {MatTreeFlatDataSource, MatTreeFlattener} from "@angular/material/tree"; -import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem"; -import {GameModel} from "../../game-model/GameModel"; import {ElectronService} from "../../core/services"; +import {GameModel} from "../../project/game-model/GameModel"; +import {Gamesystem} from "../../project/game-model/gamesystems/Gamesystem"; +import {State} from "../../project/game-model/gamesystems/states/State"; +import {Transition} from "../../project/game-model/gamesystems/transitions/Transition"; +import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem"; interface FlatNode { diff --git a/src/app/side-overviews/script-account-overview/script-account-overview.component.ts b/src/app/side-overviews/script-account-overview/script-account-overview.component.ts index f0d15da..3643289 100644 --- a/src/app/side-overviews/script-account-overview/script-account-overview.component.ts +++ b/src/app/side-overviews/script-account-overview/script-account-overview.component.ts @@ -1,7 +1,7 @@ import {Component, EventEmitter, Input, NgZone, Output} from '@angular/core'; -import {GameModel} from "../../game-model/GameModel"; -import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; import {ElectronService} from "../../core/services"; +import {GameModel} from "../../project/game-model/GameModel"; +import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; @Component({ selector: 'app-script-account-overview', diff --git a/testModel/gamesystems/ParentTestSystem/A.json b/testModel/gamesystems/ParentTestSystem/A.json deleted file mode 100644 index 6db8a9c..0000000 --- a/testModel/gamesystems/ParentTestSystem/A.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "componentName": "A", - "componentDescription": "", - "states": [ - { - "initial": false, - "conditions": [], - "stateLabel": "A", - "stateDescription": "" - }, - { - "initial": false, - "conditions": [], - "stateLabel": "B", - "stateDescription": "" - } - ], - "transitions": [ - { - "scriptAccountActions": [], - "scriptAccountConditions": [ - { - "scriptAccount": "Temperature", - "minValue": 0, - "maxValue": "10" - } - ], - "startingState": "A", - "endingState": "B" - } - ] -} \ No newline at end of file diff --git a/testModel/gamesystems/ParentTestSystem/Numbers.json b/testModel/gamesystems/ParentTestSystem/Numbers.json deleted file mode 100644 index 546a507..0000000 --- a/testModel/gamesystems/ParentTestSystem/Numbers.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "componentName": "Numbers", - "componentDescription": "", - "states": [ - { - "initial": false, - "conditions": [], - "stateLabel": "1", - "stateDescription": "" - }, - { - "initial": false, - "conditions": [ - { - "scriptAccount": "Luftfeuchtigkeit", - "minValue": 0, - "maxValue": "5" - } - ], - "stateLabel": "2", - "stateDescription": "" - } - ], - "transitions": [ - { - "scriptAccountActions": [], - "scriptAccountConditions": [], - "startingState": "1", - "endingState": "2" - } - ] -} \ No newline at end of file diff --git a/testModel/gamesystems/ParentTestSystem/ParentTestSystem.json b/testModel/gamesystems/ParentTestSystem/ParentTestSystem.json deleted file mode 100644 index 0572a4c..0000000 --- a/testModel/gamesystems/ParentTestSystem/ParentTestSystem.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "componentName": "ParentTestSystem", - "componentDescription": "" -} \ No newline at end of file diff --git a/testModel/gamesystems/Weathersystem/Weathersystem.json b/testModel/gamesystems/Weathersystem/Weathersystem.json index 4a0733a..47d644a 100644 --- a/testModel/gamesystems/Weathersystem/Weathersystem.json +++ b/testModel/gamesystems/Weathersystem/Weathersystem.json @@ -1,4 +1,12 @@ { "componentName": "Weathersystem", - "componentDescription": "Ein Wettersystem, dass sich aus normalem Wetter (Sonne, Regen, Wolke, Schnee, Sturm etc.) und zusätzlich den Jahreszeiten (Frühling, Sommer, Herbst, Winter, etc.) zusammensetzt." + "componentDescription": "Ein Wettersystem, dass sich aus normalem Wetter (Sonne, Regen, Wolke, Schnee, Sturm etc.) und zusätzlich den Jahreszeiten (Frühling, Sommer, Herbst, Winter, etc.) zusammensetzt.", + "childsystems": [ + { + "componentName": "Season" + }, + { + "componentName": "Weather" + } + ] } \ No newline at end of file diff --git a/testModel/script-accounts/New ScriptAccount.json b/testModel/script-accounts/New ScriptAccount.json new file mode 100644 index 0000000..c4a4176 --- /dev/null +++ b/testModel/script-accounts/New ScriptAccount.json @@ -0,0 +1,6 @@ +{ + "componentName": "New ScriptAccount", + "componentDescription": "", + "minValue": 0, + "maxValue": 100 +} \ No newline at end of file diff --git a/testModel/script-accounts/Temperature.json b/testModel/script-accounts/Temperature.json index 53db39d..91a3a6c 100644 --- a/testModel/script-accounts/Temperature.json +++ b/testModel/script-accounts/Temperature.json @@ -1,6 +1,6 @@ { "componentName": "Temperature", "componentDescription": "", - "minValue": -50, - "maxValue": 70 + "minValue": -30, + "maxValue": 50 } \ No newline at end of file