template-systems #41
@ -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>
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -44,7 +44,8 @@
|
||||
"conditionMap": [],
|
||||
"actionMap": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"symmetric": true
|
||||
}
|
||||
]
|
||||
}
|
@ -47,5 +47,6 @@
|
||||
"endingState": "Feind"
|
||||
}
|
||||
],
|
||||
"symmetric": true,
|
||||
"templateType": 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user