issue-15 #21

Merged
sebastian merged 60 commits from issue-15 into main 2024-03-22 08:46:49 +01:00
4 changed files with 25 additions and 1 deletions
Showing only changes of commit 5dafce8a91 - Show all commits

View File

@ -0,0 +1,7 @@
.mat-column-edit, .mat-column-delete {
width: 32px;
}
table {
width: 100%;
}

View File

@ -1,4 +1,4 @@
<app-simple-state-editor [states]="simpleGamesystem!.states" [gamesystem]="simpleGamesystem" ></app-simple-state-editor>
<app-simple-state-editor [states]="simpleGamesystem!.states" [gamesystem]="simpleGamesystem" [scriptAccounts]="scriptAccunts"></app-simple-state-editor>
<div id="transition-editor">
<app-simple-transition-editor [gamesystem]="simpleGamesystem" [scriptAccounts]="scriptAccunts"></app-simple-transition-editor>
</div>

View File

@ -25,6 +25,11 @@
<mat-label>Description</mat-label>
<textarea matInput [(ngModel)]="element.stateDescription" rows="3" (ngModelChange)="onStateChange()"></textarea>
</mat-form-field>
<div class="long-form">
<app-scriptaccount-condition-editor [conditions]="element.conditions" [scriptAccounts]="scriptAccounts"
(onCreateCondition)="onCreateCondition(element, $event)" (onDeleteCondition)="deleteCondition(element, $event)"></app-scriptaccount-condition-editor>
</div>
</div>
</td>
</ng-container>

View File

@ -6,6 +6,8 @@ import {MatSnackBar} from "@angular/material/snack-bar";
import {SimpleGamesystem} from "../../../../game-model/gamesystems/SimpleGamesystem";
import {ProductState} from "../../../../game-model/gamesystems/states/ProductState";
import {LeafGamesystemCalculator} from "../../product-gamesystem-editor/LeafGamesystemCalculator";
import {ScriptAccount} from "../../../../game-model/scriptAccounts/ScriptAccount";
import {ScriptAccountCondition} from "../../../../game-model/gamesystems/conditions/ScriptAccountCondition";
@Component({
selector: 'app-simple-state-editor',
@ -23,6 +25,7 @@ export class SimpleStateEditorComponent implements OnInit{
@Input() states: SimpleState[] = [];
@Input() gamesystem: SimpleGamesystem | undefined
@Input() scriptAccounts: ScriptAccount[] = []
dataSource = new MatTableDataSource<SimpleState>();
displayedColumns = ["name", "initial", "edit", "delete"];
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
@ -93,4 +96,13 @@ export class SimpleStateEditorComponent implements OnInit{
const filterValue = (event.target as HTMLInputElement).value;
this.dataSource.filter = filterValue.trim().toLowerCase();
}
onCreateCondition(state: SimpleState, condition: ScriptAccountCondition) {
state.addScriptAccountCondition(condition);
}
deleteCondition(state: SimpleState, condition: ScriptAccountCondition) {
state.removeScriptAccountCondition(condition.scriptAccount);
}
}