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 => {
if(!transition.conditions.has(reference)) {
transition.conditions.set(reference, transition.scriptAccountConditions.concat())
if(!transition.conditionMap.has(reference)) {
transition.conditionMap.set(reference, transition.scriptAccountConditions.concat())
}
if(!transition.actions.has(reference)) {
transition.actions.set(reference, transition.scriptAccountActions.concat())
if(!transition.actionMap.has(reference)) {
transition.actionMap.set(reference, transition.scriptAccountActions.concat())
}
})
}

View File

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

View File

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

View File

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

View File

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