Mark Gamesystem as Template in Editor
Some checks failed
E2E Testing / test (push) Failing after 2m5s

This commit is contained in:
Sebastian Böckelmann 2024-04-10 20:20:34 +02:00
parent 28a520a995
commit a4be4d623d
14 changed files with 65 additions and 11 deletions

View File

@ -29,7 +29,7 @@ import {ModelComponentEditorComponent} from "./editor/model-component-editor/mod
import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component"; import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component";
import {MatDialogActions, MatDialogContent, MatDialogTitle} from "@angular/material/dialog"; import {MatDialogActions, MatDialogContent, MatDialogTitle} from "@angular/material/dialog";
import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component"; import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component";
import {MatTree, MatTreeModule} from "@angular/material/tree"; import { MatTreeModule} from "@angular/material/tree";
import {GamesystemEditorComponent} from "./editor/gamesystem-editor/gamesystem-editor.component"; import {GamesystemEditorComponent} from "./editor/gamesystem-editor/gamesystem-editor.component";
import { import {
SimpleGamesystemEditorComponent SimpleGamesystemEditorComponent
@ -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, MatExpansionPanelTitle} 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,11 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
MatHint, MatHint,
MatTooltip, MatTooltip,
MatCard, MatCard,
MatCardContent MatCardContent,
MatCardHeader,
MatAccordion,
MatExpansionPanel,
MatExpansionPanelTitle
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]

View File

@ -1 +1,15 @@
<p>character-editor works!</p> <mat-card>
<mat-card-header>
<mat-card-title>Charactersystems</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-accordion>
<mat-expansion-panel *ngFor="let characterSystem of character!.characterSpecificGamesystems">
<mat-expansion-panel-header>
<mat-panel-title>{{characterSystem.componentName}}</mat-panel-title>
</mat-expansion-panel-header>
<app-gamesystem-editor [gamesystem]="characterSystem" [scriptAccounts]="scriptAccounts"></app-gamesystem-editor>
</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 {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
@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() scriptAccounts: ScriptAccount[] = []
} }

View File

@ -14,7 +14,9 @@
[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"
[character]="convertModelComponentToCharacter(modelComponent)"
[scriptAccounts]="gameModel!.scriptAccounts">
</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

@ -1,3 +1,10 @@
<mat-form-field appearance="fill">
<mat-select [(ngModel)]="gamesystem!.template">
<mat-label>Templatetype</mat-label>
<mat-option [value]="TemplateType.NONE">None</mat-option>
<mat-option [value]="TemplateType.CHARACTER">Character</mat-option>
</mat-select>
</mat-form-field>
<app-simple-gamesystem-editor *ngIf="isSimpleGamesystem()" [simpleGamesystem]="convertGamesystemToSimpleGamesystem()" [scriptAccunts]="scriptAccounts"></app-simple-gamesystem-editor> <app-simple-gamesystem-editor *ngIf="isSimpleGamesystem()" [simpleGamesystem]="convertGamesystemToSimpleGamesystem()" [scriptAccunts]="scriptAccounts"></app-simple-gamesystem-editor>
<app-product-gamesystem-editor *ngIf="!isSimpleGamesystem()" [gamesystem]="convertGamesystemToProductGamesystem()" <app-product-gamesystem-editor *ngIf="!isSimpleGamesystem()" [gamesystem]="convertGamesystemToProductGamesystem()"
(onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-gamesystem-editor> (onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-gamesystem-editor>

View File

@ -5,6 +5,7 @@ import { Transition } from '../../project/game-model/gamesystems/transitions/Tra
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem"; import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem"; import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
import {TemplateType} from "../../project/game-model/gamesystems/TemplateType";
@Component({ @Component({
selector: 'app-gamesystem-editor', selector: 'app-gamesystem-editor',
@ -40,4 +41,6 @@ export class GamesystemEditorComponent implements OnInit{
onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { onOpenGamesystemEditor(gamesystem: SimpleGamesystem) {
this.openGamesystemEmitter.emit(gamesystem); this.openGamesystemEmitter.emit(gamesystem);
} }
protected readonly TemplateType = TemplateType;
} }

View File

@ -2,12 +2,15 @@ import {SimpleGamesystem} from "./SimpleGamesystem";
import {ProductGamesystem} from "./ProductGamesystem"; import {ProductGamesystem} from "./ProductGamesystem";
import {ModelComponent} from "../ModelComponent"; import {ModelComponent} from "../ModelComponent";
import {ModelComponentType} from "../ModelComponentType"; import {ModelComponentType} from "../ModelComponentType";
import {TemplateType} from "./TemplateType";
export abstract class Gamesystem<S, T> extends ModelComponent{ export abstract class Gamesystem<S, T> extends ModelComponent{
states: S[] = []; states: S[] = [];
transitions: T[] = []; transitions: T[] = [];
parentGamesystem: ProductGamesystem | undefined parentGamesystem: ProductGamesystem | undefined
template: TemplateType = TemplateType.NONE
constructor(gamesystemName: string, gamesystemDescription: string) { constructor(gamesystemName: string, gamesystemDescription: string) {
super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM); super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
} }

View File

@ -0,0 +1,4 @@
export enum TemplateType {
NONE,
CHARACTER
}

View File

@ -1,4 +1,5 @@
{ {
"componentName": "Astrid Hofferson", "componentName": "Astrid Hofferson",
"componentDescription": "" "componentDescription": "",
"characterSpecificGamesystems": []
} }

View File

@ -1,4 +1,5 @@
{ {
"componentName": "Hicks Haddock", "componentName": "Hicks Haddock",
"componentDescription": "" "componentDescription": "",
"characterSpecificGamesystems": []
} }

View File

@ -33,5 +33,6 @@
"startingState": "A", "startingState": "A",
"endingState": "B" "endingState": "B"
} }
] ],
"template": 0
} }

View File

@ -76,5 +76,6 @@
"startingState": "Winter", "startingState": "Winter",
"endingState": "Frühling" "endingState": "Frühling"
} }
] ],
"template": 0
} }

View File

@ -76,5 +76,6 @@
"startingState": "Schnee", "startingState": "Schnee",
"endingState": "Wolke" "endingState": "Wolke"
} }
] ],
"template": 0
} }