issue-15 #21

Merged
sebastian merged 60 commits from issue-15 into main 2024-03-22 08:46:49 +01:00
9 changed files with 91 additions and 122 deletions
Showing only changes of commit b488049c28 - Show all commits

View File

@ -1,13 +1,13 @@
<div *ngIf="scriptAccount != undefined"> <div *ngIf="scriptAccount != undefined">
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-label>MinValue</mat-label> <mat-label>MinValue</mat-label>
<input matInput [formControl]="minCtrl" type="number" (keypress)="onKeyPress($event)" (change)="onUpdateMinValue()"> <input matInput [formControl]="minCtrl" type="number" (change)="onUpdateMinValue($event)">
<mat-error *ngIf="minCtrl.hasError('required')">Please enter a valid number!</mat-error> <mat-error *ngIf="minCtrl.hasError('required')">Please enter a valid number!</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-label>MaxValue</mat-label> <mat-label>MaxValue</mat-label>
<input matInput type="number" [formControl]="maxCtrl" (keypress)="onKeyPress($event)" (change)="onUpdateMaxValue()"> <input matInput type="number" [formControl]="maxCtrl" (change)="onUpdateMaxValue()">
<mat-error *ngIf="maxCtrl.hasError('required')">Please enter a valid number!</mat-error> <mat-error *ngIf="maxCtrl.hasError('required')">Please enter a valid number!</mat-error>
</mat-form-field> </mat-form-field>

View File

@ -22,8 +22,8 @@ export class MyErrorStateMatcher implements ErrorStateMatcher {
export class ScriptAccountEditorComponent implements OnInit{ export class ScriptAccountEditorComponent implements OnInit{
@Input("scriptAccount") scriptAccount : ScriptAccount | undefined @Input("scriptAccount") scriptAccount : ScriptAccount | undefined
minCtrl: FormControl = new FormControl(0, [Validators.required, Validators.pattern('^[0-9]*$')]); minCtrl: FormControl = new FormControl(0, [Validators.required, Validators.pattern('^[-]?[0-9]*$')]);
maxCtrl: FormControl = new FormControl(100, [Validators.required, Validators.pattern('^[0-9]*$')]); maxCtrl: FormControl = new FormControl(100, [Validators.required, Validators.pattern('^[-]?[0-9]*$')]);
matcher = new MyErrorStateMatcher(); matcher = new MyErrorStateMatcher();
constructor(private electronService: ElectronService) { constructor(private electronService: ElectronService) {
@ -33,15 +33,8 @@ export class ScriptAccountEditorComponent implements OnInit{
this.maxCtrl.setValue(this.scriptAccount!.maxValue); this.maxCtrl.setValue(this.scriptAccount!.maxValue);
} }
onKeyPress(event: KeyboardEvent) {
const input = event.key;
const isDigit = /^\d+$/.test(input);
if (!isDigit) {
event.preventDefault();
}
}
onUpdateMinValue() { onUpdateMinValue(event: Event) {
this.scriptAccount!.minValue = Number(this.minCtrl.value); this.scriptAccount!.minValue = Number(this.minCtrl.value);
this.scriptAccount!.onModifyContent(); this.scriptAccount!.onModifyContent();
} }

View File

@ -1,49 +0,0 @@
{
"componentName": "Weather",
"componentDescription": "",
"states": [
{
"initial": false,
"conditions": [
{
"scriptAccount": "Temperature",
"minValue": 0,
"maxValue": "50"
}
],
"stateLabel": "Sonnig",
"stateDescription": "Die Sonne scheint"
},
{
"initial": false,
"conditions": [
{
"scriptAccount": "Temperature",
"minValue": "50",
"maxValue": "75"
}
],
"stateLabel": "Wolkig",
"stateDescription": ""
}
],
"transitions": [
{
"scriptAccountActions": [
{
"changingValue": 10,
"scriptAccount": "Temperature"
}
],
"scriptAccountConditions": [
{
"scriptAccount": "Temperature",
"minValue": 0,
"maxValue": "10"
}
],
"startingState": "Sonnig",
"endingState": "Wolkig"
}
]
}

View File

@ -1,6 +0,0 @@
{
"componentName": "Parent Weather",
"componentDescription": "",
"states": [],
"transitions": []
}

View File

@ -1,49 +0,0 @@
{
"componentName": "Weather(Child)",
"componentDescription": "",
"states": [
{
"initial": false,
"conditions": [
{
"scriptAccount": "Temperature",
"minValue": 0,
"maxValue": "50"
}
],
"stateLabel": "Sonnig",
"stateDescription": "Die Sonne scheint"
},
{
"initial": false,
"conditions": [
{
"scriptAccount": "Temperature",
"minValue": "50",
"maxValue": "75"
}
],
"stateLabel": "Wolkig",
"stateDescription": ""
}
],
"transitions": [
{
"scriptAccountActions": [
{
"changingValue": 10,
"scriptAccount": "Temperature"
}
],
"scriptAccountConditions": [
{
"scriptAccount": "Temperature",
"minValue": 0,
"maxValue": "10"
}
],
"startingState": "Sonnig",
"endingState": "Wolkig"
}
]
}

View File

@ -1,4 +0,0 @@
{
"componentName": "Weather",
"componentDescription": ""
}

View File

@ -0,0 +1,80 @@
{
"componentName": "Weather",
"componentDescription": "A small Gamesystem about local weather events",
"states": [
{
"initial": false,
"conditions": [],
"stateLabel": "Sonne",
"stateDescription": ""
},
{
"initial": false,
"conditions": [
{
"scriptAccount": "Temperature",
"minValue": 0,
"maxValue": "30"
}
],
"stateLabel": "Regen",
"stateDescription": ""
},
{
"initial": false,
"conditions": [],
"stateLabel": "Wolke",
"stateDescription": ""
},
{
"initial": false,
"conditions": [
{
"scriptAccount": "Temperature",
"minValue": "-5",
"maxValue": 0
}
],
"stateLabel": "Schnee",
"stateDescription": ""
}
],
"transitions": [
{
"scriptAccountActions": [],
"scriptAccountConditions": [],
"startingState": "Sonne",
"endingState": "Wolke"
},
{
"scriptAccountActions": [],
"scriptAccountConditions": [],
"startingState": "Wolke",
"endingState": "Sonne"
},
{
"scriptAccountActions": [],
"scriptAccountConditions": [],
"startingState": "Wolke",
"endingState": "Regen"
},
{
"scriptAccountActions": [],
"scriptAccountConditions": [],
"startingState": "Regen",
"endingState": "Wolke"
},
{
"scriptAccountActions": [],
"scriptAccountConditions": [],
"startingState": "Wolke",
"endingState": "Schnee"
},
{
"scriptAccountActions": [],
"scriptAccountConditions": [],
"startingState": "Schnee",
"endingState": "Wolke"
}
]
}

View File

@ -0,0 +1,4 @@
{
"componentName": "Weathersystem",
"componentDescription": "Ein Wettersystem, dass sich aus normalem Wetter (Sonne, Regen, Wolke, Schnee, Sturm etc.) und zusätzlich den Jahreszeiten (Frühling, Sommer, Herbst, Winter, etc.) zusammensetzt."
}

View File

@ -1,6 +1,6 @@
{ {
"componentName": "Temperature", "componentName": "Temperature",
"componentDescription": "", "componentDescription": "",
"minValue": 0, "minValue": -50,
"maxValue": 100 "maxValue": 70
} }