Serialize and Load Gernation Settings of Gamesystems
All checks were successful
E2E Testing / test (push) Successful in 1m34s

This commit is contained in:
Sebastian Böckelmann 2024-04-19 20:13:13 +02:00
parent 8b0b8c5234
commit 743af8c0a1
7 changed files with 57 additions and 2 deletions

View File

@ -45,6 +45,7 @@ export class GamesystemParser {
let simpleGamesystem let simpleGamesystem
if(gamesystemData.templateType != undefined) { if(gamesystemData.templateType != undefined) {
simpleGamesystem = new SimpleTemplateGamesystem(gamesystemData.componentName, gamesystemData.componentDescription, gamesystemData.templateType) simpleGamesystem = new SimpleTemplateGamesystem(gamesystemData.componentName, gamesystemData.componentDescription, gamesystemData.templateType)
simpleGamesystem.symmetric = gamesystemData.symmetric
} else { } else {
simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription) simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription)
} }
@ -56,6 +57,7 @@ export class GamesystemParser {
const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts) const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions, gamesystemData.templateType) simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions, gamesystemData.templateType)
simpleGamesystem.generateIsolatedStates = gamesystemData.generateIsolatedStates;
return simpleGamesystem return simpleGamesystem
} }
@ -66,8 +68,11 @@ export class GamesystemParser {
productGamesystem = new ProductGamesystem(gamesystemData.componentName, gamesystemData.componentDescription); productGamesystem = new ProductGamesystem(gamesystemData.componentName, gamesystemData.componentDescription);
} else { } else {
productGamesystem = new ProductTemplateSystem(gamesystemData.componentName, gamesystemData.componentDescription, gamesystemData.templateType) productGamesystem = new ProductTemplateSystem(gamesystemData.componentName, gamesystemData.componentDescription, gamesystemData.templateType)
productGamesystem.symmetric = gamesystemData.symmetric
} }
productGamesystem.generateIsolatedStates = gamesystemData.generateIsolatedStates
const childsystemNames: string[] = [] const childsystemNames: string[] = []
for(let i=0; i<gamesystemData.childsystems.length; i++) { for(let i=0; i<gamesystemData.childsystems.length; i++) {
childsystemNames.push(gamesystemData.childsystems[i].componentName) childsystemNames.push(gamesystemData.childsystems[i].componentName)

View File

@ -66,13 +66,16 @@ export class GamesystemSerializer {
'componentName': productGamesystem.componentName, 'componentName': productGamesystem.componentName,
'componentDescription': productGamesystem.componentDescription, 'componentDescription': productGamesystem.componentDescription,
'childsystems': innerGamesystemJsonArray, 'childsystems': innerGamesystemJsonArray,
'templateType': productGamesystem.templateType 'templateType': productGamesystem.templateType,
'symmetric': productGamesystem.symmetric,
'generateIsolatedStates':productGamesystem.generateIsolatedStates
} }
} else { } else {
jsonString = { jsonString = {
'componentName': productGamesystem.componentName, 'componentName': productGamesystem.componentName,
'componentDescription': productGamesystem.componentDescription, 'componentDescription': productGamesystem.componentDescription,
'childsystems': innerGamesystemJsonArray, 'childsystems': innerGamesystemJsonArray,
'generateIsolatedStates':productGamesystem.generateIsolatedStates
} }
} }

View File

@ -3,7 +3,7 @@
"componentDescription": "", "componentDescription": "",
"states": [ "states": [
{ {
"initial": false, "initial": true,
"conditions": [], "conditions": [],
"stateLabel": "Feind", "stateLabel": "Feind",
"stateDescription": "" "stateDescription": ""

View File

@ -0,0 +1,14 @@
{
"componentName": "Letter",
"componentDescription": "",
"states": [
{
"initial": false,
"conditions": [],
"stateLabel": "A",
"stateDescription": ""
}
],
"transitions": [],
"generateIsolatedStates": false
}

View File

@ -0,0 +1,14 @@
{
"componentName": "Number",
"componentDescription": "",
"states": [
{
"initial": false,
"conditions": [],
"stateLabel": "1",
"stateDescription": ""
}
],
"transitions": [],
"generateIsolatedStates": false
}

View File

@ -0,0 +1,13 @@
{
"componentName": "ProductGamesystem",
"componentDescription": "",
"childsystems": [
{
"componentName": "Letter"
},
{
"componentName": "Number"
}
],
"generateIsolatedStates": true
}

View File

@ -0,0 +1,6 @@
{
"componentName": "Test",
"componentDescription": "",
"minValue": 0,
"maxValue": 100
}