Implement addReferenceKey for ProductTemplateSystems
All checks were successful
E2E Testing / test (push) Successful in 1m34s

This commit is contained in:
Sebastian Böckelmann 2024-04-13 06:54:51 +02:00
parent a2645e1324
commit ad9e06e9ec
3 changed files with 11 additions and 2 deletions

View File

@ -7,8 +7,9 @@ import {ProductGamesystemGenerator} from "./productSystemGenerator/ProductGamesy
import {SimpleGamesystem} from "./SimpleGamesystem"; import {SimpleGamesystem} from "./SimpleGamesystem";
import {GameModel} from "../GameModel"; import {GameModel} from "../GameModel";
import {TemplateType} from "../TemplateType"; import {TemplateType} from "../TemplateType";
import {TemplateGamesystem} from "./TemplateGamesystem";
export class ProductTemplateSystem<ReferenceTemplate> extends ProductGamesystem { export class ProductTemplateSystem<ReferenceTemplate> extends ProductGamesystem implements TemplateGamesystem<ReferenceTemplate>{
stateMap: Map<ReferenceTemplate, ProductState[]> = new Map<ReferenceTemplate, ProductState[]>(); stateMap: Map<ReferenceTemplate, ProductState[]> = new Map<ReferenceTemplate, ProductState[]>();
transitionMap: Map<ReferenceTemplate, ProductTransition[]> = new Map<ReferenceTemplate, ProductTransition[]>(); transitionMap: Map<ReferenceTemplate, ProductTransition[]> = new Map<ReferenceTemplate, ProductTransition[]>();
@ -28,4 +29,8 @@ export class ProductTemplateSystem<ReferenceTemplate> extends ProductGamesystem
const productSystemGenerator = new ProductTemplateGamesystemGenerator(this, referenceTemplate); const productSystemGenerator = new ProductTemplateGamesystemGenerator(this, referenceTemplate);
productSystemGenerator.generateFromChildsystems() productSystemGenerator.generateFromChildsystems()
} }
addReferenceKey(referenceTemplate: ReferenceTemplate): void {
this.generateTemplateFromChildsystems(referenceTemplate)
}
} }

View File

@ -3,8 +3,9 @@ import {Gamesystem} from "./Gamesystem";
import {SimpleState} from "./states/SimpleState"; import {SimpleState} from "./states/SimpleState";
import {SimpleTemplateTransition} from "./transitions/SimpleTemplateTransition"; import {SimpleTemplateTransition} from "./transitions/SimpleTemplateTransition";
import {TemplateType} from "../TemplateType"; import {TemplateType} from "../TemplateType";
import {TemplateGamesystem} from "./TemplateGamesystem";
export class SimpleTemplateGamesystem<ReferenceType> extends Gamesystem<SimpleTemplateState<ReferenceType>, SimpleTemplateTransition<ReferenceType>> { export class SimpleTemplateGamesystem<ReferenceType> extends Gamesystem<SimpleTemplateState<ReferenceType>, SimpleTemplateTransition<ReferenceType>> implements TemplateGamesystem<ReferenceType>{
createState(label: string, description: string): SimpleState | undefined { createState(label: string, description: string): SimpleState | undefined {
if(label == null) { if(label == null) {
return undefined; return undefined;

View File

@ -0,0 +1,3 @@
export interface TemplateGamesystem<ReferenceTemplate> {
addReferenceKey(referenceTemplate: ReferenceTemplate): void;
}