Display Characterspecific ProductStates
All checks were successful
E2E Testing / test (push) Successful in 1m33s

This commit is contained in:
Sebastian Böckelmann 2024-04-14 11:55:06 +02:00
parent 6496bd52c5
commit ebd3a54120
4 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,3 @@
<app-simple-gamesystem-editor *ngIf="isSimpleGamesystem()" [templateElement]="templateElement" [simpleGamesystem]="convertGamesystemToSimpleGamesystem()" [scriptAccunts]="scriptAccounts"></app-simple-gamesystem-editor> <app-simple-gamesystem-editor *ngIf="isSimpleGamesystem()" [templateElement]="templateElement" [simpleGamesystem]="convertGamesystemToSimpleGamesystem()" [scriptAccunts]="scriptAccounts"></app-simple-gamesystem-editor>
<app-product-gamesystem-editor *ngIf="!isSimpleGamesystem()" [gamesystem]="convertGamesystemToProductGamesystem()" <app-product-gamesystem-editor *ngIf="!isSimpleGamesystem()" [templateElement]="templateElement" [gamesystem]="convertGamesystemToProductGamesystem()"
(onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-gamesystem-editor> (onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-gamesystem-editor>

View File

@ -1,4 +1,4 @@
<app-product-state-editor [gamesystem]="gamesystem" (onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-state-editor> <app-product-state-editor [templateElement]="templateElement" [gamesystem]="gamesystem" (onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-state-editor>
<div id="productStateEditor"> <div id="productStateEditor">
<app-product-transition-editor [gamesystem]="gamesystem" (onOpenGamesystem)="onOpenGamesystemEditor($event)"></app-product-transition-editor> <app-product-transition-editor [gamesystem]="gamesystem" (onOpenGamesystem)="onOpenGamesystemEditor($event)"></app-product-transition-editor>
</div> </div>

View File

@ -4,6 +4,7 @@ import {
} from "../transition-editor/product-transition-editor/product-transition-editor.component"; } from "../transition-editor/product-transition-editor/product-transition-editor.component";
import {ProductGamesystem} from "../../../project/game-model/gamesystems/ProductGamesystem"; import {ProductGamesystem} from "../../../project/game-model/gamesystems/ProductGamesystem";
import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem"; import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem";
import {TemplateElement} from "../../../project/game-model/templates/TemplateElement";
@ -15,6 +16,7 @@ import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGa
export class ProductGamesystemEditorComponent { export class ProductGamesystemEditorComponent {
@Input() gamesystem: ProductGamesystem | undefined @Input() gamesystem: ProductGamesystem | undefined
@Input() templateElement: TemplateElement | undefined
@Output("onOpenGamesystemEditor") openGamesystemEditorEmitter = new EventEmitter<SimpleGamesystem>(); @Output("onOpenGamesystemEditor") openGamesystemEditorEmitter = new EventEmitter<SimpleGamesystem>();
onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { onOpenGamesystemEditor(gamesystem: SimpleGamesystem) {

View File

@ -8,6 +8,8 @@ import {ProductGamesystem} from "../../../../project/game-model/gamesystems/Prod
import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem"; import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem";
import {ProductState} from "../../../../project/game-model/gamesystems/states/ProductState"; import {ProductState} from "../../../../project/game-model/gamesystems/states/ProductState";
import {State} from "../../../../project/game-model/gamesystems/states/State"; import {State} from "../../../../project/game-model/gamesystems/states/State";
import {TemplateElement} from "../../../../project/game-model/templates/TemplateElement";
import {ProductTemplateSystem} from "../../../../project/game-model/templates/productGamesystem/ProductTemplateSystem";
@Component({ @Component({
selector: 'app-product-state-editor', selector: 'app-product-state-editor',
@ -24,6 +26,7 @@ import {State} from "../../../../project/game-model/gamesystems/states/State";
export class ProductStateEditorComponent implements OnInit{ export class ProductStateEditorComponent implements OnInit{
@Input() gamesystem: ProductGamesystem | undefined @Input() gamesystem: ProductGamesystem | undefined
@Input() templateElement: TemplateElement | undefined
@Output('onOpenGamesystemEditor') openGamesystemEditorEmitter = new EventEmitter<SimpleGamesystem>(); @Output('onOpenGamesystemEditor') openGamesystemEditorEmitter = new EventEmitter<SimpleGamesystem>();
displayedColumns: string[] = []; displayedColumns: string[] = [];
expandedColumns: string[] = [] expandedColumns: string[] = []
@ -36,7 +39,13 @@ export class ProductStateEditorComponent implements OnInit{
this.generateColumnNamesRecursively(this.gamesystem!, ""); this.generateColumnNamesRecursively(this.gamesystem!, "");
this.displayedColumns.push('Initial'); this.displayedColumns.push('Initial');
this.expandedColumns = [...this.displayedColumns, 'expand']; this.expandedColumns = [...this.displayedColumns, 'expand'];
if(this.templateElement == undefined) {
this.datasource.data = this.gamesystem!.states; this.datasource.data = this.gamesystem!.states;
} else if(this.gamesystem instanceof ProductTemplateSystem) {
this.datasource.data = this.gamesystem!.stateMap.get(this.templateElement)!
}
this.datasource.filterPredicate = (data: ProductState, filter: string) => { this.datasource.filterPredicate = (data: ProductState, filter: string) => {
const leaf_states = LeafGamesystemCalculator.calcLeafStates(data); const leaf_states = LeafGamesystemCalculator.calcLeafStates(data);
return leaf_states.some((state) => state.stateLabel.toLowerCase().includes(filter)) return leaf_states.some((state) => state.stateLabel.toLowerCase().includes(filter))