template-systems #41

Merged
sebastian merged 30 commits from template-systems into main 2024-04-19 21:10:01 +02:00
4 changed files with 76 additions and 70 deletions
Showing only changes of commit 2e6363e090 - Show all commits

View File

@ -79,6 +79,9 @@ import {
import { import {
TemplateSpecificatorComponent TemplateSpecificatorComponent
} from "./editor/gamesystem-editor/template-specificator/template-specificator.component"; } from "./editor/gamesystem-editor/template-specificator/template-specificator.component";
import {
StateInitialCellComponent
} from "./editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component";
// AoT requires an exported function for factories // AoT requires an exported function for factories
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
@ -103,7 +106,8 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
ScriptaccountConditionEditorComponent, ScriptaccountConditionEditorComponent,
CharacterOverviewComponent, CharacterOverviewComponent,
CharacterEditorComponent, CharacterEditorComponent,
TemplateSpecificatorComponent TemplateSpecificatorComponent,
StateInitialCellComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

View File

@ -39,12 +39,7 @@
<ng-container matColumnDef="initial"> <ng-container matColumnDef="initial">
<th mat-header-cell *matHeaderCellDef>Initial</th> <th mat-header-cell *matHeaderCellDef>Initial</th>
<td mat-cell *matCellDef="let state"> <td mat-cell *matCellDef="let state">
<div *ngIf="editedElement !== state"> <app-state-initial-cell [templateElement]="templateElement" [editedState]="editedElement" [state]="state"></app-state-initial-cell>
<mat-icon *ngIf="state.initial">done</mat-icon>
<mat-icon *ngIf="!state.initial">close</mat-icon>
</div>
<mat-checkbox *ngIf="editedElement === state" [(ngModel)]="state.initial" (ngModelChange)="onStateChange()"></mat-checkbox>
</td> </td>
</ng-container> </ng-container>

View File

@ -35,11 +35,14 @@ export class SimpleStateEditorComponent implements OnInit{
editedStateLabelError: boolean = false; editedStateLabelError: boolean = false;
testState: SimpleState | undefined = undefined
constructor(private snackbar: MatSnackBar) { constructor(private snackbar: MatSnackBar) {
} }
ngOnInit() { ngOnInit() {
this.dataSource.data = this.states; this.dataSource.data = this.states;
this.testState = this.states[0]
this.dataSource.filterPredicate = (data: SimpleState, filter: string) => { this.dataSource.filterPredicate = (data: SimpleState, filter: string) => {
return data.stateLabel.toLowerCase().includes(filter); return data.stateLabel.toLowerCase().includes(filter);
} }
@ -127,4 +130,6 @@ export class SimpleStateEditorComponent implements OnInit{
return []; return [];
} }
} }
} }

View File

@ -5,10 +5,12 @@ import {ScriptAccountCondition} from "../../gamesystems/conditions/ScriptAccount
export class SimpleTemplateState extends SimpleState { export class SimpleTemplateState extends SimpleState {
conditionMap: Map<TemplateElement, ScriptAccountCondition[]> = new Map(); conditionMap: Map<TemplateElement, ScriptAccountCondition[]> = new Map();
initialMap: Map<TemplateElement, boolean> = new Map<TemplateElement, boolean>();
addTemplateElement(templateElement: TemplateElement) { addTemplateElement(templateElement: TemplateElement) {
if(!this.conditionMap.has(templateElement)) { if(!this.conditionMap.has(templateElement)) {
this.conditionMap.set(templateElement, this.conditions) this.conditionMap.set(templateElement, this.conditions)
this.initialMap.set(templateElement, this.initial);
} }
} }