symetric-template-relation-systems #38

Merged
sebastian merged 4 commits from symetric-template-relation-systems into assymetric-template-relation-systems 2024-04-19 17:26:00 +02:00
6 changed files with 25 additions and 1 deletions
Showing only changes of commit cfc23efb71 - Show all commits

View File

@ -1,3 +1,6 @@
<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,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<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

@ -13,6 +13,7 @@ export class ProductTemplateSystem extends ProductGamesystem implements Template
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) {

View File

@ -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);

View File

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

View File

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