From 21d324d3b241c6f11653f3413231050e12e9ddfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sun, 14 Apr 2024 11:18:23 +0200 Subject: [PATCH] Persist TemplateType of ProductTemplateSystems --- .../serializer/GamesystemSerializer.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/app/project/serializer/GamesystemSerializer.ts b/src/app/project/serializer/GamesystemSerializer.ts index 311ce30..41ebcf3 100644 --- a/src/app/project/serializer/GamesystemSerializer.ts +++ b/src/app/project/serializer/GamesystemSerializer.ts @@ -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)