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 1/2] 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)) -- 2.34.1 From c127a0122f9b33e6a7b067223ec7b82859fa7e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sun, 14 Apr 2024 11:59:30 +0200 Subject: [PATCH 2/2] Display Characterspecific ProductTransitions --- .../product-gamesystem-editor.component.html | 2 +- .../product-transition-editor.component.ts | 10 ++++- testModel/characters/Astrid Hofferson.json | 45 +++++++++++++++++-- testModel/characters/Hicks Haddock.json | 20 ++++++++- .../gamesystems/Producttest/Letters.json | 24 +++++++++- .../gamesystems/Producttest/Numbers.json | 24 +++++++++- 6 files changed, 114 insertions(+), 11 deletions(-) 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 7cbbe0c..0eee76f 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/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..6c12eec 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 {TemplateElement} from "../../../../project/game-model/templates/TemplateElement"; +import {ProductTemplateSystem} from "../../../../project/game-model/templates/productGamesystem/ProductTemplateSystem"; class DisplayedColumnName { displayedName: string internalName: string @@ -34,6 +36,7 @@ export class ProductTransitionEditorComponent implements OnInit{ @Input() gamesystem: ProductGamesystem | undefined @Output() onOpenGamesystem = new EventEmitter(); + @Input() templateElement: TemplateElement | undefined dataSource = new MatTableDataSource(); displayedColumns: DisplayedColumnName[] = []; @@ -52,7 +55,12 @@ 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.templateElement == undefined) { + this.dataSource.data = this.gamesystem.transitions; + } else if(this.gamesystem instanceof ProductTemplateSystem){ + this.dataSource.data = this.gamesystem!.transitionMap.get(this.templateElement)! + } + this.dataSource.filterPredicate = (data: ProductTransition, filter: string) => { const leaf_starting_states = LeafGamesystemCalculator.calcLeafStates(data.startingState); const leaf_ending_states = LeafGamesystemCalculator.calcLeafStates(data.endingState); diff --git a/testModel/characters/Astrid Hofferson.json b/testModel/characters/Astrid Hofferson.json index 468452a..014ec69 100644 --- a/testModel/characters/Astrid Hofferson.json +++ b/testModel/characters/Astrid Hofferson.json @@ -3,9 +3,48 @@ "componentDescription": "", "characterSpecificTemplateSystems": [ { - "componentName": "Letters", - "states": [], - "transitions": [] + "componentName": "TemplateGamesystem", + "states": [ + { + "stateLabel": "A", + "conditionMap": [ + { + "scriptAccount": "Luftfeuchtigkeit", + "minValue": 0, + "maxValue": "10" + } + ] + }, + { + "stateLabel": "B", + "conditionMap": [ + { + "scriptAccount": "New ScriptAccount", + "minValue": 0, + "maxValue": 100 + } + ] + } + ], + "transitions": [ + { + "startingState": "A", + "endingState": "B", + "conditionMap": [ + { + "scriptAccount": "Temperature", + "minValue": 0, + "maxValue": 10 + } + ], + "actionMap": [ + { + "changingValue": 10, + "scriptAccount": "Luftfeuchtigkeit" + } + ] + } + ] } ] } \ No newline at end of file diff --git a/testModel/characters/Hicks Haddock.json b/testModel/characters/Hicks Haddock.json index 571f2e5..158b912 100644 --- a/testModel/characters/Hicks Haddock.json +++ b/testModel/characters/Hicks Haddock.json @@ -37,8 +37,24 @@ }, { "componentName": "Letters", - "states": [], - "transitions": [] + "states": [ + { + "stateLabel": "A", + "conditionMap": [] + }, + { + "stateLabel": "B", + "conditionMap": [] + } + ], + "transitions": [ + { + "startingState": "A", + "endingState": "B", + "conditionMap": [], + "actionMap": [] + } + ] } ] } \ No newline at end of file diff --git a/testModel/gamesystems/Producttest/Letters.json b/testModel/gamesystems/Producttest/Letters.json index 4be751b..9bab958 100644 --- a/testModel/gamesystems/Producttest/Letters.json +++ b/testModel/gamesystems/Producttest/Letters.json @@ -1,7 +1,27 @@ { "componentName": "Letters", "componentDescription": "", - "states": [], - "transitions": [], + "states": [ + { + "initial": false, + "conditions": [], + "stateLabel": "A", + "stateDescription": "" + }, + { + "initial": false, + "conditions": [], + "stateLabel": "B", + "stateDescription": "" + } + ], + "transitions": [ + { + "scriptAccountActions": [], + "scriptAccountConditions": [], + "startingState": "A", + "endingState": "B" + } + ], "templateType": 0 } \ No newline at end of file diff --git a/testModel/gamesystems/Producttest/Numbers.json b/testModel/gamesystems/Producttest/Numbers.json index 5c9bd28..89f1e28 100644 --- a/testModel/gamesystems/Producttest/Numbers.json +++ b/testModel/gamesystems/Producttest/Numbers.json @@ -1,6 +1,26 @@ { "componentName": "Numbers", "componentDescription": "", - "states": [], - "transitions": [] + "states": [ + { + "initial": false, + "conditions": [], + "stateLabel": "1", + "stateDescription": "" + }, + { + "initial": false, + "conditions": [], + "stateLabel": "2", + "stateDescription": "" + } + ], + "transitions": [ + { + "scriptAccountActions": [], + "scriptAccountConditions": [], + "startingState": "1", + "endingState": "2" + } + ] } \ No newline at end of file -- 2.34.1