From 6f84aaf810224495232636649f534412f0d4c403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sat, 13 Apr 2024 07:07:57 +0200 Subject: [PATCH] Show States and Transitions of ProductTemplate --- .../product-state-editor.component.ts | 11 ++++++++++- .../product-transition-editor.component.ts | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts index f6ee0d4..937443b 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts @@ -9,6 +9,8 @@ import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/Simpl import {ProductState} from "../../../../project/game-model/gamesystems/states/ProductState"; import {State} from "../../../../project/game-model/gamesystems/states/State"; import {SimpleTemplateGamesystem} from "../../../../project/game-model/gamesystems/SimpleTemplateGamesystem"; +import {Character} from "../../../../project/game-model/characters/Character"; +import {ProductTemplateSystem} from "../../../../project/game-model/gamesystems/ProductTemplateSystem"; @Component({ selector: 'app-product-state-editor', @@ -25,6 +27,7 @@ import {SimpleTemplateGamesystem} from "../../../../project/game-model/gamesyste export class ProductStateEditorComponent implements OnInit{ @Input() gamesystem: ProductGamesystem | undefined + @Input() templateReference: Character | undefined @Output('onOpenGamesystemEditor') openGamesystemEditorEmitter = new EventEmitter(); displayedColumns: string[] = []; expandedColumns: string[] = [] @@ -37,7 +40,13 @@ export class ProductStateEditorComponent implements OnInit{ this.generateColumnNamesRecursively(this.gamesystem!, ""); this.displayedColumns.push('Initial'); this.expandedColumns = [...this.displayedColumns, 'expand']; - this.datasource.data = this.gamesystem!.states; + + if(this.templateReference == undefined) { + this.datasource.data = this.gamesystem!.states; + } else if(this.gamesystem instanceof ProductTemplateSystem){ + this.datasource.data = this.gamesystem.stateMap.get(this.templateReference)! + } + this.datasource.filterPredicate = (data: ProductState, filter: string) => { const leaf_states = LeafGamesystemCalculator.calcLeafStates(data); return leaf_states.some((state) => state.stateLabel.toLowerCase().includes(filter)) diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts index 2f164d6..25ad6a5 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts @@ -8,6 +8,8 @@ import {ProductGamesystem} from "../../../../project/game-model/gamesystems/Prod import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem"; import {ProductTransition} from "../../../../project/game-model/gamesystems/transitions/ProductTransition"; import {ProductState} from "../../../../project/game-model/gamesystems/states/ProductState"; +import {Character} from "../../../../project/game-model/characters/Character"; +import {ProductTemplateSystem} from "../../../../project/game-model/gamesystems/ProductTemplateSystem"; class DisplayedColumnName { displayedName: string internalName: string @@ -33,6 +35,7 @@ class DisplayedColumnName { export class ProductTransitionEditorComponent implements OnInit{ @Input() gamesystem: ProductGamesystem | undefined + @Input() templateReference: Character | undefined @Output() onOpenGamesystem = new EventEmitter(); dataSource = new MatTableDataSource(); @@ -52,7 +55,11 @@ export class ProductTransitionEditorComponent implements OnInit{ this.columns = this.displayedColumns.map(column => column.internalName) this.columnsToDisplayWithExpand = [...this.columns, 'expand'] - this.dataSource.data = this.gamesystem.transitions; + if(this.templateReference == undefined) { + this.dataSource.data = this.gamesystem!.transitions; + } else if(this.gamesystem instanceof ProductTemplateSystem){ + this.dataSource.data = this.gamesystem.transitionMap.get(this.templateReference)! + } this.dataSource.filterPredicate = (data: ProductTransition, filter: string) => { const leaf_starting_states = LeafGamesystemCalculator.calcLeafStates(data.startingState); const leaf_ending_states = LeafGamesystemCalculator.calcLeafStates(data.endingState);