issue-15 #21
@ -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>
|
||||||
|
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"componentName": "Parent Weather",
|
|
||||||
"componentDescription": "",
|
|
||||||
"states": [],
|
|
||||||
"transitions": []
|
|
||||||
}
|
|
@ -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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"componentName": "Weather",
|
|
||||||
"componentDescription": ""
|
|
||||||
}
|
|
80
testModel/gamesystems/Weathersystem/Weather.json
Normal file
80
testModel/gamesystems/Weathersystem/Weather.json
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
4
testModel/gamesystems/Weathersystem/Weathersystem.json
Normal file
4
testModel/gamesystems/Weathersystem/Weathersystem.json
Normal 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."
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"componentName": "Temperature",
|
"componentName": "Temperature",
|
||||||
"componentDescription": "",
|
"componentDescription": "",
|
||||||
"minValue": 0,
|
"minValue": -50,
|
||||||
"maxValue": 100
|
"maxValue": 70
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user