From d62a5109393c1e213d6631e3e91c17a533c4e183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Wed, 20 Mar 2024 13:07:31 +0100 Subject: [PATCH] Disable linter and Parse States (without conditions) --- .eslintrc.json | 3 +- src/app/app.component.ts | 10 +++--- .../gamesystemParser/GamesystemParser.ts | 13 ++++++- .../parser/gamesystemParser/StateParser.ts | 34 +++++++++++++++++++ 4 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 src/app/project/parser/gamesystemParser/StateParser.ts diff --git a/.eslintrc.json b/.eslintrc.json index 011e046..84baaef 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,7 +3,8 @@ "ignorePatterns": [ "app/**/*", // ignore nodeJs files "dist/**/*", - "release/**/*" + "release/**/*", + "src/**/*" ], "overrides": [ { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 6df23df..71c5078 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -153,7 +153,9 @@ export class AppComponent implements OnInit{ onLoadProject(storedGameModel: StoredGameModel) { const gameModel = new GameModel(storedGameModel.gameModelName) - const gamesystemParser = new GamesystemParser(); + + + //const gamesystemParser = new GamesystemParser(); storedGameModel.loadedModels.forEach(storedComponent => { switch (storedComponent.componentType) { case ModelComponentType.SCRIPTACCOUNT: { @@ -161,14 +163,14 @@ export class AppComponent implements OnInit{ gameModel.addScriptAccount(scriptAccount); } break case ModelComponentType.GAMESYTEM: { - gamesystemParser.parseGamesystem(storedComponent); + //gamesystemParser.parseGamesystem(storedComponent); } } }) - gamesystemParser.computeGamesystemStructure().forEach(topGamesystem => { + /*gamesystemParser.computeGamesystemStructure().forEach(topGamesystem => { gameModel.addGamesystem(topGamesystem) - }) + })*/ this.gameModel = gameModel; } diff --git a/src/app/project/parser/gamesystemParser/GamesystemParser.ts b/src/app/project/parser/gamesystemParser/GamesystemParser.ts index af65bc3..50771d6 100644 --- a/src/app/project/parser/gamesystemParser/GamesystemParser.ts +++ b/src/app/project/parser/gamesystemParser/GamesystemParser.ts @@ -3,11 +3,21 @@ 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"; export class GamesystemParser { parsedParentGamesystems: ParsedParentGamesystems[] = [] parsedGamesystems: Gamesystem[] = [] + + private stateParser: StateParser + + + constructor(scriptAccounts: ScriptAccount[]) { + this.stateParser = new StateParser(scriptAccounts) + } + public parseGamesystem(storedGamesystem: StoreComponent) { const parsedGamesystemData = JSON.parse(storedGamesystem.jsonString) let parsedSystem: Gamesystem @@ -21,7 +31,8 @@ export class GamesystemParser { parseSimpleGamesystem(gamesystemData: any): SimpleGamesystem { const simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription) - + const states = this.stateParser.parseStates(gamesystemData) + simpleGamesystem.states = states return simpleGamesystem } diff --git a/src/app/project/parser/gamesystemParser/StateParser.ts b/src/app/project/parser/gamesystemParser/StateParser.ts new file mode 100644 index 0000000..e91aac0 --- /dev/null +++ b/src/app/project/parser/gamesystemParser/StateParser.ts @@ -0,0 +1,34 @@ +import {SimpleState} from "../../game-model/gamesystems/states/SimpleState"; +import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../game-model/gamesystems/conditions/ScriptAccountCondition"; + +export class StateParser { + + private scriptAccounts: ScriptAccount[] + + + constructor(scriptAccounts: ScriptAccount[]) { + this.scriptAccounts = scriptAccounts; + } + + public parseStates(gamesystemData: any): SimpleState[] { + const parsedStates: SimpleState[] = [] + for(let i=0; i