diff --git a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts index f0c4994..83d1069 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.ts @@ -8,6 +8,10 @@ import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/Scrip import {SimpleTransition} from "../../../../project/game-model/gamesystems/transitions/SimpleTransition"; import {SimpleState} from "../../../../project/game-model/gamesystems/states/SimpleState"; import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition"; +import {SimpleTemplateGamesystem} from "../../../../project/game-model/gamesystems/SimpleTemplateGamesystem"; +import { + SimpleTemplateTransition +} from "../../../../project/game-model/gamesystems/transitions/SimpleTemplateTransition"; @Component({ selector: 'app-simple-transition-editor', templateUrl: './simple-transition-editor.component.html', @@ -53,7 +57,11 @@ export class SimpleTransitionEditorComponent implements OnInit { } addTransition() { - this.editedTransition = new SimpleTransition(this.defaultStartingState, this.defaultEndingState); + if(this.gamesystem instanceof SimpleTemplateGamesystem) { + this.editedTransition = new SimpleTemplateTransition(this.defaultStartingState, this.defaultEndingState); + } else { + this.editedTransition = new SimpleTransition(this.defaultStartingState, this.defaultEndingState); + } const updatedData = this.dataSource.data; updatedData.push(this.editedTransition); this.dataSource.data = updatedData; @@ -79,6 +87,7 @@ export class SimpleTransitionEditorComponent implements OnInit { return; } this.gamesystem?.createTransition(this.editedTransition!.startingState, this.editedTransition!.endingState); + console.log("Edited Gamesystem: ", this.gamesystem!) this.dataSource.data = this.gamesystem!.transitions; this.editedTransition = undefined; } diff --git a/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts b/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts index 022a703..992d3f1 100644 --- a/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts +++ b/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts @@ -27,7 +27,6 @@ export class SimpleTemplateGamesystem extends Gamesystem(startingState, endingState); if(this.transitions.find(t => t.startingState === startingState && t.endingState === endingState) == undefined) { this.transitions.push(transition) diff --git a/src/app/project/serializer/CharacterSerializer.ts b/src/app/project/serializer/CharacterSerializer.ts index 09e1028..da04fa6 100644 --- a/src/app/project/serializer/CharacterSerializer.ts +++ b/src/app/project/serializer/CharacterSerializer.ts @@ -17,6 +17,7 @@ export class CharacterSerializer { private static serializeSingleCharacter(character: Character): StoreComponent{ const fileName = character.componentName + console.log("Templatesystem: ", character.characterSpecificGamesystems) const jsonString = JSON.stringify(character, (key, value) => { if(value instanceof Gamesystem) { return { diff --git a/testModel/characters/Hicks Haddock.json b/testModel/characters/Hicks Haddock.json index 30e3fe8..d616330 100644 --- a/testModel/characters/Hicks Haddock.json +++ b/testModel/characters/Hicks Haddock.json @@ -20,7 +20,27 @@ "conditionMap": [] } ], - "transitions": [] + "transitions": [ + { + "scriptAccountActions": [], + "scriptAccountConditions": [], + "startingState": { + "stateLabel": "Fröhlich", + "conditionMap": [ + { + "scriptAccount": "Luftfeuchtigkeit", + "minValue": 0, + "maxValue": "10" + } + ] + }, + "endingState": { + "stateLabel": "Wütend", + "conditionMap": [] + }, + "actions": {} + } + ] } ] } \ No newline at end of file diff --git a/testModel/gamesystems/Characterstimmung.json b/testModel/gamesystems/Characterstimmung.json index fe49734..5ef6057 100644 --- a/testModel/gamesystems/Characterstimmung.json +++ b/testModel/gamesystems/Characterstimmung.json @@ -15,6 +15,15 @@ "stateDescription": "" } ], - "transitions": [], + "transitions": [ + { + "scriptAccountActions": [], + "scriptAccountConditions": [], + "startingState": "Fröhlich", + "endingState": "Wütend", + "conditions": {}, + "actions": {} + } + ], "templateType": 1 } \ No newline at end of file