template-systems #41

Merged
sebastian merged 30 commits from template-systems into main 2024-04-19 21:10:01 +02:00
4 changed files with 91 additions and 0 deletions
Showing only changes of commit 93498845ec - Show all commits

View File

@ -15,6 +15,24 @@
</mat-card-content> </mat-card-content>
</mat-card> </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>
<mat-card-header> <mat-card-header>
<mat-card-title>Character-Relations</mat-card-title> <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[] = [] characterRelations: CharacterRelation[] = []
assymetricCharacterRelationSpecificTemplateSystems: Gamesystem<any, any>[] = []
constructor(componentName: string, componentDescription: string) { constructor(componentName: string, componentDescription: string) {
super(componentName, componentDescription, ModelComponentType.CHARACTER); 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) { addCharacterRelation(characterRelation: CharacterRelation) {
this.characterRelations.push(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 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
}