Compare commits

..

No commits in common. "3e3b03d722063695f487962d5c4af4549f18d695" and "f98ad400e36b723aff7b1a54eb4485f34740f0ea" have entirely different histories.

10 changed files with 4 additions and 77 deletions

View File

@ -1,6 +1,3 @@
<div *ngIf="isGamesystemTemplate()">
<mat-checkbox [(ngModel)]="convertGamesystemToTemplate(gamesystem)!.symmetric">Gamesystem is symmetric template</mat-checkbox>
</div>
<app-simple-gamesystem-editor *ngIf="isSimpleGamesystem()" [templateElement]="templateElement" [simpleGamesystem]="convertGamesystemToSimpleGamesystem()" [scriptAccunts]="scriptAccounts"></app-simple-gamesystem-editor>
<app-product-gamesystem-editor *ngIf="!isSimpleGamesystem()" [templateElement]="templateElement" [gamesystem]="convertGamesystemToProductGamesystem()"
(onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-gamesystem-editor>

View File

@ -6,8 +6,6 @@ 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',
@ -44,19 +42,4 @@ 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<State<any>, Transition<any>> | undefined) {
if(gamesystem instanceof SimpleTemplateGamesystem) {
return gamesystem as SimpleTemplateGamesystem;
} else if(gamesystem instanceof ProductTemplateSystem) {
return gamesystem as ProductTemplateSystem
} else {
return undefined
}
}
}

View File

@ -21,7 +21,6 @@ export class CharacterRelation implements TemplateElement{
addCharacterRelationSystem(gamesystem: Gamesystem<any, any>) {
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);

View File

@ -9,7 +9,6 @@ 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
@ -107,8 +106,6 @@ 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<any>, generatedTransitions: ProductTransition[], leftSystem: boolean) {

View File

@ -1,34 +0,0 @@
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<leftState.outgoingTransitions.length; i++) {
for(let j=0; j<rightState.outgoingTransitions.length; j++) {
const startingState = this.generateBinaryProductState(leftState, rightState, generatedProductStates);
if(startingState != undefined && leftState.outgoingTransitions[i].endingState.equals(rightState.outgoingTransitions[j].endingState)) {
const endingState_left_right = this.generateBinaryProductState(leftState.outgoingTransitions[i].endingState, rightState.outgoingTransitions[j].endingState, generatedProductStates);
if(endingState_left_right != undefined) {
this.generateBinaryProductTransitionMulti(startingState, endingState_left_right, leftState.outgoingTransitions[i], rightState.outgoingTransitions[j], generatedProductTransitions);
}
}
}
}
}
})
})
return new ProductGeneratorResult(generatedProductStates, generatedProductTransitions);
}
}

View File

@ -12,7 +12,6 @@ import {ScriptAccountCondition} from "../conditions/ScriptAccountCondition";
import {SimpleTemplateState} from "../../templates/simpleGamesystem/SimpleTemplateState";
import {Character} from "../../characters/Character";
import {CharacterRelation} from "../../characters/CharacterRelation";
import {ProductGenerationData} from "./ProductGenerationData";
export class TemplateProductSystemGenerator extends ProductSystemGenerator {
@ -29,8 +28,7 @@ export class TemplateProductSystemGenerator extends ProductSystemGenerator {
productTemplateSystem.transitionMap.set(this.templateElement, generationResult.transitions)
productTemplateSystem.stateMap.set(this.templateElement, generationResult.states)
console.log("Symmetric", (this.productGamesystem as ProductTemplateSystem).symmetric)
console.log("Template: ", generationResult.transitions.length)
console.log("Test")
}
protected getTransitionConditions(transition: Transition<any>, leftSystem: boolean) {

View File

@ -7,16 +7,12 @@ 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<TemplateElement, ProductState[]> = new Map();
transitionMap: Map<TemplateElement, ProductTransition[]> = new Map<TemplateElement, ProductTransition[]>()
templateType: TemplateType
symmetric: boolean = false
constructor(gamesystemName: string, gamesystemDescription: string, templateType: TemplateType) {
@ -25,14 +21,8 @@ export class ProductTemplateSystem extends ProductGamesystem implements Template
}
addTemplateElement(templateElement: TemplateElement): void {
if(this.symmetric) {
const symmetricGenerator = new SymmetricProductTemplateGenerator(this, templateElement);
symmetricGenerator.generateFromChildsystems()
} else {
const productTemplateGenerator = new TemplateProductSystemGenerator(this, templateElement);
productTemplateGenerator.generateFromChildsystems()
}
const productTemplateGenerator = new TemplateProductSystemGenerator(this, templateElement);
productTemplateGenerator.generateFromChildsystems()
}
}

View File

@ -10,7 +10,6 @@ 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);

View File

@ -44,8 +44,7 @@
"conditionMap": [],
"actionMap": []
}
],
"symmetric": true
]
}
]
}

View File

@ -47,6 +47,5 @@
"endingState": "Feind"
}
],
"symmetric": true,
"templateType": 1
}