Beginning of Editor for Characterspecific Gamesystems
Some checks failed
E2E Testing / test (push) Failing after 2m3s

This commit is contained in:
Sebastian Böckelmann 2024-04-11 13:45:29 +02:00
parent 3aaf505365
commit 9a51cb3a80
6 changed files with 33 additions and 6 deletions

View File

@ -61,7 +61,7 @@ import {
ProductStateEditorComponent ProductStateEditorComponent
} from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component"; } from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component";
import {MatTooltip} from "@angular/material/tooltip"; import {MatTooltip} from "@angular/material/tooltip";
import {MatCard, MatCardContent} from "@angular/material/card"; import {MatCard, MatCardContent, MatCardHeader} from "@angular/material/card";
import { import {
ScriptaccountActionEditorComponent ScriptaccountActionEditorComponent
} from "./editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component"; } from "./editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component";
@ -70,6 +70,7 @@ import {
} from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component"; } from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component";
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component"; import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component"; import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component";
import {MatAccordion, MatExpansionPanel} from "@angular/material/expansion";
// AoT requires an exported function for factories // AoT requires an exported function for factories
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
@ -150,7 +151,10 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
MatHint, MatHint,
MatTooltip, MatTooltip,
MatCard, MatCard,
MatCardContent MatCardContent,
MatCardHeader,
MatAccordion,
MatExpansionPanel
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]

View File

@ -1 +1,12 @@
<p>character-editor works!</p> <mat-card>
<mat-card-header>
<mat-card-title>Characterspecific Gamesystems</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-accordion>
<mat-expansion-panel *ngFor="let gamesystem of character!.characterSpecificGamesystems">
<mat-expansion-panel-header>{{gamesystem.componentName}}</mat-expansion-panel-header>
</mat-expansion-panel>
</mat-accordion>
</mat-card-content>
</mat-card>

View File

@ -1,4 +1,6 @@
import { Component } from '@angular/core'; import {Component, Input} from '@angular/core';
import {Character} from "../../project/game-model/characters/Character";
import {GameModel} from "../../project/game-model/GameModel";
@Component({ @Component({
selector: 'app-character-editor', selector: 'app-character-editor',
@ -7,4 +9,6 @@ import { Component } from '@angular/core';
}) })
export class CharacterEditorComponent { export class CharacterEditorComponent {
@Input() character: Character | undefined
@Input() gameModel: GameModel | undefined
} }

View File

@ -14,7 +14,8 @@
[gamesystem]="convertModelComponentToGamesystem(modelComponent)" [gamesystem]="convertModelComponentToGamesystem(modelComponent)"
(onOpenGamesystemEditor)="openGameModelComponent($event)" (onOpenGamesystemEditor)="openGameModelComponent($event)"
[scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor> [scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
<app-character-editor *ngIf="modelComponent.type === ModelComponentType.CHARACTER"> <app-character-editor *ngIf="modelComponent.type === ModelComponentType.CHARACTER"
[gameModel]="gameModel!" [character]="convertModelComponentToCharacter(modelComponent)">
</app-character-editor> </app-character-editor>
</mat-tab> </mat-tab>

View File

@ -6,6 +6,7 @@ import {Gamesystem} from "../project/game-model/gamesystems/Gamesystem";
import {State} from "../project/game-model/gamesystems/states/State"; import {State} from "../project/game-model/gamesystems/states/State";
import {Transition} from "../project/game-model/gamesystems/transitions/Transition"; import {Transition} from "../project/game-model/gamesystems/transitions/Transition";
import {ModelComponentType} from "../project/game-model/ModelComponentType"; import {ModelComponentType} from "../project/game-model/ModelComponentType";
import {Character} from "../project/game-model/characters/Character";
@Component({ @Component({
@ -50,4 +51,10 @@ export class EditorComponent {
} }
protected readonly ModelComponentType = ModelComponentType; protected readonly ModelComponentType = ModelComponentType;
convertModelComponentToCharacter(modelComponent: ModelComponent) {
if(modelComponent instanceof Character) {
return modelComponent as Character;
}
}
} }

View File

@ -4,7 +4,7 @@ import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem"
export class Character extends ModelComponent{ export class Character extends ModelComponent{
private characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = [] characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
constructor(componentName: string, componentDescription: string) { constructor(componentName: string, componentDescription: string) {
super(componentName, componentDescription, ModelComponentType.CHARACTER); super(componentName, componentDescription, ModelComponentType.CHARACTER);