Compare commits

..

18 Commits

Author SHA1 Message Date
Sebastian Böckelmann
f31831f1d9 Revert "Revert "Load ConditionMap from Disk""
Some checks failed
E2E Testing / test (push) Failing after 1m38s
This reverts commit 6ace079ccd.
2024-04-11 16:02:52 +02:00
Sebastian Böckelmann
6ace079ccd Revert "Load ConditionMap from Disk"
This reverts commit 029f273139.
2024-04-11 16:02:46 +02:00
Sebastian Böckelmann
4f7d8d8d5d Merge remote-tracking branch 'origin/alt-templatesystem-impl' into alt-templatesystem-impl
Some checks failed
E2E Testing / test (push) Failing after 1m20s
2024-04-11 15:51:41 +02:00
Sebastian Böckelmann
029f273139 Load ConditionMap from Disk
Some checks failed
E2E Testing / test (push) Failing after 1m20s
2024-04-11 15:51:24 +02:00
Sebastian Böckelmann
1366dca6cf Serialize ConditionMap of States 2024-04-11 15:51:22 +02:00
Sebastian Böckelmann
2238dcee66 Load Basic Characterspecific Gamesystems 2024-04-11 15:51:19 +02:00
Sebastian Böckelmann
a3722f33c9 Store Characterspecific Gamesystems 2024-04-11 15:51:19 +02:00
Sebastian Böckelmann
bf757c2069 Specify Gamesystems for Characters 2024-04-11 15:51:19 +02:00
Sebastian Böckelmann
9d530e48f9 Consider TemplateType of Gamesystems to load and store 2024-04-11 15:51:16 +02:00
Sebastian Böckelmann
4d8fc93ef8 Beginning of Editor for Characterspecific Gamesystems 2024-04-11 15:51:09 +02:00
Sebastian Böckelmann
244222bc5b Add Reference to CharacterSpecific Gamesystems in relevant characters 2024-04-11 15:50:58 +02:00
Sebastian Böckelmann
21dc74376b Create Characterspecific Systems and open their editor correctly 2024-04-11 15:50:38 +02:00
Sebastian Böckelmann
92fa692641 Alternative Implementation of Templatesystems 2024-04-11 15:50:05 +02:00
Sebastian Böckelmann
c1ed3799bd Update States of template when reference gets new state
All checks were successful
E2E Testing / test (push) Successful in 1m37s
2024-04-11 09:52:31 +02:00
Sebastian Böckelmann
d643f6bb1c Add Templatesystem to Characterspecific Systems
All checks were successful
E2E Testing / test (push) Successful in 1m30s
2024-04-11 08:43:12 +02:00
Sebastian Böckelmann
81971a48ca Load Template Status of Gamesystem from disk
Some checks failed
E2E Testing / test (push) Failing after 1m32s
2024-04-11 08:16:26 +02:00
Sebastian Böckelmann
a4be4d623d Mark Gamesystem as Template in Editor
Some checks failed
E2E Testing / test (push) Failing after 2m5s
2024-04-10 20:20:34 +02:00
Sebastian Böckelmann
28a520a995 Implement GameModel Support for Character Specific Gamesystems
All checks were successful
E2E Testing / test (push) Successful in 1m42s
2024-04-10 20:02:56 +02:00
7 changed files with 109 additions and 6 deletions

View File

@ -0,0 +1,14 @@
<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

@ -0,0 +1,23 @@
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

@ -0,0 +1,31 @@
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

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

View File

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