Load TemplateStatus of SimpleTemplateGamesystem
All checks were successful
E2E Testing / test (push) Successful in 1m33s

This commit is contained in:
Sebastian Böckelmann 2024-04-13 12:38:26 +02:00
parent 2c789b4cd0
commit 7e6dd4aa27

View File

@ -6,6 +6,7 @@ import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
import {StateParser} from "./StateParser"; import {StateParser} from "./StateParser";
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
import {TransitionParser} from "./TransitionParser"; import {TransitionParser} from "./TransitionParser";
import {SimpleTemplateGamesystem} from "../../game-model/templates/simpleGamesystem/SimpleTemplateGamesystem";
export class GamesystemParser { export class GamesystemParser {
@ -40,13 +41,21 @@ export class GamesystemParser {
} }
parseSimpleGamesystem(gamesystemData: any): SimpleGamesystem { parseSimpleGamesystem(gamesystemData: any): SimpleGamesystem {
const simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription) let simpleGamesystem
if(gamesystemData.templateType != undefined) {
simpleGamesystem = new SimpleTemplateGamesystem(gamesystemData.componentName, gamesystemData.componentDescription, gamesystemData.templateType)
} else {
simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription)
}
const stateParser = new StateParser(this.scriptAccounts); const stateParser = new StateParser(this.scriptAccounts);
simpleGamesystem.states = stateParser.parseStates(gamesystemData.states) simpleGamesystem.states = stateParser.parseStates(gamesystemData.states)
const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts) const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions) simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions)
return simpleGamesystem return simpleGamesystem
} }