From aada044e0816d1ab4dd8ad365df39d711e0a7d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sat, 10 Feb 2024 17:07:24 +0100 Subject: [PATCH 01/30] Implement ProductStateCreation --- .../CreateProductStates.spec.ts | 48 +++++++++++++++++++ .../EqualInnerStates.spec.ts | 37 ++++++++++++++ .../productGamesystems/ProductStateTrainer.ts | 48 +++++++++++++++++++ src/app/app.component.ts | 17 +++++-- src/app/app.module.ts | 6 ++- .../gamesystem-editor.component.html | 1 + .../product-gamesystem-editor.component.html | 1 + .../product-gamesystem-editor.component.scss | 0 ...roduct-gamesystem-editor.component.spec.ts | 23 +++++++++ .../product-gamesystem-editor.component.ts | 17 +++++++ .../product-state-editor.component.html | 1 + .../product-state-editor.component.scss | 0 .../product-state-editor.component.spec.ts | 23 +++++++++ .../product-state-editor.component.ts | 14 ++++++ src/app/game-model/gamesystems/Gamesystem.ts | 2 - .../gamesystems/ProductGamesystem.ts | 27 ++++++++++- .../game-model/gamesystems/ProductState.ts | 37 +++++++++++++- src/app/game-model/gamesystems/SimpleState.ts | 18 +++++++ src/app/game-model/gamesystems/State.ts | 11 ++--- 19 files changed, 314 insertions(+), 17 deletions(-) create mode 100644 e2e/game-model/gamesystems/productGamesystems/CreateProductStates.spec.ts create mode 100644 e2e/game-model/gamesystems/productGamesystems/EqualInnerStates.spec.ts create mode 100644 e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts create mode 100644 src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html create mode 100644 src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.scss create mode 100644 src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.spec.ts create mode 100644 src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts create mode 100644 src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html create mode 100644 src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss create mode 100644 src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.spec.ts create mode 100644 src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts diff --git a/e2e/game-model/gamesystems/productGamesystems/CreateProductStates.spec.ts b/e2e/game-model/gamesystems/productGamesystems/CreateProductStates.spec.ts new file mode 100644 index 0000000..3ee77ef --- /dev/null +++ b/e2e/game-model/gamesystems/productGamesystems/CreateProductStates.spec.ts @@ -0,0 +1,48 @@ +import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; +import { test, expect } from '@playwright/test'; +import * as PATH from 'path'; +import {GameModel} from "../../../src/app/game-model/GameModel"; +import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; +import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; +import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; +import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; +import exp = require("node:constants"); +import {end} from "electron-debug"; +import {GamesystemTrainer} from "./GamesystemTrainer"; +import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem"; +import {ProductStateTrainer} from "./ProductStateTrainer"; +import {SimpleState} from "../../../../src/app/game-model/gamesystems/SimpleState"; +test.describe('Test Create ProductStates', () => { + + test("Adding already existent ProductState", async () => { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + const result = gamesystem.createState(gamesystem.states[0].innerStates); + expect(result).toBeUndefined(); + expect(gamesystem.states.length).toEqual(4); + }) + + test("Test empty inputs for ProductState Creation", async ()=> { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.createState([])).toBeUndefined(); + expect(gamesystem.states.length).toEqual(4); + }) + + test("Test invalid inputs for ProductState Creation", async () => { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.createState([ProductStateTrainer.givenUnusedInnerStates(gamesystem)[0]])).toBeUndefined(); + expect(gamesystem.states.length).toEqual(4); + }) + + test("Test ProductState Creation with foreign State", async () => { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + const simpleState = new SimpleState(ProductStateTrainer.INNERSTATE_LETTER_3); + expect(gamesystem.createState([simpleState])).toBeUndefined(); + expect(gamesystem.states.length).toEqual(4); + }) + + test("Test valid ProductStateCreation", async () => { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.createState(ProductStateTrainer.givenUnusedInnerStates(gamesystem))).toBeDefined(); + expect(gamesystem.states.length).toEqual(5); + }) +}); diff --git a/e2e/game-model/gamesystems/productGamesystems/EqualInnerStates.spec.ts b/e2e/game-model/gamesystems/productGamesystems/EqualInnerStates.spec.ts new file mode 100644 index 0000000..1b6415e --- /dev/null +++ b/e2e/game-model/gamesystems/productGamesystems/EqualInnerStates.spec.ts @@ -0,0 +1,37 @@ +import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; +import { test, expect } from '@playwright/test'; +import * as PATH from 'path'; +import {GameModel} from "../../../src/app/game-model/GameModel"; +import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; +import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; +import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; +import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; +import exp = require("node:constants"); +import {end} from "electron-debug"; +import {GamesystemTrainer} from "./GamesystemTrainer"; +import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem"; +import {ProductStateTrainer} from "./ProductStateTrainer"; +import {SimpleState} from "../../../../src/app/game-model/gamesystems/SimpleState"; +test.describe('Test Check Equal of Innerstates', () => { + + test("Test invalid input for equal checking", async()=> { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.states[0].equalInnerStates(null)).toBeFalsy(); + expect(gamesystem.states[0].equalInnerStates(undefined)).toBeFalsy(); + }) + + test("Test empty input for equal checking", async ()=> { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.states[0].equalInnerStates([])).toBeFalsy(); + }) + + test("Test identical inner states for equal", async ()=> { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.states[0].equalInnerStates(gamesystem.states[0].innerStates)).toBeTruthy(); + }) + + test("Test slightly derivating inner states for Equal", async ()=> { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.states[0].equalInnerStates(gamesystem.states[1].innerStates)).toBeFalsy(); + }) +}); diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts b/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts new file mode 100644 index 0000000..9c55c46 --- /dev/null +++ b/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts @@ -0,0 +1,48 @@ +import {ProductGamesystem} from "../../../../src/app/game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem"; +import {ProductState} from "../../../../src/app/game-model/gamesystems/ProductState"; + +export class ProductStateTrainer { + static INNERSTATE_LETTER_1 = "A"; + static INNERSTATE_LETTER_2 = "B"; + static INNERSTATE_LETTER_3 = "C"; + static INNERSTATE_NUMBER_1 = "1"; + static INNERSTATE_NUMBER_2 = "2"; + static INNERSTATE_NUMBER_3 = "3"; + + static LETTERS_GAMESYSTEM_NAME = "Letters"; + static NUMBERS_GAMESYSTEM_NAME = "Numbers"; + static PRODUCT_GAMESYSTEM_NAME = "Product Gamesystem"; + + static givenFullProductGamesystemWithTwoStates() { + const letter_Gamesystem = new SimpleGamesystem(this.LETTERS_GAMESYSTEM_NAME); + const letter_1 = letter_Gamesystem.createState(this.INNERSTATE_LETTER_1, "")!; + const letter_2 = letter_Gamesystem.createState(this.INNERSTATE_LETTER_2, "")!; + const number_gamesystem = new SimpleGamesystem(this.NUMBERS_GAMESYSTEM_NAME); + const number_1 = number_gamesystem.createState(this.INNERSTATE_NUMBER_1, "")!; + const number_2 = number_gamesystem.createState(this.INNERSTATE_NUMBER_2, "")!; + const productGamesystem = new ProductGamesystem(this.PRODUCT_GAMESYSTEM_NAME); + + productGamesystem.states.push(new ProductState( [letter_1, number_1])); + productGamesystem.states.push(new ProductState( [letter_1, number_2])); + productGamesystem.states.push(new ProductState( [letter_2, number_1])); + productGamesystem.states.push(new ProductState( [letter_2, number_2])); + + productGamesystem.innerGamesystems.push(letter_Gamesystem); + productGamesystem.innerGamesystems.push(number_gamesystem); + + return productGamesystem; + + } + + static givenUnusedInnerStates(productGamesystem: ProductGamesystem) { + const letterGamesystem = productGamesystem.findChildSystemByName(ProductStateTrainer.LETTERS_GAMESYSTEM_NAME) as SimpleGamesystem; + const numberGamesystem = productGamesystem.findChildSystemByName(ProductStateTrainer.NUMBERS_GAMESYSTEM_NAME) as SimpleGamesystem; + + const letterGamesystemState = letterGamesystem.createState(ProductStateTrainer.INNERSTATE_LETTER_3)!; + const numberGamesystemState = numberGamesystem.createState(ProductStateTrainer.INNERSTATE_NUMBER_3)!; + + return [letterGamesystemState, numberGamesystemState]; + } + +} diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c23a46e..9218ceb 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -15,6 +15,8 @@ import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/de import {ScriptAccount} from "./game-model/scriptAccounts/ScriptAccount"; import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component"; import {SimpleGamesystem} from "./game-model/gamesystems/SimpleGamesystem"; +import {ProductGamesystem} from "./game-model/gamesystems/ProductGamesystem"; +import {ProductState} from "./game-model/gamesystems/ProductState"; @Component({ selector: 'app-root', @@ -150,10 +152,19 @@ export class AppComponent implements OnInit{ const springState = season.createState("Spring", "Spring, also known as springtime, is one of the four temperate seasons, succeeding winter and preceding summer."); const summerState = season.createState("Summer", "Summer is the hottest and brightest of the four temperate seasons, occurring after spring and before autumn. "); - season.createTransition(springState!, summerState!); + const sunnyState = weather.createState("Sunny", "The sun is shining. No clouds, no rain, no storm."); + const rainingState = weather.createState("Raining", "It rains") - this.gameModel.addGamesystem(weather) - this.gameModel.addGamesystem(season); + season.createTransition(springState!, summerState!); + weather.createTransition(sunnyState!, rainingState!); + + const weather_season = new ProductGamesystem("Weather-Season"); + weather_season.addChildGamesystem(weather); + weather_season.addChildGamesystem(season); + + weather_season.createState(ProductState.computeProductStateLabel([springState!, sunnyState!]), "", [springState!, sunnyState!]); + + this.gameModel.addGamesystem(weather_season); } openScriptAccountsOverview() { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 4461bfd..9a9cb35 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -51,6 +51,9 @@ import { SimpleTransitionEditorComponent } from "./editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component"; import {MatOption, MatSelect} from "@angular/material/select"; +import { + ProductGamesystemEditorComponent +} from "./editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component"; // AoT requires an exported function for factories const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); @@ -121,7 +124,8 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl MatCheckbox, MatSelect, MatOption, - MatHint + MatHint, + ProductGamesystemEditorComponent ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html index 49bfe84..84988b6 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html @@ -1 +1,2 @@ + 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 new file mode 100644 index 0000000..65a72dd --- /dev/null +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.html @@ -0,0 +1 @@ + diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.scss b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.spec.ts b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.spec.ts new file mode 100644 index 0000000..659bfd4 --- /dev/null +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProductGamesystemEditorComponent } from './product-gamesystem-editor.component'; + +describe('ProductGamesystemEditorComponent', () => { + let component: ProductGamesystemEditorComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ProductGamesystemEditorComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ProductGamesystemEditorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); 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 new file mode 100644 index 0000000..5648def --- /dev/null +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts @@ -0,0 +1,17 @@ +import {Component, Input} from '@angular/core'; +import {ProductGamesystem} from "../../../game-model/gamesystems/ProductGamesystem"; +import {ProductStateEditorComponent} from "../state-editor/product-state-editor/product-state-editor.component"; + +@Component({ + selector: 'app-product-gamesystem-editor', + standalone: true, + imports: [ + ProductStateEditorComponent + ], + templateUrl: './product-gamesystem-editor.component.html', + styleUrl: './product-gamesystem-editor.component.scss' +}) +export class ProductGamesystemEditorComponent { + + @Input() gamesystem: ProductGamesystem | undefined +} diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html new file mode 100644 index 0000000..1f4a1d3 --- /dev/null +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html @@ -0,0 +1 @@ +

product-state-editor works!

diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.spec.ts b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.spec.ts new file mode 100644 index 0000000..21f6882 --- /dev/null +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProductStateEditorComponent } from './product-state-editor.component'; + +describe('ProductStateEditorComponent', () => { + let component: ProductStateEditorComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ProductStateEditorComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ProductStateEditorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); 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 new file mode 100644 index 0000000..608c881 --- /dev/null +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts @@ -0,0 +1,14 @@ +import {Component, Input} from '@angular/core'; +import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem"; + +@Component({ + selector: 'app-product-state-editor', + standalone: true, + imports: [], + templateUrl: './product-state-editor.component.html', + styleUrl: './product-state-editor.component.scss' +}) +export class ProductStateEditorComponent { + + @Input() gamesystem: ProductGamesystem | undefined +} diff --git a/src/app/game-model/gamesystems/Gamesystem.ts b/src/app/game-model/gamesystems/Gamesystem.ts index 0dea6ba..2625649 100644 --- a/src/app/game-model/gamesystems/Gamesystem.ts +++ b/src/app/game-model/gamesystems/Gamesystem.ts @@ -11,8 +11,6 @@ export abstract class Gamesystem extends ModelComponent{ super(gamesystemName, "", ModelComponentType.GAMESYTEM); } - abstract createState(label: string, description: string): S|undefined; - abstract createTransition(startingState: S, endingState: S): T|undefined; abstract removeState(state: S): boolean; diff --git a/src/app/game-model/gamesystems/ProductGamesystem.ts b/src/app/game-model/gamesystems/ProductGamesystem.ts index 84a135d..46db3d5 100644 --- a/src/app/game-model/gamesystems/ProductGamesystem.ts +++ b/src/app/game-model/gamesystems/ProductGamesystem.ts @@ -33,8 +33,14 @@ export class ProductGamesystem extends Gamesystem[]): ProductState | undefined { + if(innerStates.length == this.innerGamesystems.length && this.findProductStateByInnerStates(innerStates)== undefined) { + const productState = new ProductState(innerStates); + this.states.push(productState); + return productState; + } else { + return undefined; + } } createTransition(startingState: ProductState, endingState: ProductState): ProductTransition | undefined { @@ -57,4 +63,21 @@ export class ProductGamesystem extends Gamesystem, Transition>) { this.innerGamesystems = this.innerGamesystems.filter(childSystem => childSystem != gamesystem); } + + findProductStateByInnerStates(innerStates: State[]) { + return this.states.find(productState => productState.equalInnerStates(innerStates)); + } + + findChildSystemByName(gamesystemName: string) { + const gamesystemQueue: Gamesystem, Transition>[] = []; + this.innerGamesystems.forEach(gamesystem => gamesystemQueue.push(gamesystem)); + + while(gamesystemName.length > 0 ){ + const currentGamesystem = gamesystemQueue.shift(); + if(currentGamesystem!.componentName === gamesystemName) { + return currentGamesystem; + } + } + return undefined; + } } diff --git a/src/app/game-model/gamesystems/ProductState.ts b/src/app/game-model/gamesystems/ProductState.ts index 8a5cbaf..f499f35 100644 --- a/src/app/game-model/gamesystems/ProductState.ts +++ b/src/app/game-model/gamesystems/ProductState.ts @@ -1,7 +1,42 @@ import {ProductTransition} from "./ProductTransition"; import {State} from "./State"; import {SimpleState} from "./SimpleState"; +import {Transition} from "./Transition"; export class ProductState extends State { - innerStates: SimpleState[] = []; + innerStates: State[] = []; + + constructor(innerStates: State[]) { + super(); + this.innerStates = innerStates; + } + + equalInnerStates(innerStates: State[]) { + if(innerStates == undefined || this.innerStates.length != innerStates.length) { + return false; + } + + for(let i=0; i>): boolean { + if(state instanceof SimpleState || this.innerStates.length != (state as ProductState).innerStates.length) { + return false; + } + + for(let i=0; i { + stateLabel: string = ""; + stateDescription: string = ""; + + + constructor(stateLabel: string, stateDescription: string) { + super(); + this.stateLabel = stateLabel; + this.stateDescription = stateDescription; + } + + equals(state: State>): boolean { + if(!(state instanceof SimpleState)) { + return false; + } + return this.stateLabel === (state as SimpleState).stateLabel; + } + } diff --git a/src/app/game-model/gamesystems/State.ts b/src/app/game-model/gamesystems/State.ts index 5184811..d6b78de 100644 --- a/src/app/game-model/gamesystems/State.ts +++ b/src/app/game-model/gamesystems/State.ts @@ -1,19 +1,12 @@ import {Transition} from "./Transition"; export abstract class State> { - stateLabel: string = ""; - stateDescription: string = ""; + incomingTransitions: T[] =[]; outgoingTransitions: T[] =[]; initial: boolean = false; - - constructor(stateLabel: string, stateDescription: string) { - this.stateLabel = stateLabel; - this.stateDescription = stateDescription; - } - addIncomingTransition(transition: T) { this.incomingTransitions.push(transition); } @@ -29,4 +22,6 @@ export abstract class State> { removeOutgoingTransition(transition: T) { } + + abstract equals(state: State>): boolean; } -- 2.34.1 From d219c2180b5e10e741fd5f2425f12e352db6f9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sat, 10 Feb 2024 17:12:01 +0100 Subject: [PATCH 02/30] Remove StateLabel and Description from Dummy ProductStateCreation --- src/app/app.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9218ceb..95cb454 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -162,7 +162,7 @@ export class AppComponent implements OnInit{ weather_season.addChildGamesystem(weather); weather_season.addChildGamesystem(season); - weather_season.createState(ProductState.computeProductStateLabel([springState!, sunnyState!]), "", [springState!, sunnyState!]); + weather_season.createState([springState!, sunnyState!]); this.gameModel.addGamesystem(weather_season); } -- 2.34.1 From 57d7babf7128ba85b27f5103f6c96487abe6d9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sat, 10 Feb 2024 17:37:05 +0100 Subject: [PATCH 03/30] Test ProductStateTransition Creation --- .../CreateProductTransitions.spec.ts | 51 +++++++++++++++++++ .../productGamesystems/ProductStateTrainer.ts | 5 ++ .../gamesystems/ProductGamesystem.ts | 19 ++++++- 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 e2e/game-model/gamesystems/productGamesystems/CreateProductTransitions.spec.ts diff --git a/e2e/game-model/gamesystems/productGamesystems/CreateProductTransitions.spec.ts b/e2e/game-model/gamesystems/productGamesystems/CreateProductTransitions.spec.ts new file mode 100644 index 0000000..fc7dcab --- /dev/null +++ b/e2e/game-model/gamesystems/productGamesystems/CreateProductTransitions.spec.ts @@ -0,0 +1,51 @@ +import { test, expect } from '@playwright/test'; +import {ProductStateTrainer} from "./ProductStateTrainer"; +import {ProductState} from "../../../../src/app/game-model/gamesystems/ProductState"; +import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem"; +test.describe('Test Create ProductTransitions', () => { + test("Test ProductTransition Creation with invalid inputs", async ()=> { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.createTransition(null, null)).toBeUndefined(); + expect(gamesystem.transitions.length).toEqual(3); + expect(gamesystem.createTransition(undefined, undefined)).toBeUndefined(); + expect(gamesystem.transitions.length).toEqual(3); + + expect(gamesystem.createTransition(undefined, gamesystem.states[0])).toBeUndefined(); + expect(gamesystem.transitions.length).toEqual(3); + expect(gamesystem.createTransition(null, gamesystem.states[0])).toBeUndefined(); + expect(gamesystem.transitions.length).toEqual(3); + + expect(gamesystem.createTransition(gamesystem.states[0], undefined)).toBeUndefined(); + expect(gamesystem.transitions.length).toEqual(3); + expect(gamesystem.createTransition(gamesystem.states[0], null)).toBeUndefined(); + expect(gamesystem.transitions.length).toEqual(3); + }) + + test("Test ProductTransitition Creation with duplicate Transition", async ()=> { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.createTransition(gamesystem.states[0], gamesystem.states[1])).toBeUndefined(); + }) + + test("Test ProductTransition Creation with foreign States", async () => { + const simpleGamesystems: SimpleGamesystem[] = [new SimpleGamesystem("Test", "Test"), new SimpleGamesystem("Test1", "Test2")]; + const simpleGamesystem2: SimpleGamesystem[] = [new SimpleGamesystem("Test3", "Test"), new SimpleGamesystem("Test4", "Test2")]; + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + const foreignProductState = new ProductState(simpleGamesystems); + const foreignEndProductState = new ProductState(simpleGamesystem2); + + expect(gamesystem.createTransition(foreignProductState, foreignEndProductState)).toBeUndefined(); + expect(gamesystem.transitions.length).toEqual(3); + }) + + test("Test creating SelfTransitions", async ()=> { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.createTransition(gamesystem.states[0], gamesystem.states[0])).toBeUndefined(); + expect(gamesystem.transitions.length).toEqual(3); + }) + + test("Test Valid Transition Creation", async () => { + const gamesystem = ProductStateTrainer.givenFullProductGamesystemWithTwoStates(); + expect(gamesystem.createTransition(gamesystem.states[1], gamesystem.states[2])).toBeDefined(); + expect(gamesystem.transitions.length).toEqual(4) + }) +}); diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts b/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts index 9c55c46..90ef6a1 100644 --- a/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts +++ b/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts @@ -1,6 +1,7 @@ import {ProductGamesystem} from "../../../../src/app/game-model/gamesystems/ProductGamesystem"; import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem"; import {ProductState} from "../../../../src/app/game-model/gamesystems/ProductState"; +import {ProductTransition} from "../../../../src/app/game-model/gamesystems/ProductTransition"; export class ProductStateTrainer { static INNERSTATE_LETTER_1 = "A"; @@ -28,6 +29,10 @@ export class ProductStateTrainer { productGamesystem.states.push(new ProductState( [letter_2, number_1])); productGamesystem.states.push(new ProductState( [letter_2, number_2])); + productGamesystem.transitions.push(new ProductTransition(productGamesystem.states[0], productGamesystem.states[1])) + productGamesystem.transitions.push(new ProductTransition(productGamesystem.states[0], productGamesystem.states[2])) + productGamesystem.transitions.push(new ProductTransition(productGamesystem.states[0], productGamesystem.states[3])) + productGamesystem.innerGamesystems.push(letter_Gamesystem); productGamesystem.innerGamesystems.push(number_gamesystem); diff --git a/src/app/game-model/gamesystems/ProductGamesystem.ts b/src/app/game-model/gamesystems/ProductGamesystem.ts index 46db3d5..0c8c30c 100644 --- a/src/app/game-model/gamesystems/ProductGamesystem.ts +++ b/src/app/game-model/gamesystems/ProductGamesystem.ts @@ -6,6 +6,7 @@ import {Transition} from "./Transition"; import {SimpleState} from "./SimpleState"; import {SimpleGamesystem} from "./SimpleGamesystem"; import {GameModel} from "../GameModel"; +import {ProductStateTrainer} from "../../../../e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer"; export class ProductGamesystem extends Gamesystem { @@ -44,7 +45,14 @@ export class ProductGamesystem extends Gamesystem + transition.startingState.equals(startingState) && transition.endingState.equals(endingState)) != undefined; + } + + private existsState(state: ProductState) { + return this.states.find(s => s.equals(state)) != undefined; + } } -- 2.34.1 From 311b7ee7bb6b0b4b9815ef608d98380a09ca6bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sun, 11 Feb 2024 18:21:08 +0100 Subject: [PATCH 04/30] Generate ProductGamesystems --- .../ProductStateGeneration.spec.ts | 27 +++++++ .../ProductSystemGenerationTrainer.ts | 29 ++++++++ .../gamesystems/ProductGamesystem.ts | 70 +++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts create mode 100644 e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts b/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts new file mode 100644 index 0000000..77f7c29 --- /dev/null +++ b/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts @@ -0,0 +1,27 @@ +import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright'; +import { test, expect } from '@playwright/test'; +import * as PATH from 'path'; +import {GameModel} from "../../../src/app/game-model/GameModel"; +import {Gamesystem} from "../../src/app/game-model/gamesystems/Gamesystem"; +import {ScriptAccount} from "../../../src/app/game-model/scriptAccounts/ScriptAccount"; +import {ModelComponentType} from "../../../src/app/game-model/ModelComponentType"; +import {SimpleGamesystem} from "../../../src/app/game-model/gamesystems/SimpleGamesystem"; +import exp = require("node:constants"); +import {end} from "electron-debug"; +import {GamesystemTrainer} from "./GamesystemTrainer"; +import {ProductGamesystem} from "../../../src/app/game-model/gamesystems/ProductGamesystem"; +import {ProductStateTrainer} from "./ProductStateTrainer"; +import {SimpleState} from "../../../../src/app/game-model/gamesystems/SimpleState"; +import {ProductSystemGenerationTrainer} from "./ProductSystemGenerationTrainer"; +test.describe('Test Create ProductStates', () => { + + test("Test simple Binary Product State", async () => { + const gamesystem = ProductSystemGenerationTrainer.givenSimplestProductSystem(); + gamesystem.generateFromChildsystems(); + + expect(gamesystem.states.length).toEqual(4); + expect(gamesystem.transitions.length).toEqual(5); + }) + + +}); diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts b/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts new file mode 100644 index 0000000..f847f9a --- /dev/null +++ b/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts @@ -0,0 +1,29 @@ +import {ProductGamesystem} from "../../../../src/app/game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../../src/app/game-model/gamesystems/SimpleGamesystem"; + +export class ProductSystemGenerationTrainer { + + static PRODUCTGAMESYSTEMNAME = "ProductGamesystem"; + static CHILDGAMESYSTEMNAME_LEFT = "Left Child System"; + static CHILDGAMESYSTEMNAME_RIGHT = "Right Child System"; + + static LEFTCHILDSYSTEM_A_NODE_NAME = "A"; + static LEFTCHILDSYSTEM_B_NODE_NAME = "B"; + + static RIGHTCHILDSYSTEM_A_NODE_NAME = "1"; + static RIGHTCHILDSYSTEM_B_NODE_NAME = "2"; + static givenSimplestProductSystem() { + const productsystem = new ProductGamesystem(ProductSystemGenerationTrainer.PRODUCTGAMESYSTEMNAME); + const left_childsystem = new SimpleGamesystem(ProductSystemGenerationTrainer.CHILDGAMESYSTEMNAME_LEFT); + const right_childsystem = new SimpleGamesystem(ProductSystemGenerationTrainer.CHILDGAMESYSTEMNAME_RIGHT); + + left_childsystem.createTransition(left_childsystem.createState(ProductSystemGenerationTrainer.LEFTCHILDSYSTEM_A_NODE_NAME, "")!, + left_childsystem.createState(ProductSystemGenerationTrainer.LEFTCHILDSYSTEM_B_NODE_NAME, "")!); + right_childsystem.createTransition(right_childsystem.createState(ProductSystemGenerationTrainer.RIGHTCHILDSYSTEM_A_NODE_NAME, "")!, + right_childsystem.createState(ProductSystemGenerationTrainer.RIGHTCHILDSYSTEM_B_NODE_NAME, "")!); + productsystem.addChildGamesystem(left_childsystem); + productsystem.addChildGamesystem(right_childsystem); + + return productsystem; + } +} diff --git a/src/app/game-model/gamesystems/ProductGamesystem.ts b/src/app/game-model/gamesystems/ProductGamesystem.ts index 0c8c30c..11583f3 100644 --- a/src/app/game-model/gamesystems/ProductGamesystem.ts +++ b/src/app/game-model/gamesystems/ProductGamesystem.ts @@ -63,6 +63,76 @@ export class ProductGamesystem extends Gamesystem, rightSystem: Gamesystem, left_temp: boolean) { + const productGamesystem = new ProductGamesystem("Temporary Gamesystem"); + productGamesystem.addChildGamesystem(leftSystem); + productGamesystem.addChildGamesystem(rightSystem); + leftSystem.states.forEach(leftState => { + rightSystem.states.forEach(rightState => { + for(let i=0; i, rightInnerState: State, left_temp: boolean) { + let innerStates: State[] = []; + if(!left_temp) { + innerStates = [leftInnerState, rightInnerState]; + } else { + const left_inner_product_state = leftInnerState as ProductState; + left_inner_product_state.innerStates.forEach(state => innerStates.push(state)); + innerStates.push(rightInnerState); + } + + + const binary_productState = this.findProductStateByInnerStates(innerStates); + if(binary_productState == undefined) { + return this.createState(innerStates)!; + } else { + return binary_productState!; + } + } + + + addChildGamesystem(gamesystem: Gamesystem, Transition>) { this.innerGamesystems.push(gamesystem); -- 2.34.1 From e2cfe97b61cf61fda38e299cff098f92b5110c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sun, 11 Feb 2024 18:41:01 +0100 Subject: [PATCH 05/30] Test triple ProductGamesystem generation --- .../ProductStateGeneration.spec.ts | 7 +++++++ .../ProductSystemGenerationTrainer.ts | 14 ++++++++++++++ .../game-model/gamesystems/ProductGamesystem.ts | 14 ++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts b/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts index 77f7c29..c9991f3 100644 --- a/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts +++ b/e2e/game-model/gamesystems/productGamesystems/ProductStateGeneration.spec.ts @@ -23,5 +23,12 @@ test.describe('Test Create ProductStates', () => { expect(gamesystem.transitions.length).toEqual(5); }) + test("Test simple triple Product State", async () => { + const gamesystem = ProductSystemGenerationTrainer.givenTrippleProductSystem(); + gamesystem.generateFromChildsystems(); + + expect(gamesystem.states.length).toEqual(8); + expect(gamesystem.transitions.length).toEqual(19) + }) }); diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts b/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts index f847f9a..aa34557 100644 --- a/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts +++ b/e2e/game-model/gamesystems/productGamesystems/ProductSystemGenerationTrainer.ts @@ -6,12 +6,16 @@ export class ProductSystemGenerationTrainer { static PRODUCTGAMESYSTEMNAME = "ProductGamesystem"; static CHILDGAMESYSTEMNAME_LEFT = "Left Child System"; static CHILDGAMESYSTEMNAME_RIGHT = "Right Child System"; + static CHILDGAMESYSTEMNAME_MIDDLE = "Middle Child System"; static LEFTCHILDSYSTEM_A_NODE_NAME = "A"; static LEFTCHILDSYSTEM_B_NODE_NAME = "B"; static RIGHTCHILDSYSTEM_A_NODE_NAME = "1"; static RIGHTCHILDSYSTEM_B_NODE_NAME = "2"; + + static MIDDLECHILDSYSTEM_A_NODE_NAME = "Sun"; + static MIDDLECHILDSYSTEM_B_NODE_NAME = "Rain"; static givenSimplestProductSystem() { const productsystem = new ProductGamesystem(ProductSystemGenerationTrainer.PRODUCTGAMESYSTEMNAME); const left_childsystem = new SimpleGamesystem(ProductSystemGenerationTrainer.CHILDGAMESYSTEMNAME_LEFT); @@ -26,4 +30,14 @@ export class ProductSystemGenerationTrainer { return productsystem; } + + static givenTrippleProductSystem() { + const gamesystem = this.givenSimplestProductSystem(); + const middle_childsystem = new SimpleGamesystem(this.CHILDGAMESYSTEMNAME_MIDDLE); + + middle_childsystem.createTransition(middle_childsystem.createState(ProductSystemGenerationTrainer.MIDDLECHILDSYSTEM_A_NODE_NAME, "")!, + middle_childsystem.createState(ProductSystemGenerationTrainer.MIDDLECHILDSYSTEM_B_NODE_NAME, "")!); + gamesystem.addChildGamesystem(middle_childsystem); + return gamesystem; + } } diff --git a/src/app/game-model/gamesystems/ProductGamesystem.ts b/src/app/game-model/gamesystems/ProductGamesystem.ts index 11583f3..6fd5e31 100644 --- a/src/app/game-model/gamesystems/ProductGamesystem.ts +++ b/src/app/game-model/gamesystems/ProductGamesystem.ts @@ -65,18 +65,21 @@ export class ProductGamesystem extends Gamesystem[] = [this.innerGamesystems[0], this.innerGamesystems[1]]; + let gamesystem: ProductGamesystem = ProductGamesystem.generateFromChildsystems(this.innerGamesystems[0], this.innerGamesystems[1], false, integratedSystems); + for(let i=2; i, rightSystem: Gamesystem, left_temp: boolean) { + static generateFromChildsystems(leftSystem: Gamesystem, rightSystem: Gamesystem, left_temp: boolean, integratedSystems: Gamesystem[]) { const productGamesystem = new ProductGamesystem("Temporary Gamesystem"); - productGamesystem.addChildGamesystem(leftSystem); - productGamesystem.addChildGamesystem(rightSystem); + integratedSystems.forEach(integratedSystem => productGamesystem.addChildGamesystem(integratedSystem)); + leftSystem.states.forEach(leftState => { rightSystem.states.forEach(rightState => { for(let i=0; i Date: Sun, 11 Feb 2024 18:47:41 +0100 Subject: [PATCH 06/30] Fix failing SimpleGamesystem tests --- .../gamesystems/productGamesystems/ProductStateTrainer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts b/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts index 90ef6a1..a0d09a4 100644 --- a/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts +++ b/e2e/game-model/gamesystems/productGamesystems/ProductStateTrainer.ts @@ -44,8 +44,8 @@ export class ProductStateTrainer { const letterGamesystem = productGamesystem.findChildSystemByName(ProductStateTrainer.LETTERS_GAMESYSTEM_NAME) as SimpleGamesystem; const numberGamesystem = productGamesystem.findChildSystemByName(ProductStateTrainer.NUMBERS_GAMESYSTEM_NAME) as SimpleGamesystem; - const letterGamesystemState = letterGamesystem.createState(ProductStateTrainer.INNERSTATE_LETTER_3)!; - const numberGamesystemState = numberGamesystem.createState(ProductStateTrainer.INNERSTATE_NUMBER_3)!; + const letterGamesystemState = letterGamesystem.createState(ProductStateTrainer.INNERSTATE_LETTER_3, "")!; + const numberGamesystemState = numberGamesystem.createState(ProductStateTrainer.INNERSTATE_NUMBER_3, "")!; return [letterGamesystemState, numberGamesystemState]; } -- 2.34.1 From f69d105164c946fbda4803f2cd3a6be5e55708bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sun, 11 Feb 2024 19:59:20 +0100 Subject: [PATCH 07/30] Visualize ProductStates --- .../product-state-editor.component.html | 10 ++- .../product-state-editor.component.scss | 3 + .../product-state-editor.component.ts | 71 ++++++++++++++++++- 3 files changed, 80 insertions(+), 4 deletions(-) diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html index 1f4a1d3..9f68652 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html @@ -1 +1,9 @@ -

product-state-editor works!

+ + + + + + + + +
{{col}}{{getStateLabel(state, i)}}
diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss index e69de29..1922e7f 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss @@ -0,0 +1,3 @@ +table { + width: 100%; +} 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 608c881..e2d6008 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 @@ -1,14 +1,79 @@ -import {Component, Input} from '@angular/core'; +import {Component, Input, OnInit} from '@angular/core'; import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; +import { + MatCell, MatCellDef, + MatColumnDef, MatHeaderCell, MatHeaderCellDef, + MatHeaderRow, + MatHeaderRowDef, + MatRow, + MatRowDef, + MatTable, + MatTableDataSource +} from "@angular/material/table"; +import {SimpleState} from "../../../../game-model/gamesystems/SimpleState"; +import {State} from "../../../../game-model/gamesystems/State"; +import {NgForOf} from "@angular/common"; +import {ProductState} from "../../../../game-model/gamesystems/ProductState"; @Component({ selector: 'app-product-state-editor', standalone: true, - imports: [], + imports: [ + MatTable, + MatRow, + MatRowDef, + MatHeaderRow, + MatHeaderRowDef, + MatColumnDef, + MatHeaderCell, + MatHeaderCellDef, + MatCell, + MatCellDef, + NgForOf + ], templateUrl: './product-state-editor.component.html', styleUrl: './product-state-editor.component.scss' }) -export class ProductStateEditorComponent { +export class ProductStateEditorComponent implements OnInit{ @Input() gamesystem: ProductGamesystem | undefined + displayedColumns: string[] = []; + datasource = new MatTableDataSource(); + + + ngOnInit() { + this.gamesystem!.generateFromChildsystems(); + this.generateColumnNamesRecursively(this.gamesystem!, ""); + this.datasource.data = this.gamesystem!.states; + } + + generateColumnNamesRecursively(gamesystem: ProductGamesystem, nestedColumnName: string) { + gamesystem.innerGamesystems.forEach(innerGamesystem => { + if(innerGamesystem instanceof SimpleGamesystem) { + this.displayedColumns.push(nestedColumnName + innerGamesystem.componentName); + } else { + this.generateColumnNamesRecursively(innerGamesystem as ProductGamesystem, nestedColumnName + innerGamesystem.componentName + "."); + } + }) + } + + protected readonly SimpleState = SimpleState; + + getStateLabel(state: State, i: number) { + return this.computeLeafStates(state)[i].stateLabel; + } + + computeLeafStates(state: State) { + if(state instanceof SimpleState) { + return [state]; + } else { + const productState = state as ProductState; + const leafStates: SimpleState[] = []; + productState.innerStates.forEach(innerState => { + this.computeLeafStates(innerState).forEach(leafState => leafStates.push(leafState)); + }) + return leafStates; + } + } } -- 2.34.1 From 8f5d366dd9ca59c5bb788d1c81a5711a834221ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Mon, 12 Feb 2024 18:07:30 +0100 Subject: [PATCH 08/30] Display Initial Value of ProductStates in their Visualizer --- .../product-state-editor.component.html | 7 ++++++- .../product-state-editor.component.scss | 4 ++++ .../product-state-editor.component.ts | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html index 9f68652..2d1c8bb 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html @@ -1,7 +1,12 @@ - + diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss index 1922e7f..d53103d 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss @@ -1,3 +1,7 @@ table { width: 100%; } + +.mat-column-Initial { + width: 32px; +} 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 e2d6008..0332f73 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 @@ -13,8 +13,9 @@ import { } from "@angular/material/table"; import {SimpleState} from "../../../../game-model/gamesystems/SimpleState"; import {State} from "../../../../game-model/gamesystems/State"; -import {NgForOf} from "@angular/common"; +import {NgForOf, NgIf} from "@angular/common"; import {ProductState} from "../../../../game-model/gamesystems/ProductState"; +import {MatIcon} from "@angular/material/icon"; @Component({ selector: 'app-product-state-editor', @@ -30,7 +31,9 @@ import {ProductState} from "../../../../game-model/gamesystems/ProductState"; MatHeaderCellDef, MatCell, MatCellDef, - NgForOf + NgForOf, + NgIf, + MatIcon ], templateUrl: './product-state-editor.component.html', styleUrl: './product-state-editor.component.scss' @@ -45,6 +48,7 @@ export class ProductStateEditorComponent implements OnInit{ ngOnInit() { this.gamesystem!.generateFromChildsystems(); this.generateColumnNamesRecursively(this.gamesystem!, ""); + this.displayedColumns.push('Initial'); this.datasource.data = this.gamesystem!.states; } -- 2.34.1 From 125b2a7ece030b0a7419a9dc06bb54f9f1566d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Mon, 12 Feb 2024 18:29:45 +0100 Subject: [PATCH 09/30] Open Gamesystem when clicking on button --- src/app/editor/editor.component.html | 3 ++- .../gamesystem-editor.component.html | 3 ++- .../gamesystem-editor.component.ts | 7 ++++- .../product-gamesystem-editor.component.html | 2 +- .../product-gamesystem-editor.component.ts | 8 +++++- .../product-state-editor.component.html | 2 +- .../product-state-editor.component.ts | 27 ++++++++++++++++--- 7 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/app/editor/editor.component.html b/src/app/editor/editor.component.html index dc13cc1..688e3bf 100644 --- a/src/app/editor/editor.component.html +++ b/src/app/editor/editor.component.html @@ -11,7 +11,8 @@ + [gamesystem]="convertModelComponentToGamesystem(modelComponent)" + (onOpenGamesystemEditor)="openGameModelComponent($event)"> diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html index 84988b6..624b252 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html @@ -1,2 +1,3 @@ - + diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts index 666f6a6..e21373f 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts @@ -1,4 +1,4 @@ -import {Component, Input} from '@angular/core'; +import {Component, EventEmitter, Input, Output} from '@angular/core'; import {GameModel} from "../../game-model/GameModel"; import {Gamesystem} from "../../game-model/gamesystems/Gamesystem"; import {State} from "../../game-model/gamesystems/State"; @@ -14,6 +14,7 @@ import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem" export class GamesystemEditorComponent { @Input() gamesystem: Gamesystem, Transition> | undefined + @Output('onOpenGamesystemEditor') openGamesystemEmitter = new EventEmitter(); isSimpleGamesystem() { return this.gamesystem instanceof SimpleGamesystem; @@ -30,4 +31,8 @@ export class GamesystemEditorComponent { return this.gamesystem as ProductGamesystem; } } + + onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { + this.openGamesystemEmitter.emit(gamesystem); + } } 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 65a72dd..d505323 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 +1 @@ - + 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 5648def..c5416a4 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 @@ -1,6 +1,7 @@ -import {Component, Input} from '@angular/core'; +import {Component, EventEmitter, Input, Output} from '@angular/core'; import {ProductGamesystem} from "../../../game-model/gamesystems/ProductGamesystem"; import {ProductStateEditorComponent} from "../state-editor/product-state-editor/product-state-editor.component"; +import {SimpleGamesystem} from "../../../game-model/gamesystems/SimpleGamesystem"; @Component({ selector: 'app-product-gamesystem-editor', @@ -14,4 +15,9 @@ import {ProductStateEditorComponent} from "../state-editor/product-state-editor/ export class ProductGamesystemEditorComponent { @Input() gamesystem: ProductGamesystem | undefined + @Output("onOpenGamesystemEditor") openGamesystemEditorEmitter = new EventEmitter(); + + onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { + this.openGamesystemEditorEmitter.emit(gamesystem); + } } diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html index 2d1c8bb..5fbd207 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html @@ -2,7 +2,7 @@
{{col}}{{getStateLabel(state, i)}} + {{getStateLabel(state, i)}} + + {{state.initial? 'done':'close'}} + +
{{col}} - {{getStateLabel(state, i)}} + {{getLeafState(state, i).stateLabel}} {{state.initial? 'done':'close'}} 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 0332f73..23e6bb4 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 @@ -1,4 +1,4 @@ -import {Component, Input, OnInit} from '@angular/core'; +import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem"; import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; import { @@ -16,6 +16,7 @@ import {State} from "../../../../game-model/gamesystems/State"; import {NgForOf, NgIf} from "@angular/common"; import {ProductState} from "../../../../game-model/gamesystems/ProductState"; import {MatIcon} from "@angular/material/icon"; +import {Gamesystem} from "../../../../game-model/gamesystems/Gamesystem"; @Component({ selector: 'app-product-state-editor', @@ -41,6 +42,7 @@ import {MatIcon} from "@angular/material/icon"; export class ProductStateEditorComponent implements OnInit{ @Input() gamesystem: ProductGamesystem | undefined + @Output('onOpenGamesystemEditor') openGamesystemEditorEmitter = new EventEmitter(); displayedColumns: string[] = []; datasource = new MatTableDataSource(); @@ -64,8 +66,8 @@ export class ProductStateEditorComponent implements OnInit{ protected readonly SimpleState = SimpleState; - getStateLabel(state: State, i: number) { - return this.computeLeafStates(state)[i].stateLabel; + getLeafState(state: State, i: number) { + return this.computeLeafStates(state)[i]; } computeLeafStates(state: State) { @@ -80,4 +82,23 @@ export class ProductStateEditorComponent implements OnInit{ return leafStates; } } + + clickOnInnerState(leafIndex: number) { + const leaf_gamesystems = this.computeLeafGamesystems(this.gamesystem!); + const clicked_gamesystem = leaf_gamesystems[leafIndex]; + this.openGamesystemEditorEmitter.emit(clicked_gamesystem); + } + + computeLeafGamesystems(gamesystem: Gamesystem) { + if(gamesystem instanceof SimpleGamesystem) { + return [gamesystem]; + } else { + const product_gamesystem = gamesystem as ProductGamesystem; + const leaf_gamesystems: SimpleGamesystem[] = []; + product_gamesystem.innerGamesystems.forEach(innerGamesystem => { + this.computeLeafGamesystems(innerGamesystem).forEach(leafGamesystem => leaf_gamesystems.push(leafGamesystem)) + }) + return leaf_gamesystems; + } + } } -- 2.34.1 From 8f45063d4f1921c70ee116c6660045b4281ae930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Mon, 12 Feb 2024 18:34:23 +0100 Subject: [PATCH 10/30] Change displayed tab when a new one is opened --- src/app/editor/editor.component.html | 2 +- src/app/editor/editor.component.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/editor/editor.component.html b/src/app/editor/editor.component.html index 688e3bf..59dcd6f 100644 --- a/src/app/editor/editor.component.html +++ b/src/app/editor/editor.component.html @@ -1,4 +1,4 @@ - + inventory_2 diff --git a/src/app/editor/editor.component.ts b/src/app/editor/editor.component.ts index c042346..480330d 100644 --- a/src/app/editor/editor.component.ts +++ b/src/app/editor/editor.component.ts @@ -15,10 +15,12 @@ import {Transition} from "../game-model/gamesystems/Transition"; export class EditorComponent { gameModelComponents: ModelComponent[] = []; @Output("onModelNameUpdate") onModelNameUpdateEmitter = new EventEmitter(); + activeTab: number = this.gameModelComponents.length; openGameModelComponent(gameModelComponent: ModelComponent) { if(!this.gameModelComponents.includes(gameModelComponent)) { this.gameModelComponents.push(gameModelComponent); + this.activeTab = this.gameModelComponents.length; } } -- 2.34.1 From e607dc167bef9a5d71b103c3d4df62cd1059a31b Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 16:29:57 +0100 Subject: [PATCH 11/30] Include ntfy notification --- .gitea/workflows/demo.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 3c2941c..e63a990 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -21,3 +21,11 @@ jobs: - name: Run e2e tests run: npm run e2e + - name: ntfy-notifications + uses: niniyas/ntfy-action@master + with: + url: ${{ secrets.NTFY_URL }} + topic: ${{ secrets.NTFY_TOPIC }} + headers: ${{ secrets.NTFY_HEADERS }} + + -- 2.34.1 From 9cc93cd9e2701d7d260c1be110652540567efbf0 Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 16:42:52 +0100 Subject: [PATCH 12/30] Incude authorization header --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index e63a990..87f2c3c 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -26,6 +26,6 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: ${{ secrets.NTFY_HEADERS }} + headers: '{"authorization": ${{ secrets.NTFY_HEADERS }}}' -- 2.34.1 From 03528700ecec4ec0c968b0298b92e8f53177b58f Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 16:51:17 +0100 Subject: [PATCH 13/30] Remove specific auth --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 87f2c3c..e63a990 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -26,6 +26,6 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: '{"authorization": ${{ secrets.NTFY_HEADERS }}}' + headers: ${{ secrets.NTFY_HEADERS }} -- 2.34.1 From 4839c2362ed49064cf0ea5b823a381cc783424d3 Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 16:54:19 +0100 Subject: [PATCH 14/30] Bearer Token directly in workflow --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index e63a990..8559ee9 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -26,6 +26,6 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: ${{ secrets.NTFY_HEADERS }} + headers: {"authorization": "Bearer tk_fbhpf1fpuea0qneljvhp7jvt68lmb"} -- 2.34.1 From 83591580daa56cccf5b2affdb2340d0610cfe25a Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 16:54:57 +0100 Subject: [PATCH 15/30] Include '' --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 8559ee9..7aca8f6 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -26,6 +26,6 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: {"authorization": "Bearer tk_fbhpf1fpuea0qneljvhp7jvt68lmb"} + headers: '{"authorization": "Bearer tk_fbhpf1fpuea0qneljvhp7jvt68lmb"}' -- 2.34.1 From c5e77b7b4bb15723afeff15ae96a49c328e8cbbb Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 19:25:54 +0100 Subject: [PATCH 16/30] Use Secret instead of plain auth token --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 7aca8f6..9479c39 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -26,6 +26,6 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: '{"authorization": "Bearer tk_fbhpf1fpuea0qneljvhp7jvt68lmb"}' + headers: '{"authorization": "${{ NTFY_HEADERS }}"}' -- 2.34.1 From 421929f4284c615d29b3e5bd4d08344d5ead1454 Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 19:34:23 +0100 Subject: [PATCH 17/30] Try Without auth keyword in workflow-file --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 9479c39..91bb0f7 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -26,6 +26,6 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: '{"authorization": "${{ NTFY_HEADERS }}"}' + headers: '${{ NTFY_HEADERS }}' -- 2.34.1 From 950e5c6862a47fc97e5595429518cf8b157e850d Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 19:36:37 +0100 Subject: [PATCH 18/30] fix typo (secrets.ntfy_headers) --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 91bb0f7..49a5a1c 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -26,6 +26,6 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: '${{ NTFY_HEADERS }}' + headers: '${{ secrets.NTFY_HEADERS }}' -- 2.34.1 From 2df67dd99dc3d46db686d08ca43d42df659ac40a Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 15 Feb 2024 19:39:47 +0100 Subject: [PATCH 19/30] Try with auth keyword and corrected secrets access --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 49a5a1c..b796cbb 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -26,6 +26,6 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: '${{ secrets.NTFY_HEADERS }}' + headers: '{"authorization": "${{ secrets.NTFY_HEADERS }}"}' -- 2.34.1 From dfce2688743f77c78d097a0df43469fdae33cedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Thu, 15 Feb 2024 19:51:37 +0100 Subject: [PATCH 20/30] Differentiate Ntfy Notification when success/failure --- .gitea/workflows/demo.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index b796cbb..a2b448f 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -21,11 +21,29 @@ jobs: - name: Run e2e tests run: npm run e2e - - name: ntfy-notifications + + - name: ntfy-notifications-failure uses: niniyas/ntfy-action@master + if: failure() with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} headers: '{"authorization": "${{ secrets.NTFY_HEADERS }}"}' + priority: 5 + tags: +1,partying_face,action,failed + details: Workflow has failed! + actions: 'default' + - name: ntfy-notifications-success + uses: niniyas/ntfy-action@master + if: success() + with: + url: ${{ secrets.NTFY_URL }} + topic: ${{ secrets.NTFY_TOPIC }} + priority: 4 + headers: '{"authorization": "${{ secrets.NTFY_HEADERS }}"}' + tags: +1,partying_face,action,successfully,completed + details: Workflow has been successfully completed! + icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png' + image: true -- 2.34.1 From 7c6733e4124a3967dd63f84108a3ffa060e598fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Thu, 15 Feb 2024 19:56:36 +0100 Subject: [PATCH 21/30] Test failing testpipeline --- e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts b/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts index 00688ac..fefda8b 100644 --- a/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts +++ b/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts @@ -14,7 +14,7 @@ test.describe('Test ScriptAccounts', () => { expect(scriptAccunt.componentName).toEqual("ScriptAccount"); expect(scriptAccunt.componentDescription).toEqual("Description"); expect(scriptAccunt.type).toEqual(ModelComponentType.SCRIPTACCOUNT); - expect(scriptAccunt.minValue).toEqual(0); + expect(scriptAccunt.minValue).toEqual(2); expect(scriptAccunt.maxValue).toEqual(100); }) -- 2.34.1 From 6934bcfb51e493d406186df7b3b1de4bb4bdd491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Thu, 15 Feb 2024 20:00:55 +0100 Subject: [PATCH 22/30] Swap Order of headers and prio --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index a2b448f..6fac7b1 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -28,8 +28,8 @@ jobs: with: url: ${{ secrets.NTFY_URL }} topic: ${{ secrets.NTFY_TOPIC }} - headers: '{"authorization": "${{ secrets.NTFY_HEADERS }}"}' priority: 5 + headers: '{"authorization": "${{ secrets.NTFY_HEADERS }}"}' tags: +1,partying_face,action,failed details: Workflow has failed! actions: 'default' -- 2.34.1 From cc2ff05e9a5295113783ba417b4077df1a952054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Thu, 15 Feb 2024 20:05:02 +0100 Subject: [PATCH 23/30] Hopefully fix Failing ntfycation --- .gitea/workflows/demo.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 6fac7b1..7ddc555 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -30,9 +30,10 @@ jobs: topic: ${{ secrets.NTFY_TOPIC }} priority: 5 headers: '{"authorization": "${{ secrets.NTFY_HEADERS }}"}' - tags: +1,partying_face,action,failed + tags: +1,partying_face,action,failed, details: Workflow has failed! - actions: 'default' + icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png' + image: true - name: ntfy-notifications-success uses: niniyas/ntfy-action@master -- 2.34.1 From c44dd07a86044cc9f8f1ad1019fdb1f382422ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Thu, 15 Feb 2024 20:09:28 +0100 Subject: [PATCH 24/30] Switch emoyies in failing notification --- .gitea/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 7ddc555..0514f8f 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -30,7 +30,7 @@ jobs: topic: ${{ secrets.NTFY_TOPIC }} priority: 5 headers: '{"authorization": "${{ secrets.NTFY_HEADERS }}"}' - tags: +1,partying_face,action,failed, + tags: -1,rotating_light,action,failed, details: Workflow has failed! icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png' image: true -- 2.34.1 From 711dca3f9d64cb3374a5f7f6dcfbf5dc3905f26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Thu, 15 Feb 2024 20:11:33 +0100 Subject: [PATCH 25/30] Fix failing testcase --- e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts b/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts index fefda8b..00688ac 100644 --- a/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts +++ b/e2e/game-model/scriptAccounts/ScriptAccountTest.spec.ts @@ -14,7 +14,7 @@ test.describe('Test ScriptAccounts', () => { expect(scriptAccunt.componentName).toEqual("ScriptAccount"); expect(scriptAccunt.componentDescription).toEqual("Description"); expect(scriptAccunt.type).toEqual(ModelComponentType.SCRIPTACCOUNT); - expect(scriptAccunt.minValue).toEqual(2); + expect(scriptAccunt.minValue).toEqual(0); expect(scriptAccunt.maxValue).toEqual(100); }) -- 2.34.1 From fa7a59ffc4c6f7ad3cb190f70d393e02c2a9ba1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Thu, 15 Feb 2024 20:47:26 +0100 Subject: [PATCH 26/30] Switch active tab if opening component that is already opened --- src/app/editor/editor.component.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/editor/editor.component.ts b/src/app/editor/editor.component.ts index 480330d..77a8433 100644 --- a/src/app/editor/editor.component.ts +++ b/src/app/editor/editor.component.ts @@ -21,6 +21,8 @@ export class EditorComponent { if(!this.gameModelComponents.includes(gameModelComponent)) { this.gameModelComponents.push(gameModelComponent); this.activeTab = this.gameModelComponents.length; + } else { + this.activeTab = this.gameModelComponents.findIndex(component => component.componentName === gameModelComponent.componentName); } } -- 2.34.1 From 78c992564e78f171202e760e6963180c30890bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 12:34:40 +0100 Subject: [PATCH 27/30] Compute ProductInitialState Value by Innerstate Initial Status --- src/app/game-model/gamesystems/ProductGamesystem.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/game-model/gamesystems/ProductGamesystem.ts b/src/app/game-model/gamesystems/ProductGamesystem.ts index 6fd5e31..8d7d1a4 100644 --- a/src/app/game-model/gamesystems/ProductGamesystem.ts +++ b/src/app/game-model/gamesystems/ProductGamesystem.ts @@ -125,12 +125,14 @@ export class ProductGamesystem extends Gamesystem productInitial = productInitial && innerState.initial) + return binary_productState!; } -- 2.34.1 From fff4b6214fec9173aea7d220d6e909a38969c9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 17:29:19 +0100 Subject: [PATCH 28/30] Simple Visualization of ProductTransitions --- .../LeafGamesystemCalculator.ts | 35 ++++++++ .../product-gamesystem-editor.component.html | 1 + .../product-gamesystem-editor.component.ts | 8 +- .../product-state-editor.component.ts | 30 +------ .../product-transition-editor.component.html | 42 +++++++++ .../product-transition-editor.component.scss | 0 ...roduct-transition-editor.component.spec.ts | 23 +++++ .../product-transition-editor.component.ts | 87 +++++++++++++++++++ .../gamesystems/ProductGamesystem.ts | 3 - 9 files changed, 198 insertions(+), 31 deletions(-) create mode 100644 src/app/editor/gamesystem-editor/product-gamesystem-editor/LeafGamesystemCalculator.ts create mode 100644 src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html create mode 100644 src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.scss create mode 100644 src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.spec.ts create mode 100644 src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/LeafGamesystemCalculator.ts b/src/app/editor/gamesystem-editor/product-gamesystem-editor/LeafGamesystemCalculator.ts new file mode 100644 index 0000000..b505d93 --- /dev/null +++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/LeafGamesystemCalculator.ts @@ -0,0 +1,35 @@ +import {Gamesystem} from "../../../game-model/gamesystems/Gamesystem"; +import {SimpleGamesystem} from "../../../game-model/gamesystems/SimpleGamesystem"; +import {ProductGamesystem} from "../../../game-model/gamesystems/ProductGamesystem"; +import {State} from "../../../game-model/gamesystems/State"; +import {ProductState} from "../../../game-model/gamesystems/ProductState"; +import {SimpleState} from "../../../game-model/gamesystems/SimpleState"; + +export class LeafGamesystemCalculator { + + static calcLeafGeamesystems(gamesystem: Gamesystem) { + if(gamesystem instanceof SimpleGamesystem) { + return [gamesystem]; + } else { + const product_gamesystem = gamesystem as ProductGamesystem; + const leaf_gamesystems: SimpleGamesystem[] = []; + product_gamesystem.innerGamesystems.forEach(innerGamesystem => { + LeafGamesystemCalculator.calcLeafGeamesystems(innerGamesystem).forEach(leafGamesystem => leaf_gamesystems.push(leafGamesystem)) + }) + return leaf_gamesystems; + } + } + + static calcLeafStates(state: State) { + if(state instanceof SimpleState) { + return [state]; + } else { + const productState = state as ProductState; + const leafStates: SimpleState[] = []; + productState.innerStates.forEach(innerState => { + LeafGamesystemCalculator.calcLeafStates(innerState).forEach(leafState => leafStates.push(leafState)); + }) + return leafStates; + } + } +} 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 d505323..038300d 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 +1,2 @@ + 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 c5416a4..1a90798 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 @@ -2,12 +2,18 @@ import {Component, EventEmitter, Input, Output} from '@angular/core'; import {ProductGamesystem} from "../../../game-model/gamesystems/ProductGamesystem"; import {ProductStateEditorComponent} from "../state-editor/product-state-editor/product-state-editor.component"; import {SimpleGamesystem} from "../../../game-model/gamesystems/SimpleGamesystem"; +import { + ProductTransitionEditorComponent +} from "../transition-editor/product-transition-editor/product-transition-editor.component"; + + @Component({ selector: 'app-product-gamesystem-editor', standalone: true, imports: [ - ProductStateEditorComponent + ProductStateEditorComponent, + ProductTransitionEditorComponent ], templateUrl: './product-gamesystem-editor.component.html', styleUrl: './product-gamesystem-editor.component.scss' 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 23e6bb4..cfaa5ab 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 @@ -17,6 +17,7 @@ import {NgForOf, NgIf} from "@angular/common"; import {ProductState} from "../../../../game-model/gamesystems/ProductState"; import {MatIcon} from "@angular/material/icon"; import {Gamesystem} from "../../../../game-model/gamesystems/Gamesystem"; +import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; @Component({ selector: 'app-product-state-editor', @@ -67,38 +68,13 @@ export class ProductStateEditorComponent implements OnInit{ protected readonly SimpleState = SimpleState; getLeafState(state: State, i: number) { - return this.computeLeafStates(state)[i]; - } - - computeLeafStates(state: State) { - if(state instanceof SimpleState) { - return [state]; - } else { - const productState = state as ProductState; - const leafStates: SimpleState[] = []; - productState.innerStates.forEach(innerState => { - this.computeLeafStates(innerState).forEach(leafState => leafStates.push(leafState)); - }) - return leafStates; - } + return LeafGamesystemCalculator.calcLeafStates(state)[i]; } clickOnInnerState(leafIndex: number) { - const leaf_gamesystems = this.computeLeafGamesystems(this.gamesystem!); + const leaf_gamesystems = LeafGamesystemCalculator.calcLeafGeamesystems(this.gamesystem!); const clicked_gamesystem = leaf_gamesystems[leafIndex]; this.openGamesystemEditorEmitter.emit(clicked_gamesystem); } - computeLeafGamesystems(gamesystem: Gamesystem) { - if(gamesystem instanceof SimpleGamesystem) { - return [gamesystem]; - } else { - const product_gamesystem = gamesystem as ProductGamesystem; - const leaf_gamesystems: SimpleGamesystem[] = []; - product_gamesystem.innerGamesystems.forEach(innerGamesystem => { - this.computeLeafGamesystems(innerGamesystem).forEach(leafGamesystem => leaf_gamesystems.push(leafGamesystem)) - }) - return leaf_gamesystems; - } - } } diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html new file mode 100644 index 0000000..bf6e550 --- /dev/null +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + +
{{col.displayedName}} + {{getLeafStateByIndex(transition, i).stateLabel}} + + Starting State + + Ending State +
diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.scss b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.spec.ts b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.spec.ts new file mode 100644 index 0000000..9026629 --- /dev/null +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProductTransitionEditorComponent } from './product-transition-editor.component'; + +describe('ProductTransitionEditorComponent', () => { + let component: ProductTransitionEditorComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ProductTransitionEditorComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ProductTransitionEditorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); 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 new file mode 100644 index 0000000..93e6bf2 --- /dev/null +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts @@ -0,0 +1,87 @@ +import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; +import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem"; +import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem"; +import { + MatCell, MatCellDef, + MatColumnDef, + MatHeaderCell, + MatHeaderCellDef, MatHeaderRow, MatHeaderRowDef, MatRow, MatRowDef, + MatTable, + MatTableDataSource +} from "@angular/material/table"; +import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; +import {NgForOf, NgIf} from "@angular/common"; +import {ProductTransition} from "../../../../game-model/gamesystems/ProductTransition"; +import {ProductState} from "../../../../game-model/gamesystems/ProductState"; + +class DisplayedColumnName { + displayedName: string + internalName: string + + + constructor(displayedName: string, internalName: string) { + this.displayedName = displayedName; + this.internalName = internalName; + } +} +@Component({ + selector: 'app-product-transition-editor', + standalone: true, + imports: [ + MatTable, + NgForOf, + MatColumnDef, + MatHeaderCell, + MatHeaderCellDef, + MatCell, + MatCellDef, + NgIf, + MatHeaderRow, + MatRow, + MatHeaderRowDef, + MatRowDef + ], + templateUrl: './product-transition-editor.component.html', + styleUrl: './product-transition-editor.component.scss' +}) +export class ProductTransitionEditorComponent implements OnInit{ + + @Input() gamesystem: ProductGamesystem | undefined + @Output() onOpenGamesystem = new EventEmitter(); + + dataSource = new MatTableDataSource(); + displayedColumns: DisplayedColumnName[] = []; + columns: string[] = []; + numberLeafSystems: number = -1; + + ngOnInit() { + if(this.gamesystem != undefined) { + const leafGamesystems: SimpleGamesystem[] = LeafGamesystemCalculator.calcLeafGeamesystems(this.gamesystem); + this.displayedColumns = leafGamesystems.map(leafGamesystem => new DisplayedColumnName(leafGamesystem.componentName, leafGamesystem.componentName + "-start")); + this.displayedColumns = this.displayedColumns.concat( leafGamesystems.map(leafGamesystem => new DisplayedColumnName(leafGamesystem.componentName, leafGamesystem.componentName + "-end"))); + + this.numberLeafSystems = leafGamesystems.length; + this.columns = this.displayedColumns.map(column => column.internalName) + + this.dataSource.data = this.gamesystem.transitions; + } + } + + getLeafStateByIndex(transition: ProductTransition, leafIndex: number) { + let state: ProductState; + let index = leafIndex; + if(leafIndex < this.numberLeafSystems) { + state = transition.startingState + } else { + state = transition.endingState; + index = leafIndex - this.numberLeafSystems; + } + + + + const leafStates = LeafGamesystemCalculator.calcLeafStates(state); + console.log(leafStates) + return leafStates[index]; + } + +} diff --git a/src/app/game-model/gamesystems/ProductGamesystem.ts b/src/app/game-model/gamesystems/ProductGamesystem.ts index 8d7d1a4..ecef1d3 100644 --- a/src/app/game-model/gamesystems/ProductGamesystem.ts +++ b/src/app/game-model/gamesystems/ProductGamesystem.ts @@ -135,9 +135,6 @@ export class ProductGamesystem extends Gamesystem, Transition>) { this.innerGamesystems.push(gamesystem); } -- 2.34.1 From 086cde3873ba411e487a13bd05c9deb3e84076be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 17:52:32 +0100 Subject: [PATCH 29/30] Show state description in product state and product transition visualiser --- .../product-state-editor/product-state-editor.component.html | 2 +- .../product-state-editor/product-state-editor.component.ts | 4 +++- .../product-transition-editor.component.html | 2 +- .../product-transition-editor.component.ts | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html index 5fbd207..2d7eda7 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html @@ -2,7 +2,7 @@
{{col}} - {{getLeafState(state, i).stateLabel}} + {{getLeafState(state, i).stateLabel}} {{state.initial? 'done':'close'}} 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 cfaa5ab..8e4b02b 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 @@ -18,6 +18,7 @@ import {ProductState} from "../../../../game-model/gamesystems/ProductState"; import {MatIcon} from "@angular/material/icon"; import {Gamesystem} from "../../../../game-model/gamesystems/Gamesystem"; import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator"; +import {MatTooltip} from "@angular/material/tooltip"; @Component({ selector: 'app-product-state-editor', @@ -35,7 +36,8 @@ import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGame MatCellDef, NgForOf, NgIf, - MatIcon + MatIcon, + MatTooltip ], templateUrl: './product-state-editor.component.html', styleUrl: './product-state-editor.component.scss' diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html index bf6e550..5ae66c4 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html @@ -1,7 +1,7 @@ - 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 93e6bf2..97ce5a1 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 @@ -13,6 +13,7 @@ import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGame import {NgForOf, NgIf} from "@angular/common"; import {ProductTransition} from "../../../../game-model/gamesystems/ProductTransition"; import {ProductState} from "../../../../game-model/gamesystems/ProductState"; +import {MatTooltip} from "@angular/material/tooltip"; class DisplayedColumnName { displayedName: string @@ -39,7 +40,8 @@ class DisplayedColumnName { MatHeaderRow, MatRow, MatHeaderRowDef, - MatRowDef + MatRowDef, + MatTooltip ], templateUrl: './product-transition-editor.component.html', styleUrl: './product-transition-editor.component.scss' -- 2.34.1 From 18bdacb5e9abda35f9a35adebc10f0b159e75ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 16 Feb 2024 17:58:42 +0100 Subject: [PATCH 30/30] OpenGamesystemEditor from ProductTransitionEditor --- .../product-transition-editor.component.html | 4 ++-- .../product-transition-editor.component.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html index 5ae66c4..cbe907a 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.html @@ -1,7 +1,7 @@
{{col.displayedName}} + {{getLeafStateByIndex(transition, i).stateLabel}}
- - + 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 97ce5a1..c823260 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 @@ -86,4 +86,12 @@ export class ProductTransitionEditorComponent implements OnInit{ return leafStates[index]; } + openGamesystemEditor(leafIndex: number) { + const leafGamesystems = LeafGamesystemCalculator.calcLeafGeamesystems(this.gamesystem!); + if(leafIndex < this.numberLeafSystems) { + this.onOpenGamesystem.emit(leafGamesystems[leafIndex]) + } else { + this.onOpenGamesystem.emit(leafGamesystems[leafIndex - this.numberLeafSystems]) + } + } } -- 2.34.1
{{col.displayedName}} + {{col.displayedName}} {{getLeafStateByIndex(transition, i).stateLabel}}