Add Character-Relation-Specific Gamesystems
All checks were successful
E2E Testing / test (push) Successful in 1m34s

This commit is contained in:
Sebastian Böckelmann 2024-04-19 12:52:20 +02:00
parent 26db5392a4
commit 93498845ec
4 changed files with 91 additions and 0 deletions

View File

@ -15,6 +15,24 @@
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title>Characterrelationspecifc Gamesystems</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-accordion>
<mat-expansion-panel *ngFor="let templateSystem of character!.assymetricCharacterRelationSpecificTemplateSystems">
<mat-expansion-panel-header>
<mat-panel-title>{{templateSystem.componentName}}</mat-panel-title>
</mat-expansion-panel-header>
<app-gamesystem-editor [templateElement]="character" [gamesystem]="templateSystem" [scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
</mat-expansion-panel>
<button mat-stroked-button class="specify-btn" (click)="openCharacterRelationTemplateSpecificator()">Specify Templatesystem</button>
</mat-accordion>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title>Character-Relations</mat-card-title>

View File

@ -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);
}
})
}
}

View File

@ -14,6 +14,8 @@ export class Character extends ModelComponent implements TemplateElement {
characterRelations: CharacterRelation[] = []
assymetricCharacterRelationSpecificTemplateSystems: Gamesystem<any, any>[] = []
constructor(componentName: string, componentDescription: string) {
super(componentName, componentDescription, ModelComponentType.CHARACTER);
}
@ -39,6 +41,12 @@ export class Character extends ModelComponent implements TemplateElement {
}
}
addAsymetricCharacterRelationGamesystem(gamesystem: Gamesystem<any, any>, 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;
}
}

View File

@ -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
}