From ebd3a541207247d4c79253a6c49d5623507119be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sun, 14 Apr 2024 11:55:06 +0200 Subject: [PATCH] Display Characterspecific ProductStates --- .../gamesystem-editor.component.html | 2 +- .../product-gamesystem-editor.component.html | 2 +- .../product-gamesystem-editor.component.ts | 2 ++ .../product-state-editor.component.ts | 11 ++++++++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html index 0537cf2..f4ef23b 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html @@ -1,3 +1,3 @@ - diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html index b2d1a1f..7cbbe0c 100644 --- a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html @@ -1,4 +1,4 @@ - +
diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts index d1f7f23..29319ca 100644 --- a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts @@ -4,6 +4,7 @@ import { } from "../transition-editor/product-transition-editor/product-transition-editor.component"; import {ProductGamesystem} from "../../../project/game-model/gamesystems/ProductGamesystem"; 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 { @Input() gamesystem: ProductGamesystem | undefined + @Input() templateElement: TemplateElement | undefined @Output("onOpenGamesystemEditor") openGamesystemEditorEmitter = new EventEmitter(); onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { 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 328928e..066e478 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 @@ -8,6 +8,8 @@ import {ProductGamesystem} from "../../../../project/game-model/gamesystems/Prod import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem"; import {ProductState} from "../../../../project/game-model/gamesystems/states/ProductState"; 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({ selector: 'app-product-state-editor', @@ -24,6 +26,7 @@ import {State} from "../../../../project/game-model/gamesystems/states/State"; export class ProductStateEditorComponent implements OnInit{ @Input() gamesystem: ProductGamesystem | undefined + @Input() templateElement: TemplateElement | undefined @Output('onOpenGamesystemEditor') openGamesystemEditorEmitter = new EventEmitter(); displayedColumns: string[] = []; expandedColumns: string[] = [] @@ -36,7 +39,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.templateElement == undefined) { + 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) => { const leaf_states = LeafGamesystemCalculator.calcLeafStates(data); return leaf_states.some((state) => state.stateLabel.toLowerCase().includes(filter))