Ignore ProductTemplatesystems for Persisting
All checks were successful
E2E Testing / test (push) Successful in 1m36s
All checks were successful
E2E Testing / test (push) Successful in 1m36s
This commit is contained in:
parent
6f84aaf810
commit
c9bb367f4e
@ -1,16 +1,19 @@
|
||||
import {ModelComponent} from "../ModelComponent";
|
||||
import {ModelComponentType} from "../ModelComponentType";
|
||||
import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem";
|
||||
import {TemplateGamesystem} from "../gamesystems/TemplateGamesystem";
|
||||
import {ProductTemplateSystem} from "../gamesystems/ProductTemplateSystem";
|
||||
import {Gamesystem} from "../gamesystems/Gamesystem";
|
||||
|
||||
export class Character extends ModelComponent{
|
||||
|
||||
characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
|
||||
characterSpecificGamesystems: Gamesystem<any, any>[] = []
|
||||
|
||||
constructor(componentName: string, componentDescription: string) {
|
||||
super(componentName, componentDescription, ModelComponentType.CHARACTER);
|
||||
}
|
||||
|
||||
addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem<Character>) {
|
||||
addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem<Character> | ProductTemplateSystem<Character>) {
|
||||
if(!this.isGamesystemCharacterSpecific(templateGamesystem.componentName)) {
|
||||
this.characterSpecificGamesystems.push(templateGamesystem);
|
||||
templateGamesystem.addReferenceKey(this);
|
||||
|
@ -4,6 +4,8 @@ import {SerializeConstants} from "./SerializeConstants";
|
||||
import {ModelComponentType} from "../game-model/ModelComponentType";
|
||||
import {Gamesystem} from "../game-model/gamesystems/Gamesystem";
|
||||
import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount";
|
||||
import {ProductTemplateSystem} from "../game-model/gamesystems/ProductTemplateSystem";
|
||||
import {SimpleTemplateGamesystem} from "../game-model/gamesystems/SimpleTemplateGamesystem";
|
||||
|
||||
export class CharacterSerializer {
|
||||
|
||||
@ -17,6 +19,8 @@ export class CharacterSerializer {
|
||||
|
||||
private static serializeSingleCharacter(character: Character): StoreComponent{
|
||||
const fileName = character.componentName
|
||||
const templateGamesystemBackup = character.characterSpecificGamesystems.concat();
|
||||
character.characterSpecificGamesystems = character.characterSpecificGamesystems.filter(system => system instanceof SimpleTemplateGamesystem)
|
||||
console.log("Templatesystem: ", character.characterSpecificGamesystems)
|
||||
const jsonString = JSON.stringify(character, (key, value) => {
|
||||
if(value instanceof Gamesystem) {
|
||||
@ -48,6 +52,7 @@ export class CharacterSerializer {
|
||||
}
|
||||
}, SerializeConstants.JSON_INDENT)
|
||||
|
||||
character.characterSpecificGamesystems = templateGamesystemBackup
|
||||
return new StoreComponent(jsonString, fileName, ModelComponentType.CHARACTER);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user