Merge branch 'issue-17' into issue-15
All checks were successful
E2E Testing / test (push) Successful in 1m37s
All checks were successful
E2E Testing / test (push) Successful in 1m37s
This commit is contained in:
commit
679cb70487
@ -3,7 +3,8 @@
|
|||||||
"ignorePatterns": [
|
"ignorePatterns": [
|
||||||
"app/**/*", // ignore nodeJs files
|
"app/**/*", // ignore nodeJs files
|
||||||
"dist/**/*",
|
"dist/**/*",
|
||||||
"release/**/*"
|
"release/**/*",
|
||||||
|
"src/**/*"
|
||||||
],
|
],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
42
app/main.ts
42
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 path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import {json} from "node:stream/consumers";
|
import {GameModelLoader} from "./storage/loader/GameModelLoader";
|
||||||
import {StorageModel} from "../src/app/game-model/fs/StorageModel";
|
import {StoredGameModel} from "./storage/StoredGameModel";
|
||||||
import {SaveProject} from "./SaveProject";
|
import {ScriptAccountStorage} from "./storage/storing/ScriptAccountStoring";
|
||||||
|
import {ModelComponentFileDirectory} from "./storage/ModelComponentFileDirectory";
|
||||||
|
import {GamesystemStorage} from "./storage/storing/GamesystemStorage";
|
||||||
|
|
||||||
let win: BrowserWindow | null = null;
|
let win: BrowserWindow | null = null;
|
||||||
const args = process.argv.slice(1),
|
const args = process.argv.slice(1),
|
||||||
@ -94,11 +96,15 @@ function createWindow(): BrowserWindow {
|
|||||||
contextMenu.popup({ window: win!, x: params.x, y: params.y });
|
contextMenu.popup({ window: win!, x: params.x, y: params.y });
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('save-model', (event, storageModels: StorageModel[]) => {
|
ipcMain.on('save-model', (event, storedGameModel: StoredGameModel) => {
|
||||||
console.log("Save Model")
|
recieveGameModelToStore(storedGameModel)
|
||||||
SaveProject.saveProject(projectDirectory, storageModels);
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/*ipcMain.on('delete-component', (event, deletedComponent: DeleteModel) => {
|
||||||
|
console.log("Delete Model: ", deletedComponent)
|
||||||
|
deleteComponent(deletedComponent);
|
||||||
|
})*/
|
||||||
|
|
||||||
const menuTemplate = [
|
const menuTemplate = [
|
||||||
{
|
{
|
||||||
label: 'File',
|
label: 'File',
|
||||||
@ -126,7 +132,6 @@ function createWindow(): BrowserWindow {
|
|||||||
]
|
]
|
||||||
const menu = Menu.buildFromTemplate(menuTemplate);
|
const menu = Menu.buildFromTemplate(menuTemplate);
|
||||||
Menu.setApplicationMenu(menu)
|
Menu.setApplicationMenu(menu)
|
||||||
loadDevProjectAtStart()
|
|
||||||
|
|
||||||
win.webContents.on('did-finish-load', () => {
|
win.webContents.on('did-finish-load', () => {
|
||||||
loadDevProjectAtStart()
|
loadDevProjectAtStart()
|
||||||
@ -199,11 +204,28 @@ function loadDevProjectAtStart() {
|
|||||||
|
|
||||||
function openProjectFromFile(openProjectDir: string) {
|
function openProjectFromFile(openProjectDir: string) {
|
||||||
projectDirectory = openProjectDir
|
projectDirectory = openProjectDir
|
||||||
console.log("Open Project-Directory: ", openProjectDir)
|
const gameModelLoader = new GameModelLoader(openProjectDir);
|
||||||
const loadedProject = SaveProject.loadProject(openProjectDir)
|
const loadedProject = gameModelLoader.loadGameModel();
|
||||||
win!.webContents.send("open-project", loadedProject)
|
win!.webContents.send("open-project", loadedProject)
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveProject() {
|
function saveProject() {
|
||||||
win!.webContents.send('get-project-data')
|
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);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
34
app/storage/FileUtils.js
Normal file
34
app/storage/FileUtils.js
Normal file
@ -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
|
33
app/storage/FileUtils.ts
Normal file
33
app/storage/FileUtils.ts
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
11
app/storage/ModelComponentFileDirectory.js
Normal file
11
app/storage/ModelComponentFileDirectory.js
Normal file
@ -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
|
6
app/storage/ModelComponentFileDirectory.ts
Normal file
6
app/storage/ModelComponentFileDirectory.ts
Normal file
@ -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";
|
||||||
|
}
|
12
app/storage/StoreComponent.js
Normal file
12
app/storage/StoreComponent.js
Normal file
@ -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
|
13
app/storage/StoreComponent.ts
Normal file
13
app/storage/StoreComponent.ts
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
12
app/storage/StoredGameModel.js
Normal file
12
app/storage/StoredGameModel.js
Normal file
@ -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
|
15
app/storage/StoredGameModel.ts
Normal file
15
app/storage/StoredGameModel.ts
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
31
app/storage/loader/GameModelLoader.js
Normal file
31
app/storage/loader/GameModelLoader.js
Normal file
@ -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
|
42
app/storage/loader/GameModelLoader.ts
Normal file
42
app/storage/loader/GameModelLoader.ts
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
41
app/storage/loader/GamesystemLoader.js
Normal file
41
app/storage/loader/GamesystemLoader.js
Normal file
@ -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
|
44
app/storage/loader/GamesystemLoader.ts
Normal file
44
app/storage/loader/GamesystemLoader.ts
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
app/storage/loader/ScriptAccountLoader.js
Normal file
31
app/storage/loader/ScriptAccountLoader.js
Normal file
@ -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
|
34
app/storage/loader/ScriptAccountLoader.ts
Normal file
34
app/storage/loader/ScriptAccountLoader.ts
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
57
app/storage/storing/GamesystemStorage.js
Normal file
57
app/storage/storing/GamesystemStorage.js
Normal file
@ -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
|
64
app/storage/storing/GamesystemStorage.ts
Normal file
64
app/storage/storing/GamesystemStorage.ts
Normal file
@ -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')
|
||||||
|
}
|
||||||
|
}
|
33
app/storage/storing/ScriptAccountStoring.js
Normal file
33
app/storage/storing/ScriptAccountStoring.js
Normal file
@ -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
|
36
app/storage/storing/ScriptAccountStoring.ts
Normal file
36
app/storage/storing/ScriptAccountStoring.ts
Normal file
@ -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')
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import * as PATH from 'path';
|
import * as PATH from 'path';
|
||||||
import {GameModel} from "../../src/app/game-model/GameModel";
|
import {GameModel} from "../../src/app/project/game-model/GameModel";
|
||||||
import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem";
|
import {Gamesystem} from "../../src/app/project/game-model/gamesystems/Gamesystem";
|
||||||
|
|
||||||
test.describe('Adding Gamesystems', () => {
|
test.describe('Adding Gamesystems', () => {
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import * as PATH from 'path';
|
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', () => {
|
test.describe('Removing Gamesystems', () => {
|
||||||
|
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
|
||||||
import { test, expect } from '@playwright/test';
|
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 {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.describe('Test Create Gamesystems', () => {
|
||||||
|
|
||||||
test('Test creating gamesystem with invalid name', async => {
|
test('Test creating gamesystem with invalid name', async => {
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import * as PATH from 'path';
|
import {GameModel} from "../../../src/app/project/game-model/GameModel";
|
||||||
import {GameModel} from "../../../src/app/game-model/GameModel";
|
import {SimpleGamesystem} from "../../../src/app/project/game-model/gamesystems/SimpleGamesystem";
|
||||||
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 {GamesystemTrainer} from "./GamesystemTrainer";
|
||||||
test.describe('Test Find Gamesystems', () => {
|
test.describe('Test Find Gamesystems', () => {
|
||||||
const GAMEMODELNAME: string = "GameModel";
|
const GAMEMODELNAME: string = "GameModel";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {GameModel} from "../../../src/app/game-model/GameModel";
|
import {GameModel} from "../../../src/app/project/game-model/GameModel";
|
||||||
import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../../src/app/project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../../../src/app/project/game-model/gamesystems/ProductGamesystem";
|
||||||
|
|
||||||
export class GamesystemTrainer {
|
export class GamesystemTrainer {
|
||||||
|
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import * as PATH from 'path';
|
import {SimpleGamesystem} from "../../../src/app/project/game-model/gamesystems/SimpleGamesystem";
|
||||||
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";
|
|
||||||
|
|
||||||
test.describe('Test SimpleGamesystem', () => {
|
test.describe('Test SimpleGamesystem', () => {
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import {GamesystemTrainer} from "../GamesystemTrainer";
|
import {GamesystemTrainer} from "../GamesystemTrainer";
|
||||||
import {SimpleActionTrainer} from "./SimpleActionTrainer";
|
import {SimpleActionTrainer} from "./SimpleActionTrainer";
|
||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccountAction} from "../../../../src/app/game-model/gamesystems/actions/ScriptAccountAction";
|
import {ScriptAccountAction} from "../../../../src/app/project/game-model/gamesystems/actions/ScriptAccountAction";
|
||||||
test.describe('Test Create SimpleActions', () => {
|
test.describe('Test Create SimpleActions', () => {
|
||||||
|
|
||||||
test('Test creating gamesystem with invalid name', async => {
|
test('Test creating gamesystem with invalid name', async => {
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import {GamesystemTrainer} from "../GamesystemTrainer";
|
import {GamesystemTrainer} from "../GamesystemTrainer";
|
||||||
import {SimpleActionTrainer} from "./SimpleActionTrainer";
|
import {SimpleActionTrainer} from "./SimpleActionTrainer";
|
||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccountAction} from "../../../../src/app/game-model/gamesystems/actions/ScriptAccountAction";
|
import {ScriptAccountAction} from "../../../../src/app/project/game-model/gamesystems/actions/ScriptAccountAction";
|
||||||
import {SimpleTransition} from "../../../../src/app/game-model/gamesystems/transitions/SimpleTransition";
|
import {SimpleTransition} from "../../../../src/app/project/game-model/gamesystems/transitions/SimpleTransition";
|
||||||
test.describe('Test Remove SimpleActions', () => {
|
test.describe('Test Remove SimpleActions', () => {
|
||||||
|
|
||||||
test("Test Removing invalid Actions", async () => {
|
test("Test Removing invalid Actions", async () => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {SimpleState} from "../../../../src/app/game-model/gamesystems/states/SimpleState";
|
import {SimpleState} from "../../../../src/app/project/game-model/gamesystems/states/SimpleState";
|
||||||
import {SimpleTransition} from "../../../../src/app/game-model/gamesystems/transitions/SimpleTransition";
|
import {SimpleTransition} from "../../../../src/app/project/game-model/gamesystems/transitions/SimpleTransition";
|
||||||
import {Script} from "node:vm";
|
import {Script} from "node:vm";
|
||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccountAction} from "../../../../src/app/game-model/gamesystems/actions/ScriptAccountAction";
|
import {ScriptAccountAction} from "../../../../src/app/project/game-model/gamesystems/actions/ScriptAccountAction";
|
||||||
|
|
||||||
export class SimpleActionTrainer {
|
export class SimpleActionTrainer {
|
||||||
static withEmptyActions() {
|
static withEmptyActions() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import exp = require("node:constants");
|
import exp = require("node:constants");
|
||||||
import {ConditionTrainer} from "./ConditionTrainer";
|
import {ConditionTrainer} from "./ConditionTrainer";
|
||||||
import {Conditional} from "@angular/compiler";
|
import {Conditional} from "@angular/compiler";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import exp = require("node:constants");
|
import exp = require("node:constants");
|
||||||
import {ConditionTrainer} from "./ConditionTrainer";
|
import {ConditionTrainer} from "./ConditionTrainer";
|
||||||
import {Conditional} from "@angular/compiler";
|
import {Conditional} from "@angular/compiler";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import exp = require("node:constants");
|
import exp = require("node:constants");
|
||||||
test.describe('Test Create Gamesystems', () => {
|
test.describe('Test Create Gamesystems', () => {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import exp = require("node:constants");
|
import exp = require("node:constants");
|
||||||
import {ConditionTrainer} from "./ConditionTrainer";
|
import {ConditionTrainer} from "./ConditionTrainer";
|
||||||
test.describe('Test Expand Conditions', () => {
|
test.describe('Test Expand Conditions', () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
|
|
||||||
export class ConditionTrainer {
|
export class ConditionTrainer {
|
||||||
static withSimpleCondition(): ScriptAccountCondition {
|
static withSimpleCondition(): ScriptAccountCondition {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {SimpleState} from "../../../../src/app/game-model/gamesystems/states/SimpleState";
|
import {SimpleState} from "../../../../src/app/project/game-model/gamesystems/states/SimpleState";
|
||||||
import {SimpleTransition} from "../../../../src/app/game-model/gamesystems/transitions/SimpleTransition";
|
import {SimpleTransition} from "../../../../src/app/project/game-model/gamesystems/transitions/SimpleTransition";
|
||||||
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
export class TransitionConditionTrainer {
|
export class TransitionConditionTrainer {
|
||||||
static withTransitionWithoutConditions() {
|
static withTransitionWithoutConditions() {
|
||||||
const startingState = new SimpleState("StartingState", "");
|
const startingState = new SimpleState("StartingState", "");
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
|
||||||
import { test, expect } from '@playwright/test';
|
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 {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.describe('Test Create ProductStates', () => {
|
||||||
|
|
||||||
test("Adding already existent ProductState", async () => {
|
test("Adding already existent ProductState", async () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import {ProductStateTrainer} from "./ProductStateTrainer";
|
import {ProductStateTrainer} from "./ProductStateTrainer";
|
||||||
import {ProductState} from "../../../../src/app/game-model/gamesystems/states/ProductState";
|
import {ProductState} from "../../../../src/app/project/game-model/gamesystems/states/ProductState";
|
||||||
import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../../../src/app/project/game-model/gamesystems/SimpleGamesystem";
|
||||||
test.describe('Test Create ProductTransitions', () => {
|
test.describe('Test Create ProductTransitions', () => {
|
||||||
test("Test ProductTransition Creation with invalid inputs", async ()=> {
|
test("Test ProductTransition Creation with invalid inputs", async ()=> {
|
||||||
const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates();
|
const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates();
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
|
||||||
import { test, expect } from '@playwright/test';
|
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 {ProductStateTrainer} from "./ProductStateTrainer";
|
||||||
import {SimpleState} from "../../../../src/app/game-model/gamesystems/states/SimpleState";
|
|
||||||
test.describe('Test Check Equal of Innerstates', () => {
|
test.describe('Test Check Equal of Innerstates', () => {
|
||||||
|
|
||||||
test("Test invalid input for equal checking", async()=> {
|
test("Test invalid input for equal checking", async()=> {
|
||||||
|
@ -1,17 +1,4 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
|
||||||
import { test, expect } from '@playwright/test';
|
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";
|
import {ProductSystemGenerationTrainer} from "./ProductSystemGenerationTrainer";
|
||||||
test.describe('Test Create ProductStates', () => {
|
test.describe('Test Create ProductStates', () => {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {ProductGamesystem} from "../../../../src/app/game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../../../../src/app/project/game-model/gamesystems/ProductGamesystem";
|
||||||
import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../../../src/app/project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ProductState} from "../../../../src/app/game-model/gamesystems/states/ProductState";
|
import {ProductState} from "../../../../src/app/project/game-model/gamesystems/states/ProductState";
|
||||||
import {ProductTransition} from "../../../../src/app/game-model/gamesystems/transitions/ProductTransition";
|
import {ProductTransition} from "../../../../src/app/project/game-model/gamesystems/transitions/ProductTransition";
|
||||||
|
|
||||||
export class ProductStateTrainer {
|
export class ProductStateTrainer {
|
||||||
static INNERSTATE_LETTER_1 = "A";
|
static INNERSTATE_LETTER_1 = "A";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {ProductGamesystem} from "../../../../src/app/game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../../../../src/app/project/game-model/gamesystems/ProductGamesystem";
|
||||||
import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../../../src/app/project/game-model/gamesystems/SimpleGamesystem";
|
||||||
|
|
||||||
export class ProductSystemGenerationTrainer {
|
export class ProductSystemGenerationTrainer {
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import * as PATH from 'path';
|
import * as PATH from 'path';
|
||||||
import {GameModel} from "../../../src/app/game-model/GameModel";
|
import {GameModel} from "../../../src/app/project/game-model/GameModel";
|
||||||
import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem";
|
import {Gamesystem} from "../../src/app/project/game-model/gamesystems/Gamesystem";
|
||||||
import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType";
|
import {ModelComponentType} from "../../../src/app/project/game-model/ModelComponentType";
|
||||||
|
|
||||||
test.describe('Test ScriptAccounts', () => {
|
test.describe('Test ScriptAccounts', () => {
|
||||||
|
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
import {Component, NgZone, OnInit, ViewChild} from '@angular/core';
|
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 {MatDrawerContainer} from "@angular/material/sidenav";
|
||||||
import {ModelComponentTypeUtillities} from "./game-model/ModelComponentTypeUtillities";
|
|
||||||
import {GameModel} from "./game-model/GameModel";
|
|
||||||
import {EditorComponent} from "./editor/editor.component";
|
import {EditorComponent} from "./editor/editor.component";
|
||||||
import {ModelComponent} from "./game-model/ModelComponent";
|
|
||||||
import {
|
import {
|
||||||
ScriptAccountOverviewComponent
|
ScriptAccountOverviewComponent
|
||||||
} from "./side-overviews/script-account-overview/script-account-overview.component";
|
} from "./side-overviews/script-account-overview/script-account-overview.component";
|
||||||
import {MatDialog} from "@angular/material/dialog";
|
import {MatDialog} from "@angular/material/dialog";
|
||||||
import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component";
|
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 {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component";
|
||||||
import {LoadedProject} from "../../app/LoadedProject";
|
import {ModelComponentType} from "./project/game-model/ModelComponentType";
|
||||||
import {ProcessLoadedProject} from "./game-model/fs/ProcessLoadedProject";
|
import {ModelComponentTypeUtillities} from "./project/game-model/ModelComponentTypeUtillities";
|
||||||
import {StoreProject} from "./game-model/fs/store/StoreProject";
|
import {ScriptAccount} from "./project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {Gamesystem} from "./game-model/gamesystems/Gamesystem";
|
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({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -35,20 +37,10 @@ export class AppComponent implements OnInit{
|
|||||||
gameModel: GameModel | undefined
|
gameModel: GameModel | undefined
|
||||||
|
|
||||||
constructor(private electronService: ElectronService,
|
constructor(private electronService: ElectronService,
|
||||||
private zone: NgZone,
|
private dialog: MatDialog,
|
||||||
private dialog: MatDialog
|
private zone: NgZone
|
||||||
) {
|
) {
|
||||||
console.log('APP_CONFIG', APP_CONFIG);
|
if(electronService.isElectron) {
|
||||||
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);
|
|
||||||
|
|
||||||
electronService.ipcRenderer.on('context-menu', (event: any, message: string) => {
|
electronService.ipcRenderer.on('context-menu', (event: any, message: string) => {
|
||||||
this.zone.run(() => {
|
this.zone.run(() => {
|
||||||
this.onContextMenuMessageRecieved(message);
|
this.onContextMenuMessageRecieved(message);
|
||||||
@ -57,21 +49,18 @@ export class AppComponent implements OnInit{
|
|||||||
|
|
||||||
electronService.ipcRenderer.on('get-project-data', (event: any, message: string) => {
|
electronService.ipcRenderer.on('get-project-data', (event: any, message: string) => {
|
||||||
this.zone.run(() => {
|
this.zone.run(() => {
|
||||||
this.saveGameModel();
|
this.onSaveProject();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
electronService.ipcRenderer.on('open-project', (event: any, loadedProject: LoadedProject) => {
|
electronService.ipcRenderer.on('open-project', (event: any, loadedProject: StoredGameModel) => {
|
||||||
this.gameModel = ProcessLoadedProject.processLoadedProject(loadedProject)
|
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) {
|
onContextMenuMessageRecieved(message: string) {
|
||||||
@ -115,8 +104,10 @@ export class AppComponent implements OnInit{
|
|||||||
if(res != undefined && res) {
|
if(res != undefined && res) {
|
||||||
if(affectedModelComponent instanceof ScriptAccount) {
|
if(affectedModelComponent instanceof ScriptAccount) {
|
||||||
this.gameModel!.removeScriptAccount(affectedModelComponent);
|
this.gameModel!.removeScriptAccount(affectedModelComponent);
|
||||||
|
//this.electronService.ipcRenderer.send('delete-component', new DeleteModel(affectedModelComponent.componentName, ModelComponentType.SCRIPTACCOUNT))
|
||||||
} else if(affectedModelComponent instanceof Gamesystem) {
|
} else if(affectedModelComponent instanceof Gamesystem) {
|
||||||
this.gameModel!.removeGamesystem(affectedModelComponent);
|
this.gameModel!.removeGamesystem(affectedModelComponent);
|
||||||
|
//this.electronService.ipcRenderer.send('delete-component', new DeleteModel(affectedModelComponent.componentName, ModelComponentType.GAMESYTEM))
|
||||||
this.gamesystemOverview!.refresh()
|
this.gamesystemOverview!.refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,13 +149,13 @@ export class AppComponent implements OnInit{
|
|||||||
private getSelectedModelComponent(): ModelComponent | undefined {
|
private getSelectedModelComponent(): ModelComponent | undefined {
|
||||||
if(this.openContent == ModelComponentType.SCRIPTACCOUNT) {
|
if(this.openContent == ModelComponentType.SCRIPTACCOUNT) {
|
||||||
if(this.scriptAccountOverview != undefined) {
|
if(this.scriptAccountOverview != undefined) {
|
||||||
return this.scriptAccountOverview!.selectedScriptAccount;
|
return this.scriptAccountOverview.selectedScriptAccount;
|
||||||
} else {
|
} else {
|
||||||
console.log("[WARN] [App.component] ScriptAccountOverview is undefined")
|
console.log("[WARN] [App.component] ScriptAccountOverview is undefined")
|
||||||
}
|
}
|
||||||
} else if(this.openContent == ModelComponentType.GAMESYTEM){
|
} else if(this.openContent == ModelComponentType.GAMESYTEM){
|
||||||
if(this.gamesystemOverview != undefined) {
|
if(this.gamesystemOverview != undefined) {
|
||||||
return this.gamesystemOverview!.getSelectedGamesystem()
|
return this.gamesystemOverview.getSelectedGamesystem()
|
||||||
} else {
|
} else {
|
||||||
console.log("[WARN] [App.component] GamesystemOverview is undefined")
|
console.log("[WARN] [App.component] GamesystemOverview is undefined")
|
||||||
}
|
}
|
||||||
@ -173,29 +164,36 @@ export class AppComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
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.");
|
onLoadProject(storedGameModel: StoredGameModel) {
|
||||||
const summerState = season.createState("Summer", "Summer is the hottest and brightest of the four temperate seasons, occurring after spring and before autumn. ");
|
const gameModel = new GameModel(storedGameModel.gameModelName)
|
||||||
|
|
||||||
const sunnyState = weather.createState("Sunny", "The sun is shining. No clouds, no rain, no storm.");
|
const scriptAccounts = ScriptAccountParser.parseScriptAccounts(storedGameModel.storedScriptAccounts);
|
||||||
const rainingState = weather.createState("Raining", "It rains")
|
|
||||||
|
|
||||||
season.createTransition(springState!, summerState!);
|
const gamesystemParser = new GamesystemParser(scriptAccounts);
|
||||||
weather.createTransition(sunnyState!, rainingState!);
|
const gamesystems = gamesystemParser.parseStoredGamesystems(storedGameModel.storedGamesystems);
|
||||||
|
|
||||||
const weather_season = new ProductGamesystem("Weather-Season");
|
gameModel.scriptAccounts = scriptAccounts
|
||||||
weather_season.addChildGamesystem(weather);
|
gameModel.gamesystems = gamesystems
|
||||||
weather_season.addChildGamesystem(season);
|
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() {
|
openScriptAccountsOverview() {
|
||||||
|
@ -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 {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||||
import {ModelComponentTypeUtillities} from "../game-model/ModelComponentTypeUtillities";
|
import {ModelComponent} from "../project/game-model/ModelComponent";
|
||||||
import {ModelComponent} from "../game-model/ModelComponent";
|
import {ModelComponentTypeUtillities} from "../project/game-model/ModelComponentTypeUtillities";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-delete-confirmation-dialog',
|
selector: 'app-delete-confirmation-dialog',
|
||||||
templateUrl: './delete-confirmation-dialog.component.html',
|
templateUrl: './delete-confirmation-dialog.component.html',
|
||||||
styleUrl: './delete-confirmation-dialog.component.scss'
|
styleUrl: './delete-confirmation-dialog.component.scss'
|
||||||
})
|
})
|
||||||
export class DeleteConfirmationDialogComponent {
|
export class DeleteConfirmationDialogComponent implements OnInit{
|
||||||
|
|
||||||
constructor(private dialogRef: MatDialogRef<DeleteConfirmationDialogComponent>,
|
constructor(private dialogRef: MatDialogRef<DeleteConfirmationDialogComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public deleteModelComponent: ModelComponent) {
|
@Inject(MAT_DIALOG_DATA) public deleteModelComponent: ModelComponent) {
|
||||||
}
|
}
|
||||||
protected readonly ModelComponentTypeUtillities = ModelComponentTypeUtillities;
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
console.log("delete Confirmation dialog here")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.dialogRef.close(false);
|
this.dialogRef.close(false);
|
||||||
@ -22,4 +27,6 @@ export class DeleteConfirmationDialogComponent {
|
|||||||
confirmDelete() {
|
confirmDelete() {
|
||||||
this.dialogRef.close(true);
|
this.dialogRef.close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected readonly ModelComponentTypeUtillities = ModelComponentTypeUtillities;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||||
import {GameModel} from "../game-model/GameModel";
|
import {ModelComponent} from "../project/game-model/ModelComponent";
|
||||||
import {ModelComponent} from "../game-model/ModelComponent";
|
import {GameModel} from "../project/game-model/GameModel";
|
||||||
import {ModelComponentType} from "../game-model/ModelComponentType";
|
import {ScriptAccount} from "../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount";
|
import {Gamesystem} from "../project/game-model/gamesystems/Gamesystem";
|
||||||
import {Gamesystem} from "../game-model/gamesystems/Gamesystem";
|
import {State} from "../project/game-model/gamesystems/states/State";
|
||||||
import {State} from "../game-model/gamesystems/states/State";
|
import {Transition} from "../project/game-model/gamesystems/transitions/Transition";
|
||||||
import {Transition} from "../game-model/gamesystems/transitions/Transition";
|
import {ModelComponentType} from "../project/game-model/ModelComponentType";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-editor',
|
selector: 'app-editor',
|
||||||
@ -43,9 +44,10 @@ export class EditorComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly ModelComponentType = ModelComponentType;
|
|
||||||
|
|
||||||
onModelNameUpdate() {
|
onModelNameUpdate() {
|
||||||
this.onModelNameUpdateEmitter.emit(true);
|
this.onModelNameUpdateEmitter.emit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected readonly ModelComponentType = ModelComponentType;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||||
import {GameModel} from "../../game-model/GameModel";
|
import {State} from "../../project/game-model/gamesystems/states/State";
|
||||||
import {Gamesystem} from "../../game-model/gamesystems/Gamesystem";
|
import {Gamesystem} from "../../project/game-model/gamesystems/Gamesystem";
|
||||||
import {State} from "../../game-model/gamesystems/states/State";
|
import { Transition } from '../../project/game-model/gamesystems/transitions/Transition';
|
||||||
import {Transition} from "../../game-model/gamesystems/transitions/Transition";
|
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
|
||||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gamesystem-editor',
|
selector: 'app-gamesystem-editor',
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {Gamesystem} from "../../../game-model/gamesystems/Gamesystem";
|
import {Gamesystem} from "../../../project/game-model/gamesystems/Gamesystem";
|
||||||
import {SimpleGamesystem} from "../../../game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ProductGamesystem} from "../../../game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../../../project/game-model/gamesystems/ProductGamesystem";
|
||||||
import {State} from "../../../game-model/gamesystems/states/State";
|
import {State} from "../../../project/game-model/gamesystems/states/State";
|
||||||
import {ProductState} from "../../../game-model/gamesystems/states/ProductState";
|
import {SimpleState} from "../../../project/game-model/gamesystems/states/SimpleState";
|
||||||
import {SimpleState} from "../../../game-model/gamesystems/states/SimpleState";
|
import {ProductState} from "../../../project/game-model/gamesystems/states/ProductState";
|
||||||
|
|
||||||
export class LeafGamesystemCalculator {
|
export class LeafGamesystemCalculator {
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
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 {
|
import {
|
||||||
ProductTransitionEditorComponent
|
ProductTransitionEditorComponent
|
||||||
} from "../transition-editor/product-transition-editor/product-transition-editor.component";
|
} 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";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||||
import {ScriptAccountCondition} from "../../../game-model/gamesystems/conditions/ScriptAccountCondition";
|
|
||||||
import {MatTableDataSource} from "@angular/material/table";
|
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({
|
@Component({
|
||||||
selector: 'app-scriptaccount-condition-editor',
|
selector: 'app-scriptaccount-condition-editor',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {SimpleGamesystem} from "../../../game-model/gamesystems/SimpleGamesystem";
|
|
||||||
import {MatTableDataSource} from "@angular/material/table";
|
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({
|
@Component({
|
||||||
selector: 'app-simple-gamesystem-editor',
|
selector: 'app-simple-gamesystem-editor',
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||||
import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem";
|
|
||||||
import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem";
|
|
||||||
import {
|
import {
|
||||||
MatTableDataSource
|
MatTableDataSource
|
||||||
} from "@angular/material/table";
|
} 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 {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 {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({
|
@Component({
|
||||||
selector: 'app-product-state-editor',
|
selector: 'app-product-state-editor',
|
||||||
@ -55,7 +53,6 @@ export class ProductStateEditorComponent implements OnInit{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly SimpleState = SimpleState;
|
|
||||||
|
|
||||||
getLeafState(state: State<any>, i: number) {
|
getLeafState(state: State<any>, i: number) {
|
||||||
return LeafGamesystemCalculator.calcLeafStates(state)[i];
|
return LeafGamesystemCalculator.calcLeafStates(state)[i];
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {SimpleState} from "../../../../game-model/gamesystems/states/SimpleState";
|
|
||||||
import {MatTableDataSource} from "@angular/material/table";
|
import {MatTableDataSource} from "@angular/material/table";
|
||||||
import {animate, state, style, transition, trigger} from "@angular/animations";
|
import {animate, state, style, transition, trigger} from "@angular/animations";
|
||||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem";
|
import {SimpleState} from "../../../../project/game-model/gamesystems/states/SimpleState";
|
||||||
import {ProductState} from "../../../../game-model/gamesystems/states/ProductState";
|
import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator";
|
import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccount} from "../../../../game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
import {ScriptAccountCondition} from "../../../../game-model/gamesystems/conditions/ScriptAccountCondition";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-simple-state-editor',
|
selector: 'app-simple-state-editor',
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||||
import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem";
|
|
||||||
import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem";
|
|
||||||
import {
|
import {
|
||||||
MatTableDataSource
|
MatTableDataSource
|
||||||
} from "@angular/material/table";
|
} from "@angular/material/table";
|
||||||
import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator";
|
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 {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 {
|
class DisplayedColumnName {
|
||||||
displayedName: string
|
displayedName: string
|
||||||
internalName: string
|
internalName: string
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {Transition} from "../../../../game-model/gamesystems/transitions/Transition";
|
|
||||||
import {MatTableDataSource} from "@angular/material/table";
|
import {MatTableDataSource} from "@angular/material/table";
|
||||||
import {ScriptAccountAction} from "../../../../game-model/gamesystems/actions/ScriptAccountAction";
|
import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccount} from "../../../../game-model/scriptAccounts/ScriptAccount";
|
import {Transition} from "../../../../project/game-model/gamesystems/transitions/Transition";
|
||||||
|
import {ScriptAccountAction} from "../../../../project/game-model/gamesystems/actions/ScriptAccountAction";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-scriptaccount-action-editor',
|
selector: 'app-scriptaccount-action-editor',
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem";
|
|
||||||
import {
|
import {
|
||||||
MatTableDataSource
|
MatTableDataSource
|
||||||
} from "@angular/material/table";
|
} from "@angular/material/table";
|
||||||
import {SimpleTransition} from "../../../../game-model/gamesystems/transitions/SimpleTransition";
|
|
||||||
import {animate, state, style, transition, trigger} from "@angular/animations";
|
import {animate, state, style, transition, trigger} from "@angular/animations";
|
||||||
import {SimpleState} from "../../../../game-model/gamesystems/states/SimpleState";
|
import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ScriptAccount} from "../../../../game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccountCondition} from "../../../../game-model/gamesystems/conditions/ScriptAccountCondition";
|
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({
|
@Component({
|
||||||
selector: 'app-simple-transition-editor',
|
selector: 'app-simple-transition-editor',
|
||||||
templateUrl: './simple-transition-editor.component.html',
|
templateUrl: './simple-transition-editor.component.html',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||||
import {ModelComponent} from "../../game-model/ModelComponent";
|
|
||||||
import {FormControl, Validators} from "@angular/forms";
|
import {FormControl, Validators} from "@angular/forms";
|
||||||
|
import {ModelComponent} from "../../project/game-model/ModelComponent";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-model-component-editor',
|
selector: 'app-model-component-editor',
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
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 {MatFormField} from "@angular/material/form-field";
|
||||||
import {MatInput} from "@angular/material/input";
|
import {MatInput} from "@angular/material/input";
|
||||||
import {FormControl, FormGroupDirective, FormsModule, NgForm, Validators} from "@angular/forms";
|
import {FormControl, FormGroupDirective, FormsModule, NgForm, Validators} from "@angular/forms";
|
||||||
import {NgIf} from "@angular/common";
|
import {NgIf} from "@angular/common";
|
||||||
import {ErrorStateMatcher} from "@angular/material/core";
|
import {ErrorStateMatcher} from "@angular/material/core";
|
||||||
import {ElectronService} from "../../core/services";
|
import {ElectronService} from "../../core/services";
|
||||||
|
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
|
|
||||||
export class MyErrorStateMatcher implements ErrorStateMatcher {
|
export class MyErrorStateMatcher implements ErrorStateMatcher {
|
||||||
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
||||||
|
@ -7,37 +7,27 @@ import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem";
|
|||||||
import {StorageModel} from "./fs/StorageModel";
|
import {StorageModel} from "./fs/StorageModel";
|
||||||
|
|
||||||
export class GameModel {
|
export class GameModel {
|
||||||
private readonly _gameModelName: string
|
gameModelName: string
|
||||||
|
|
||||||
private _gamesystems: Gamesystem<any, any>[] = [];
|
gamesystems: Gamesystem<any, any>[] = [];
|
||||||
private _scriptAccounts: ScriptAccount[] = [];
|
scriptAccounts: ScriptAccount[] = [];
|
||||||
|
|
||||||
constructor(gameModelName: string) {
|
constructor(gameModelName: string) {
|
||||||
this._gameModelName = gameModelName;
|
this.gameModelName = gameModelName;
|
||||||
}
|
|
||||||
get gameModelName(): string {
|
|
||||||
return this._gameModelName;
|
|
||||||
}
|
|
||||||
get gamesystems(): Gamesystem<any, any>[] {
|
|
||||||
return this._gamesystems;
|
|
||||||
}
|
|
||||||
get scriptAccounts(): ScriptAccount[] {
|
|
||||||
return this._scriptAccounts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addGamesystem(gamesystem: Gamesystem<any, any>) {
|
addGamesystem(gamesystem: Gamesystem<any, any>) {
|
||||||
if(this.findGamesystem(gamesystem.componentName) == undefined) {
|
if(this.findGamesystem(gamesystem.componentName) == undefined) {
|
||||||
this._gamesystems.push(gamesystem);
|
this.gamesystems.push(gamesystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeGamesystem(gamesystem : Gamesystem<any, any>) {
|
removeGamesystem(gamesystem : Gamesystem<any, any>) {
|
||||||
if(gamesystem.parentGamesystem == undefined) {
|
if(gamesystem.parentGamesystem == undefined) {
|
||||||
this._gamesystems = this._gamesystems.filter(g => g !== gamesystem);
|
this.gamesystems = this.gamesystems.filter(g => g !== gamesystem);
|
||||||
} else {
|
} else {
|
||||||
(gamesystem.parentGamesystem as ProductGamesystem).removeChildGamesystem(gamesystem);
|
(gamesystem.parentGamesystem as ProductGamesystem).removeChildGamesystem(gamesystem);
|
||||||
console.log(gamesystem.parentGamesystem)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +67,7 @@ export class GameModel {
|
|||||||
|
|
||||||
removeScriptAccount(scriptAccount: ScriptAccount) {
|
removeScriptAccount(scriptAccount: ScriptAccount) {
|
||||||
if(scriptAccount != undefined) {
|
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) {
|
addScriptAccount(scriptAccount: ScriptAccount) {
|
||||||
this.scriptAccounts.push(scriptAccount);
|
this.scriptAccounts.push(scriptAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateProductSystemContents() {
|
||||||
|
this.gamesystems.forEach(gamesystem => {
|
||||||
|
if(gamesystem instanceof ProductGamesystem) {
|
||||||
|
gamesystem.generateFromChildsystems();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
12
src/app/project/game-model/fs/DeleteModel.ts
Normal file
12
src/app/project/game-model/fs/DeleteModel.ts
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,6 @@ import {Transition} from "./transitions/Transition";
|
|||||||
import {SimpleState} from "./states/SimpleState";
|
import {SimpleState} from "./states/SimpleState";
|
||||||
import {SimpleGamesystem} from "./SimpleGamesystem";
|
import {SimpleGamesystem} from "./SimpleGamesystem";
|
||||||
import {GameModel} from "../GameModel";
|
import {GameModel} from "../GameModel";
|
||||||
import {ProductStateTrainer} from "../../../../e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer";
|
|
||||||
import {ScriptAccountCondition} from "./conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "./conditions/ScriptAccountCondition";
|
||||||
import {ScriptAccountAction} from "./actions/ScriptAccountAction";
|
import {ScriptAccountAction} from "./actions/ScriptAccountAction";
|
||||||
|
|
||||||
@ -21,12 +20,14 @@ export class ProductGamesystem extends Gamesystem<ProductState, ProductTransitio
|
|||||||
if(simpleGamesystem.states.length > 0) {
|
if(simpleGamesystem.states.length > 0) {
|
||||||
simpleGamesystem.componentName += "(Child)";
|
simpleGamesystem.componentName += "(Child)";
|
||||||
productGamesystem.addChildGamesystem(simpleGamesystem);
|
productGamesystem.addChildGamesystem(simpleGamesystem);
|
||||||
|
simpleGamesystem.parentGamesystem = productGamesystem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(parentGamesystem != undefined) {
|
if(parentGamesystem != undefined) {
|
||||||
parentGamesystem.removeChildGamesystem(simpleGamesystem);
|
parentGamesystem.removeChildGamesystem(simpleGamesystem);
|
||||||
parentGamesystem.addChildGamesystem(productGamesystem);
|
parentGamesystem.addChildGamesystem(productGamesystem);
|
||||||
|
productGamesystem.parentGamesystem = parentGamesystem
|
||||||
} else {
|
} else {
|
||||||
gameModel.removeGamesystem(simpleGamesystem);
|
gameModel.removeGamesystem(simpleGamesystem);
|
||||||
gameModel.addGamesystem(productGamesystem);
|
gameModel.addGamesystem(productGamesystem);
|
20
src/app/project/parser/ScriptAccountParser.ts
Normal file
20
src/app/project/parser/ScriptAccountParser.ts
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
87
src/app/project/parser/gamesystemParser/GamesystemParser.ts
Normal file
87
src/app/project/parser/gamesystemParser/GamesystemParser.ts
Normal file
@ -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<any, any>[] = []
|
||||||
|
|
||||||
|
private scriptAccounts: ScriptAccount[]
|
||||||
|
|
||||||
|
|
||||||
|
constructor(scriptAccounts: ScriptAccount[]) {
|
||||||
|
this.scriptAccounts = scriptAccounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public parseStoredGamesystems(storedGamesystems: StoreComponent[]): Gamesystem<any, any>[] {
|
||||||
|
storedGamesystems.forEach(storedGamesystem => {
|
||||||
|
this.parseGamesystem(storedGamesystem)
|
||||||
|
})
|
||||||
|
|
||||||
|
return this.computeGamesystemStructure();
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseGamesystem(storedGamesystem: StoreComponent) {
|
||||||
|
const parsedGamesystemData = JSON.parse(storedGamesystem.jsonString)
|
||||||
|
let parsedSystem: Gamesystem<any, any>
|
||||||
|
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<gamesystemData.childsystems.length; i++) {
|
||||||
|
childsystemNames.push(gamesystemData.childsystems[i].componentName)
|
||||||
|
}
|
||||||
|
this.parsedParentGamesystems.push(new ParsedParentGamesystems(productGamesystem, childsystemNames))
|
||||||
|
|
||||||
|
return productGamesystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private computeGamesystemStructure(): Gamesystem<any, any>[] {
|
||||||
|
const topGamesystems: Gamesystem<any, any>[] = []
|
||||||
|
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<this.parsedParentGamesystems.length; i++) {
|
||||||
|
if(this.parsedParentGamesystems[i].childsystemNames.includes(childsystemName)) {
|
||||||
|
return this.parsedParentGamesystems[i].parentGamesystem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
|
||||||
|
|
||||||
|
export class ParsedParentGamesystems {
|
||||||
|
parentGamesystem: ProductGamesystem
|
||||||
|
childsystemNames: string[]
|
||||||
|
|
||||||
|
|
||||||
|
constructor(parentGamesystem: ProductGamesystem, childsystemNames: string[]) {
|
||||||
|
this.parentGamesystem = parentGamesystem;
|
||||||
|
this.childsystemNames = childsystemNames;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||||
|
import {ScriptAccountCondition} from "../../game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
|
import {max, min} from "rxjs";
|
||||||
|
|
||||||
|
export class ScriptAccountConditionParser {
|
||||||
|
|
||||||
|
private scriptAccounts: ScriptAccount[]
|
||||||
|
|
||||||
|
|
||||||
|
constructor(scriptAccounts: ScriptAccount[]) {
|
||||||
|
this.scriptAccounts = scriptAccounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
parseStoredConditions(conditionData: any): ScriptAccountCondition[] {
|
||||||
|
const conditions: ScriptAccountCondition[] = []
|
||||||
|
for(let i=0; i<conditionData.length; i++) {
|
||||||
|
const parsedCondition = this.parseSingleCondition(conditionData[i]);
|
||||||
|
if(parsedCondition != undefined) {
|
||||||
|
conditions.push(parsedCondition)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return conditions
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseSingleCondition(conditionData: any): ScriptAccountCondition | undefined{
|
||||||
|
const referencedScriptAccount = this.findScriptAccountByName(conditionData.scriptAccount);
|
||||||
|
if(referencedScriptAccount != undefined) {
|
||||||
|
const minValue = conditionData.minValue;
|
||||||
|
const maxValue = conditionData.maxValue;
|
||||||
|
return ScriptAccountCondition.constructScriptAccountCondition(referencedScriptAccount, minValue, maxValue);
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private findScriptAccountByName(scriptAccountName: string) {
|
||||||
|
return this.scriptAccounts.find(scriptAccount => scriptAccount.componentName === scriptAccountName);
|
||||||
|
}
|
||||||
|
}
|
39
src/app/project/parser/gamesystemParser/StateParser.ts
Normal file
39
src/app/project/parser/gamesystemParser/StateParser.ts
Normal file
@ -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<stateData.length; i++) {
|
||||||
|
parsedStates.push(this.parseState(stateData[i]))
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsedStates;
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseState(stateData: any): SimpleState {
|
||||||
|
const initial = stateData.initial
|
||||||
|
const stateLabel = stateData.stateLabel
|
||||||
|
const stateDescription = stateData.stateDescription
|
||||||
|
|
||||||
|
const conditions = this.conditionParser.parseStoredConditions(stateData.conditions)
|
||||||
|
|
||||||
|
const simpleState = new SimpleState(stateLabel, stateDescription);
|
||||||
|
simpleState.initial = initial;
|
||||||
|
simpleState.conditions = conditions;
|
||||||
|
|
||||||
|
return simpleState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
46
src/app/project/parser/gamesystemParser/TransitionParser.ts
Normal file
46
src/app/project/parser/gamesystemParser/TransitionParser.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
|
||||||
|
import {ScriptAccountConditionParser} from "./ScriptAccountConditionParser";
|
||||||
|
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||||
|
import {SimpleTransition} from "../../game-model/gamesystems/transitions/SimpleTransition";
|
||||||
|
|
||||||
|
|
||||||
|
export class TransitionParser {
|
||||||
|
|
||||||
|
private states: SimpleState[]
|
||||||
|
private conditionParser: ScriptAccountConditionParser
|
||||||
|
|
||||||
|
|
||||||
|
constructor(states: SimpleState[], scriptAccounts: ScriptAccount[]) {
|
||||||
|
this.states = states;
|
||||||
|
this.conditionParser = new ScriptAccountConditionParser(scriptAccounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public parseTransitions(transitionData: any): SimpleTransition[] {
|
||||||
|
const transitions: SimpleTransition[] = []
|
||||||
|
for(let i=0; i<transitionData.length; i++) {
|
||||||
|
const parsedTransition = this.parseSingleTransition(transitionData[i]);
|
||||||
|
if(parsedTransition != undefined) {
|
||||||
|
transitions.push(parsedTransition)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return transitions
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseSingleTransition(transitionData: any): SimpleTransition | undefined{
|
||||||
|
const startingState = this.findStateByLabel(transitionData.startingState)
|
||||||
|
const endingState = this.findStateByLabel(transitionData.endingState);
|
||||||
|
|
||||||
|
if(startingState == undefined || endingState == undefined) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
const simpleTransition = new SimpleTransition(startingState, endingState)
|
||||||
|
simpleTransition.scriptAccountConditions = this.conditionParser.parseStoredConditions(transitionData.scriptAccountConditions)
|
||||||
|
|
||||||
|
return simpleTransition;
|
||||||
|
}
|
||||||
|
|
||||||
|
private findStateByLabel(stateLabel: string) {
|
||||||
|
return this.states.find(state => state.stateLabel === stateLabel);
|
||||||
|
}
|
||||||
|
}
|
109
src/app/project/serializer/GamesystemSerializer.ts
Normal file
109
src/app/project/serializer/GamesystemSerializer.ts
Normal file
@ -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<any, any>[]): StoreComponent[] {
|
||||||
|
let storedGamesystems: StoreComponent[] = []
|
||||||
|
gamesystems.forEach(gamesystem => storedGamesystems = storedGamesystems.concat(this.serializeSingleGamesystem(gamesystem)))
|
||||||
|
return storedGamesystems
|
||||||
|
}
|
||||||
|
|
||||||
|
private static serializeSingleGamesystem(gamesystem: Gamesystem<any, any>): 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<pathElements.length; i++) {
|
||||||
|
output += pathElements[i] + "/"
|
||||||
|
}
|
||||||
|
return output.slice(0, -1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static computeProductGamesystemPath(productGamesystem: ProductGamesystem): string {
|
||||||
|
if(productGamesystem.parentGamesystem == undefined) {
|
||||||
|
return productGamesystem.componentName + "/" + productGamesystem.componentName
|
||||||
|
} else {
|
||||||
|
const pathElements: string[] = [productGamesystem.componentName + "/" + productGamesystem.componentName]
|
||||||
|
let currentGamesystem: ProductGamesystem | undefined = productGamesystem.parentGamesystem
|
||||||
|
while(currentGamesystem != undefined) {
|
||||||
|
pathElements.unshift(currentGamesystem.componentName)
|
||||||
|
currentGamesystem = currentGamesystem.parentGamesystem
|
||||||
|
}
|
||||||
|
let output = ""
|
||||||
|
for(let i=0; i<pathElements.length; i++) {
|
||||||
|
output += pathElements[i] + "/"
|
||||||
|
}
|
||||||
|
return output.slice(0, -1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
src/app/project/serializer/ScriptAccountSerializer.ts
Normal file
25
src/app/project/serializer/ScriptAccountSerializer.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount";
|
||||||
|
import {StoreComponent} from "../../../../app/storage/StoreComponent";
|
||||||
|
import {SerializeConstants} from "./SerializeConstants";
|
||||||
|
import {ModelComponentType} from "../game-model/ModelComponentType";
|
||||||
|
|
||||||
|
export class ScriptAccountSerializer {
|
||||||
|
|
||||||
|
public static serializeScriptAccounts(scriptAccounts: ScriptAccount[]): StoreComponent[] {
|
||||||
|
const storeComponents: StoreComponent[] = []
|
||||||
|
scriptAccounts.forEach(scriptAccount => 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);
|
||||||
|
}
|
||||||
|
}
|
3
src/app/project/serializer/SerializeConstants.ts
Normal file
3
src/app/project/serializer/SerializeConstants.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export class SerializeConstants {
|
||||||
|
public static JSON_INDENT = 4
|
||||||
|
}
|
@ -1,13 +1,13 @@
|
|||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
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 {FlatTreeControl} from "@angular/cdk/tree";
|
||||||
import {MatTreeFlatDataSource, MatTreeFlattener} from "@angular/material/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 {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 {
|
interface FlatNode {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user