diff --git a/src/app/editor/script-account-editor/script-account-editor.component.html b/src/app/editor/script-account-editor/script-account-editor.component.html
index 0935334..406e563 100644
--- a/src/app/editor/script-account-editor/script-account-editor.component.html
+++ b/src/app/editor/script-account-editor/script-account-editor.component.html
@@ -1,13 +1,13 @@
MinValue
-
+
Please enter a valid number!
MaxValue
-
+
Please enter a valid number!
diff --git a/src/app/editor/script-account-editor/script-account-editor.component.ts b/src/app/editor/script-account-editor/script-account-editor.component.ts
index 271352a..4ee4a56 100644
--- a/src/app/editor/script-account-editor/script-account-editor.component.ts
+++ b/src/app/editor/script-account-editor/script-account-editor.component.ts
@@ -22,8 +22,8 @@ export class MyErrorStateMatcher implements ErrorStateMatcher {
export class ScriptAccountEditorComponent implements OnInit{
@Input("scriptAccount") scriptAccount : ScriptAccount | undefined
- minCtrl: FormControl = new FormControl(0, [Validators.required, Validators.pattern('^[0-9]*$')]);
- maxCtrl: FormControl = new FormControl(100, [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]*$')]);
matcher = new MyErrorStateMatcher();
constructor(private electronService: ElectronService) {
@@ -33,15 +33,8 @@ export class ScriptAccountEditorComponent implements OnInit{
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!.onModifyContent();
}
diff --git a/testModel/gamesystems/Weather.json b/testModel/gamesystems/Weather.json
deleted file mode 100644
index c7f2531..0000000
--- a/testModel/gamesystems/Weather.json
+++ /dev/null
@@ -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"
- }
- ]
-}
\ No newline at end of file
diff --git a/testModel/gamesystems/Weather/Parent Weather.json b/testModel/gamesystems/Weather/Parent Weather.json
deleted file mode 100644
index d4797d0..0000000
--- a/testModel/gamesystems/Weather/Parent Weather.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "componentName": "Parent Weather",
- "componentDescription": "",
- "states": [],
- "transitions": []
-}
\ No newline at end of file
diff --git a/testModel/gamesystems/Weather/Weather(Child).json b/testModel/gamesystems/Weather/Weather(Child).json
deleted file mode 100644
index 76b2e76..0000000
--- a/testModel/gamesystems/Weather/Weather(Child).json
+++ /dev/null
@@ -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"
- }
- ]
-}
\ No newline at end of file
diff --git a/testModel/gamesystems/Weather/Weather.json b/testModel/gamesystems/Weather/Weather.json
deleted file mode 100644
index f989303..0000000
--- a/testModel/gamesystems/Weather/Weather.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "componentName": "Weather",
- "componentDescription": ""
-}
\ No newline at end of file
diff --git a/testModel/gamesystems/Weathersystem/Weather.json b/testModel/gamesystems/Weathersystem/Weather.json
new file mode 100644
index 0000000..f35425f
--- /dev/null
+++ b/testModel/gamesystems/Weathersystem/Weather.json
@@ -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"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/testModel/gamesystems/Weathersystem/Weathersystem.json b/testModel/gamesystems/Weathersystem/Weathersystem.json
new file mode 100644
index 0000000..4a0733a
--- /dev/null
+++ b/testModel/gamesystems/Weathersystem/Weathersystem.json
@@ -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."
+}
\ No newline at end of file
diff --git a/testModel/script-accounts/Temperature.json b/testModel/script-accounts/Temperature.json
index 686f64e..53db39d 100644
--- a/testModel/script-accounts/Temperature.json
+++ b/testModel/script-accounts/Temperature.json
@@ -1,6 +1,6 @@
{
"componentName": "Temperature",
"componentDescription": "",
- "minValue": 0,
- "maxValue": 100
+ "minValue": -50,
+ "maxValue": 70
}
\ No newline at end of file