diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html
index f4ef23b..c32d36c 100644
--- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html
+++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html
@@ -1,3 +1,6 @@
+
+ Gamesystem is symmetric template
+
diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts
index 2174be0..907935a 100644
--- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts
+++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts
@@ -6,6 +6,8 @@ import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccou
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
import {TemplateElement} from "../../project/game-model/templates/TemplateElement";
+import {SimpleTemplateGamesystem} from "../../project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem";
+import {ProductTemplateSystem} from "../../project/game-model/templates/productGamesystem/ProductTemplateSystem";
@Component({
selector: 'app-gamesystem-editor',
@@ -42,4 +44,19 @@ export class GamesystemEditorComponent implements OnInit{
onOpenGamesystemEditor(gamesystem: SimpleGamesystem) {
this.openGamesystemEmitter.emit(gamesystem);
}
+
+ isGamesystemTemplate() {
+ return this.gamesystem instanceof SimpleTemplateGamesystem || this.gamesystem instanceof ProductTemplateSystem;
+ }
+
+ convertGamesystemToTemplate(gamesystem: Gamesystem, Transition> | undefined) {
+ if(gamesystem instanceof SimpleTemplateGamesystem) {
+ return gamesystem as SimpleTemplateGamesystem;
+ } else if(gamesystem instanceof ProductTemplateSystem) {
+ return gamesystem as ProductTemplateSystem
+ } else {
+ return undefined
+ }
+
+ }
}
diff --git a/src/app/project/game-model/characters/CharacterRelation.ts b/src/app/project/game-model/characters/CharacterRelation.ts
index bdbd03a..ea9ecb1 100644
--- a/src/app/project/game-model/characters/CharacterRelation.ts
+++ b/src/app/project/game-model/characters/CharacterRelation.ts
@@ -21,6 +21,7 @@ export class CharacterRelation implements TemplateElement{
addCharacterRelationSystem(gamesystem: Gamesystem) {
if((gamesystem instanceof SimpleTemplateGamesystem || gamesystem instanceof ProductTemplateSystem) && !this.isGamesystemCharacterRelationSpecific(gamesystem.componentName)) {
const templateGamesystem = new ProductTemplateSystem(gamesystem.componentName, gamesystem.componentDescription, TemplateType.CHARACTER_RELATION);
+ templateGamesystem.symmetric = gamesystem.symmetric
templateGamesystem.addChildGamesystem(gamesystem);
templateGamesystem.addChildGamesystem(gamesystem);
this.characterRelationGamesystems.push(templateGamesystem);
diff --git a/src/app/project/game-model/gamesystems/productSystemGenerator/ProductSystemGenerator.ts b/src/app/project/game-model/gamesystems/productSystemGenerator/ProductSystemGenerator.ts
index aa667a1..f001f1e 100644
--- a/src/app/project/game-model/gamesystems/productSystemGenerator/ProductSystemGenerator.ts
+++ b/src/app/project/game-model/gamesystems/productSystemGenerator/ProductSystemGenerator.ts
@@ -9,6 +9,7 @@ import {Gamesystem} from "../Gamesystem";
import {ProductGenerationData} from "./ProductGenerationData";
import {ProductTransition} from "../transitions/ProductTransition";
import {SimpleTemplateTransition} from "../../templates/simpleGamesystem/SimpleTemplateTransition";
+import {ProductTemplateSystem} from "../../templates/productGamesystem/ProductTemplateSystem";
export class ProductSystemGenerator {
productGamesystem: ProductGamesystem
@@ -106,6 +107,8 @@ export class ProductSystemGenerator {
protected assignGeneratedStatesAndTransitions(generationResult: ProductGeneratorResult): void {
this.productGamesystem.states = generationResult.states;
this.productGamesystem.transitions = generationResult.transitions;
+
+ console.log("General ", generationResult.transitions.length)
}
protected generateBinaryProductTransition(startingState: ProductState, endingState: ProductState, usedTransition: Transition, generatedTransitions: ProductTransition[], leftSystem: boolean) {
diff --git a/src/app/project/game-model/gamesystems/productSystemGenerator/SymmetricProductTemplateGenerator.ts b/src/app/project/game-model/gamesystems/productSystemGenerator/SymmetricProductTemplateGenerator.ts
new file mode 100644
index 0000000..848aa04
--- /dev/null
+++ b/src/app/project/game-model/gamesystems/productSystemGenerator/SymmetricProductTemplateGenerator.ts
@@ -0,0 +1,34 @@
+import {TemplateProductSystemGenerator} from "./TemplateProductSystemGenerator";
+import {ProductGenerationData} from "./ProductGenerationData";
+import {ProductGeneratorResult} from "./ProductGeneratorResult";
+import {ProductState} from "../states/ProductState";
+import {ProductTransition} from "../transitions/ProductTransition";
+import {ProductTemplateSystem} from "../../templates/productGamesystem/ProductTemplateSystem";
+
+export class SymmetricProductTemplateGenerator extends TemplateProductSystemGenerator {
+ protected generateFromBinaryChildsystems(leftSystemData: ProductGenerationData, rightSystemData: ProductGenerationData): ProductGeneratorResult {
+ const generatedProductStates: ProductState[] = []
+ const generatedProductTransitions: ProductTransition[] = []
+
+ leftSystemData.states.forEach(leftState => {
+ rightSystemData.states.forEach(rightState => {
+ if(leftState.equals(rightState)) {
+ for(let i=0; i, leftSystem: boolean) {
diff --git a/src/app/project/game-model/templates/productGamesystem/ProductTemplateSystem.ts b/src/app/project/game-model/templates/productGamesystem/ProductTemplateSystem.ts
index e6957fd..4193ecd 100644
--- a/src/app/project/game-model/templates/productGamesystem/ProductTemplateSystem.ts
+++ b/src/app/project/game-model/templates/productGamesystem/ProductTemplateSystem.ts
@@ -7,12 +7,16 @@ import {SimpleGamesystem} from "../../gamesystems/SimpleGamesystem";
import {GameModel} from "../../GameModel";
import {TemplateType} from "../TemplateType";
import {TemplateProductSystemGenerator} from "../../gamesystems/productSystemGenerator/TemplateProductSystemGenerator";
+import {
+ SymmetricProductTemplateGenerator
+} from "../../gamesystems/productSystemGenerator/SymmetricProductTemplateGenerator";
export class ProductTemplateSystem extends ProductGamesystem implements TemplateGamesystem{
stateMap: Map = new Map();
transitionMap: Map = new Map()
templateType: TemplateType
+ symmetric: boolean = false
constructor(gamesystemName: string, gamesystemDescription: string, templateType: TemplateType) {
@@ -21,8 +25,14 @@ export class ProductTemplateSystem extends ProductGamesystem implements Template
}
addTemplateElement(templateElement: TemplateElement): void {
- const productTemplateGenerator = new TemplateProductSystemGenerator(this, templateElement);
- productTemplateGenerator.generateFromChildsystems()
+ if(this.symmetric) {
+ const symmetricGenerator = new SymmetricProductTemplateGenerator(this, templateElement);
+ symmetricGenerator.generateFromChildsystems()
+ } else {
+ const productTemplateGenerator = new TemplateProductSystemGenerator(this, templateElement);
+ productTemplateGenerator.generateFromChildsystems()
+ }
+
}
}
diff --git a/src/app/project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem.ts b/src/app/project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem.ts
index 17856d2..0c844f4 100644
--- a/src/app/project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem.ts
+++ b/src/app/project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem.ts
@@ -10,6 +10,7 @@ import {TemplateType} from "../TemplateType";
export class SimpleTemplateGamesystem extends SimpleGamesystem implements TemplateGamesystem {
templateType: TemplateType
+ symmetric: boolean = true
constructor(gamesystemName: string, gamesystemDescription: string, templateType: TemplateType) {
super(gamesystemName, gamesystemDescription);
diff --git a/testModel/characters/Hicks Haddock.json b/testModel/characters/Hicks Haddock.json
index 414d072..debd75a 100644
--- a/testModel/characters/Hicks Haddock.json
+++ b/testModel/characters/Hicks Haddock.json
@@ -44,7 +44,8 @@
"conditionMap": [],
"actionMap": []
}
- ]
+ ],
+ "symmetric": true
}
]
}
\ No newline at end of file
diff --git a/testModel/gamesystems/Characterbeziehungssystem.json b/testModel/gamesystems/Characterbeziehungssystem.json
index 66d038b..ad1b1b4 100644
--- a/testModel/gamesystems/Characterbeziehungssystem.json
+++ b/testModel/gamesystems/Characterbeziehungssystem.json
@@ -47,5 +47,6 @@
"endingState": "Feind"
}
],
+ "symmetric": true,
"templateType": 1
}
\ No newline at end of file