Save States of CharacterSpecificStates
All checks were successful
E2E Testing / test (push) Successful in 1m33s
All checks were successful
E2E Testing / test (push) Successful in 1m33s
This commit is contained in:
parent
ef489b19ef
commit
2df08661e0
@ -5,6 +5,8 @@ import {ModelComponentType} from "../game-model/ModelComponentType";
|
||||
|
||||
export class CharacterSerializer {
|
||||
|
||||
private static IGNORED_SIMPLE_ATTRIBUTES = ['incomingTransitions', "outgoingTransitions", "unsaved", "type", "stateDescription"]
|
||||
|
||||
public static serializeCharacters(characters: Character[]): StoreComponent[] {
|
||||
const storedCharacters: StoreComponent[] = []
|
||||
characters.forEach(character => storedCharacters.push(this.serializeSingleCharacter(character)))
|
||||
@ -14,9 +16,12 @@ export class CharacterSerializer {
|
||||
private static serializeSingleCharacter(character: Character): StoreComponent{
|
||||
const fileName = character.componentName
|
||||
const jsonString = JSON.stringify(character, (key, value) => {
|
||||
if(key === 'unsaved' || key === 'type') {
|
||||
if(this.IGNORED_SIMPLE_ATTRIBUTES.includes(key)) {
|
||||
return undefined
|
||||
} else {
|
||||
if(key === 'referenceGamesystem' || key === 'scriptAccount') {
|
||||
return value.componentName
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}, SerializeConstants.JSON_INDENT)
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"componentName": "Astrid Hofferson",
|
||||
"componentDescription": ""
|
||||
"componentDescription": "",
|
||||
"characterSpecificGamesystems": []
|
||||
}
|
@ -1,4 +1,22 @@
|
||||
{
|
||||
"componentName": "Hicks Haddock",
|
||||
"componentDescription": ""
|
||||
"componentDescription": "",
|
||||
"characterSpecificGamesystems": [
|
||||
{
|
||||
"templateStates": [
|
||||
{
|
||||
"initial": false,
|
||||
"conditions": [
|
||||
{
|
||||
"scriptAccount": "Temperature",
|
||||
"minValue": 0,
|
||||
"maxValue": "5"
|
||||
}
|
||||
],
|
||||
"stateLabel": "Wütend"
|
||||
}
|
||||
],
|
||||
"referenceGamesystem": "Characterstimmung"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user