template-systems #41

Merged
sebastian merged 30 commits from template-systems into main 2024-04-19 21:10:01 +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-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()" <app-product-gamesystem-editor *ngIf="!isSimpleGamesystem()" [templateElement]="templateElement" [gamesystem]="convertGamesystemToProductGamesystem()"
(onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-gamesystem-editor> (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 {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem"; import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
import {TemplateElement} from "../../project/game-model/templates/TemplateElement"; 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({ @Component({
selector: 'app-gamesystem-editor', selector: 'app-gamesystem-editor',
@ -42,4 +44,19 @@ export class GamesystemEditorComponent implements OnInit{
onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { onOpenGamesystemEditor(gamesystem: SimpleGamesystem) {
this.openGamesystemEmitter.emit(gamesystem); 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(); stateMap: Map<TemplateElement, ProductState[]> = new Map();
transitionMap: Map<TemplateElement, ProductTransition[]> = new Map<TemplateElement, ProductTransition[]>() transitionMap: Map<TemplateElement, ProductTransition[]> = new Map<TemplateElement, ProductTransition[]>()
templateType: TemplateType templateType: TemplateType
symmetric: boolean = false
constructor(gamesystemName: string, gamesystemDescription: string, templateType: TemplateType) { constructor(gamesystemName: string, gamesystemDescription: string, templateType: TemplateType) {

View File

@ -10,6 +10,7 @@ import {TemplateType} from "../TemplateType";
export class SimpleTemplateGamesystem extends SimpleGamesystem implements TemplateGamesystem { export class SimpleTemplateGamesystem extends SimpleGamesystem implements TemplateGamesystem {
templateType: TemplateType templateType: TemplateType
symmetric: boolean = true
constructor(gamesystemName: string, gamesystemDescription: string, templateType: TemplateType) { constructor(gamesystemName: string, gamesystemDescription: string, templateType: TemplateType) {
super(gamesystemName, gamesystemDescription); super(gamesystemName, gamesystemDescription);

View File

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

View File

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