Show States and Transitions of ProductTemplate
All checks were successful
E2E Testing / test (push) Successful in 1m28s

This commit is contained in:
Sebastian Böckelmann 2024-04-13 07:07:57 +02:00
parent 23834c1ace
commit 6f84aaf810
2 changed files with 18 additions and 2 deletions

View File

@ -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<SimpleGamesystem>();
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'];
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))

View File

@ -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<SimpleGamesystem>();
dataSource = new MatTableDataSource<ProductTransition>();
@ -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);