Compare commits

..

No commits in common. "f31831f1d95e2790dba94650c99597c11897ac70" and "b398545b7a51cb5e416e658d26bd170f9f6d3604" have entirely different histories.

7 changed files with 6 additions and 109 deletions

View File

@ -1,14 +0,0 @@
<h1 mat-dialog-title>Create Templatesystem</h1>
<div mat-dialog-content>
<p>Select the System to be specified. This will not change the original system. </p>
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Referencesystem</mat-label>
<mat-select [formControl]="referenceCtrl">
<mat-option *ngFor="let templateSystem of templateSystems" [value]="templateSystem">{{templateSystem.componentName}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div mat-dialog-actions align="end">
<button mat-stroked-button (click)="cancel()">Cancel</button>
<button mat-raised-button color="accent" [disabled]="referenceCtrl.invalid" (click)="submit()">Confirm</button>
</div>

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TemplateSystemEditorComponent } from './template-system-editor.component';
describe('TemplateSystemEditorComponent', () => {
let component: TemplateSystemEditorComponent;
let fixture: ComponentFixture<TemplateSystemEditorComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TemplateSystemEditorComponent]
})
.compileComponents();
fixture = TestBed.createComponent(TemplateSystemEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,31 +0,0 @@
import {Component, Inject} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogContent, MatDialogRef, MatDialogTitle} from "@angular/material/dialog";
import {TemplateType} from "../../../project/game-model/gamesystems/TemplateType";
import {Gamesystem} from "../../../project/game-model/gamesystems/Gamesystem";
import {MatFormField} from "@angular/material/form-field";
import {MatOption, MatSelect} from "@angular/material/select";
import {NgForOf} from "@angular/common";
import {FormControl, Validators} from "@angular/forms";
@Component({
selector: 'app-template-system-editor',
templateUrl: './template-system-editor.component.html',
styleUrl: './template-system-editor.component.scss'
})
export class TemplateSystemEditorComponent {
referenceCtrl: FormControl = new FormControl('', [Validators.required])
constructor(private dialogRef: MatDialogRef<TemplateSystemEditorComponent>,
@Inject(MAT_DIALOG_DATA) public templateSystems: Gamesystem<any, any>[] = []) {
}
cancel() {
this.dialogRef.close()
}
submit() {
this.dialogRef.close(this.referenceCtrl.value)
}
}

View File

@ -1,25 +0,0 @@
import { ProductGamesystem } from "./ProductGamesystem";
import { SimpleGamesystem } from "./SimpleGamesystem";
import { SimpleTemplateGamesystem } from "./SimpleTemplateGamesystem";
export class ProductTemplateGamesystem extends ProductGamesystem {
referenceSystem: ProductGamesystem
constructor(referenceSystem: ProductGamesystem) {
super(referenceSystem.componentName, referenceSystem.componentDescription)
this.referenceSystem = referenceSystem;
this.innerGamesystems = referenceSystem.innerGamesystems.map(innerGamesystem => {
if(innerGamesystem instanceof SimpleGamesystem) {
return new SimpleTemplateGamesystem(innerGamesystem)
} else {
return new ProductTemplateGamesystem(innerGamesystem as ProductTemplateGamesystem)
}
})
this.generateFromChildsystems();
}
}

View File

@ -1,10 +1,14 @@
import {Gamesystem} from "./Gamesystem"; import {Gamesystem} from "./Gamesystem";
import { SimpleTemplateGamesystem } from "./SimpleTemplateGamesystem";
import {SimpleState} from "./states/SimpleState"; import {SimpleState} from "./states/SimpleState";
import {SimpleTransition} from "./transitions/SimpleTransition"; import {SimpleTransition} from "./transitions/SimpleTransition";
import {State} from "./states/State";
import {Transition} from "./transitions/Transition";
import {ProductState} from "./states/ProductState";
import {ProductTransition} from "./transitions/ProductTransition";
import {ProductGamesystem} from "./ProductGamesystem";
export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition> { export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition> {
templateSystems: SimpleTemplateGamesystem[] = []
createState(label: string, description: string): SimpleState | undefined { createState(label: string, description: string): SimpleState | undefined {
if(label == null) { if(label == null) {
@ -18,8 +22,6 @@ export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition>
const state = new SimpleState(label, description); const state = new SimpleState(label, description);
if(this.states.find(s => s.stateLabel == label) == undefined) { if(this.states.find(s => s.stateLabel == label) == undefined) {
this.states.push(state); this.states.push(state);
this.templateSystems.forEach(templatesystem => templatesystem.createState(label, description))
return state; return state;
} else { } else {
return undefined return undefined
@ -53,12 +55,4 @@ export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition>
return updated; return updated;
} }
protected findStateByStateLabel(stateLabel: string) {
return this.states.find(state => stateLabel === stateLabel);
}
addTemplateSystem(templateSystem: SimpleTemplateGamesystem) {
this.templateSystems.push(templateSystem)
}
} }

View File

@ -1,4 +0,0 @@
export enum TemplateType {
NONE,
CHARACTER
}