Serialize Template Transition
All checks were successful
E2E Testing / test (push) Successful in 1m55s

This commit is contained in:
Sebastian Böckelmann 2024-04-11 17:31:58 +02:00
parent a3639969e3
commit 5f59726bdd
5 changed files with 19 additions and 24 deletions

View File

@ -56,12 +56,12 @@ export class SimpleTemplateGamesystem<ReferenceType> extends Gamesystem<SimpleTe
}) })
this.transitions.forEach(transition => { this.transitions.forEach(transition => {
if(!transition.conditions.has(reference)) { if(!transition.conditionMap.has(reference)) {
transition.conditions.set(reference, transition.scriptAccountConditions.concat()) transition.conditionMap.set(reference, transition.scriptAccountConditions.concat())
} }
if(!transition.actions.has(reference)) { if(!transition.actionMap.has(reference)) {
transition.actions.set(reference, transition.scriptAccountActions.concat()) transition.actionMap.set(reference, transition.scriptAccountActions.concat())
} }
}) })
} }

View File

@ -4,6 +4,6 @@ import {ScriptAccountAction} from "../actions/ScriptAccountAction";
export class SimpleTemplateTransition<ReferenceType> extends SimpleTransition { export class SimpleTemplateTransition<ReferenceType> extends SimpleTransition {
conditions: Map<ReferenceType, ScriptAccountCondition[]> = new Map(); conditionMap: Map<ReferenceType, ScriptAccountCondition[]> = new Map();
actions: Map<ReferenceType, ScriptAccountAction[]> = new Map(); actionMap: Map<ReferenceType, ScriptAccountAction[]> = new Map();
} }

View File

@ -30,10 +30,17 @@ export class CharacterSerializer {
return value.componentName return value.componentName
} }
if(key === 'conditionMap') { if(key === 'conditionMap' || key === 'actionMap') {
if(value.get(character) == undefined) {
return []
}
return value.get(character) return value.get(character)
} }
if(key === 'startingState' || key === 'endingState') {
return value.stateLabel
}
if(this.ignoredKeys.includes(key)) { if(this.ignoredKeys.includes(key)) {
return undefined return undefined
} else { } else {

View File

@ -24,21 +24,10 @@
{ {
"scriptAccountActions": [], "scriptAccountActions": [],
"scriptAccountConditions": [], "scriptAccountConditions": [],
"startingState": { "startingState": "Fröhlich",
"stateLabel": "Fröhlich", "endingState": "Wütend",
"conditionMap": [ "conditionMap": [],
{ "actionMap": []
"scriptAccount": "Luftfeuchtigkeit",
"minValue": 0,
"maxValue": "10"
}
]
},
"endingState": {
"stateLabel": "Wütend",
"conditionMap": []
},
"actions": {}
} }
] ]
} }

View File

@ -21,8 +21,7 @@
"scriptAccountConditions": [], "scriptAccountConditions": [],
"startingState": "Fröhlich", "startingState": "Fröhlich",
"endingState": "Wütend", "endingState": "Wütend",
"conditions": {}, "actionMap": {}
"actions": {}
} }
], ],
"templateType": 1 "templateType": 1