alt-templatesystem-impl #29

Closed
sebastian wants to merge 23 commits from alt-templatesystem-impl into character-specific-gamesystems
3 changed files with 13 additions and 16 deletions
Showing only changes of commit a3722f33c9 - Show all commits

View File

@ -2,9 +2,12 @@ import {Character} from "../game-model/characters/Character";
import {StoreComponent} from "../../../../app/storage/StoreComponent";
import {SerializeConstants} from "./SerializeConstants";
import {ModelComponentType} from "../game-model/ModelComponentType";
import {Gamesystem} from "../game-model/gamesystems/Gamesystem";
export class CharacterSerializer {
private static ignoredKeys: string[] = ['unsaved', 'type', 'incomingTransitions', 'outgoingTransitions', 'initial', 'conditions', 'stateDescription', 'templateType']
public static serializeCharacters(characters: Character[]): StoreComponent[] {
const storedCharacters: StoreComponent[] = []
characters.forEach(character => storedCharacters.push(this.serializeSingleCharacter(character)))
@ -14,7 +17,14 @@ 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(value instanceof Gamesystem) {
return {
...value,
componentDescription: undefined
}
}
if(this.ignoredKeys.includes(key)) {
return undefined
} else {
return value;

View File

@ -1,5 +1,4 @@
{
"componentName": "Astrid Hofferson",
"componentDescription": "",
"characterSpecificGamesystems": []
}

View File

@ -1,32 +1,20 @@
{
"componentName": "Hicks Haddock",
"componentDescription": "",
"componentDescription": "Das ist ein Test",
"characterSpecificGamesystems": [
{
"componentName": "Characterstimmung",
"componentDescription": "",
"states": [
{
"incomingTransitions": [],
"outgoingTransitions": [],
"initial": true,
"conditions": [],
"stateLabel": "Fröhlich",
"stateDescription": "",
"conditionMap": {}
},
{
"incomingTransitions": [],
"outgoingTransitions": [],
"initial": false,
"conditions": [],
"stateLabel": "Wütend",
"stateDescription": "",
"conditionMap": {}
}
],
"transitions": [],
"templateType": 1
"transitions": []
}
]
}