diff --git a/src/app/editor/character-editor/character-editor.component.html b/src/app/editor/character-editor/character-editor.component.html index b860b2f..358ad58 100644 --- a/src/app/editor/character-editor/character-editor.component.html +++ b/src/app/editor/character-editor/character-editor.component.html @@ -15,6 +15,24 @@ + + + Characterrelationspecifc Gamesystems + + + + + + {{templateSystem.componentName}} + + + + + + + + + Character-Relations diff --git a/src/app/editor/character-editor/character-editor.component.ts b/src/app/editor/character-editor/character-editor.component.ts index 72bd256..9c1a072 100644 --- a/src/app/editor/character-editor/character-editor.component.ts +++ b/src/app/editor/character-editor/character-editor.component.ts @@ -29,4 +29,12 @@ export class CharacterEditorComponent { }) } + openCharacterRelationTemplateSpecificator() { + const dialogRef = this.dialog.open(TemplateSpecificatorComponent, {data: this.gameModel!.getTemplateSystems(TemplateType.CHARACTER_RELATION), minWidth: "400px"}); + dialogRef.afterClosed().subscribe(res => { + if(res != undefined) { + this.character!.addAsymetricCharacterRelationGamesystem(res); + } + }) + } } diff --git a/src/app/project/game-model/characters/Character.ts b/src/app/project/game-model/characters/Character.ts index a8b0bd7..af8173e 100644 --- a/src/app/project/game-model/characters/Character.ts +++ b/src/app/project/game-model/characters/Character.ts @@ -14,6 +14,8 @@ export class Character extends ModelComponent implements TemplateElement { characterRelations: CharacterRelation[] = [] + assymetricCharacterRelationSpecificTemplateSystems: Gamesystem[] = [] + constructor(componentName: string, componentDescription: string) { super(componentName, componentDescription, ModelComponentType.CHARACTER); } @@ -39,6 +41,12 @@ export class Character extends ModelComponent implements TemplateElement { } } + addAsymetricCharacterRelationGamesystem(gamesystem: Gamesystem, recursiveCall: boolean = false) { + if(!this.isTemplateSystemCharacterRelationSpecific(gamesystem.componentName)) { + this.assymetricCharacterRelationSpecificTemplateSystems.push(gamesystem) + } + } + addCharacterRelation(characterRelation: CharacterRelation) { this.characterRelations.push(characterRelation) } @@ -47,4 +55,10 @@ export class Character extends ModelComponent implements TemplateElement { return this.characterSpecificTemplateSystems.find(gamesystem => gamesystem.componentName === gamesystemName) != undefined } + private isTemplateSystemCharacterRelationSpecific(gamesystemName: string) { + return this.assymetricCharacterRelationSpecificTemplateSystems.find(gamesystem => + gamesystem.componentName === gamesystemName) != undefined; + + } + } diff --git a/testModel/gamesystems/Characterbeziehungssystem.json b/testModel/gamesystems/Characterbeziehungssystem.json new file mode 100644 index 0000000..66d038b --- /dev/null +++ b/testModel/gamesystems/Characterbeziehungssystem.json @@ -0,0 +1,51 @@ +{ + "componentName": "Characterbeziehungssystem", + "componentDescription": "", + "states": [ + { + "initial": false, + "conditions": [], + "stateLabel": "Feind", + "stateDescription": "" + }, + { + "initial": true, + "conditions": [], + "stateLabel": "Freund", + "stateDescription": "" + }, + { + "initial": false, + "conditions": [], + "stateLabel": "Fester Freund", + "stateDescription": "" + } + ], + "transitions": [ + { + "scriptAccountActions": [], + "scriptAccountConditions": [], + "startingState": "Feind", + "endingState": "Freund" + }, + { + "scriptAccountActions": [], + "scriptAccountConditions": [], + "startingState": "Freund", + "endingState": "Feind" + }, + { + "scriptAccountActions": [], + "scriptAccountConditions": [], + "startingState": "Freund", + "endingState": "Fester Freund" + }, + { + "scriptAccountActions": [], + "scriptAccountConditions": [], + "startingState": "Fester Freund", + "endingState": "Feind" + } + ], + "templateType": 1 +} \ No newline at end of file