product-template-systems #33

Merged
sebastian merged 8 commits from product-template-systems into template-systems 2024-04-14 11:45:39 +02:00
Showing only changes of commit 21d324d3b2 - Show all commits

View File

@ -4,6 +4,7 @@ import {SimpleGamesystem} from "../game-model/gamesystems/SimpleGamesystem";
import {ProductGamesystem} from "../game-model/gamesystems/ProductGamesystem";
import {SerializeConstants} from "./SerializeConstants";
import {ModelComponentType} from "../game-model/ModelComponentType";
import {ProductTemplateSystem} from "../game-model/templates/productGamesystem/ProductTemplateSystem";
export class GamesystemSerializer {
@ -59,12 +60,24 @@ export class GamesystemSerializer {
storedChildsystems.forEach(storedChildsystem => storedGamesystems.push(storedChildsystem))
})
const jsonString = {
'componentName': productGamesystem.componentName,
'componentDescription': productGamesystem.componentDescription,
'childsystems': innerGamesystemJsonArray
let jsonString;
if(productGamesystem instanceof ProductTemplateSystem) {
jsonString = {
'componentName': productGamesystem.componentName,
'componentDescription': productGamesystem.componentDescription,
'childsystems': innerGamesystemJsonArray,
'templateType': productGamesystem.templateType
}
} else {
jsonString = {
'componentName': productGamesystem.componentName,
'componentDescription': productGamesystem.componentDescription,
'childsystems': innerGamesystemJsonArray,
}
}
const storedProductsystem = new StoreComponent(JSON.stringify(jsonString, null, SerializeConstants.JSON_INDENT), fileName, ModelComponentType.GAMESYTEM)
storedGamesystems.push(storedProductsystem)