diff --git a/config.xml b/config.xml
index d0e320b6..71d01431 100644
--- a/config.xml
+++ b/config.xml
@@ -3,7 +3,7 @@
OriGami
OriGami is an orientation game.
Ionic Framework Team
-
+
@@ -110,5 +110,4 @@
-
diff --git a/package-lock.json b/package-lock.json
index 63d52a1a..8e631ec3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4675,6 +4675,11 @@
"integrity": "sha1-/B+9wNjXAzp+jh8ff/FnrJvU+vY=",
"dev": true
},
+ "cordova-plugin-vibration": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/cordova-plugin-vibration/-/cordova-plugin-vibration-3.1.1.tgz",
+ "integrity": "sha512-qgv67Rueo4Pydfant3TwnXeFiN9dl+6lKMM6h5jYg9XewiGAGOr8vfWsTvQssC3m3xMKGS1ap3xPNH+BzZ4RMA=="
+ },
"cordova-plugin-whitelist": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.3.tgz",
diff --git a/package.json b/package.json
index 707a74d9..ec3a885d 100644
--- a/package.json
+++ b/package.json
@@ -27,8 +27,10 @@
"@ionic-native/device": "^5.16.0",
"@ionic-native/device-orientation": "^5.15.0",
"@ionic-native/geolocation": "^5.11.0",
+ "@ionic-native/insomnia": "^5.16.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.11.0",
+ "@ionic-native/vibration": "^5.16.0",
"@ionic/angular": "^4.1.0",
"@mapbox/mapbox-gl-draw": "^1.1.2",
"@ngx-translate/core": "^11.0.1",
@@ -39,6 +41,7 @@
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-device-orientation": "^2.0.1",
"cordova-plugin-geolocation": "^4.0.2",
+ "cordova-plugin-vibration": "^3.1.1",
"core-js": "^2.5.4",
"leaflet.offline": "^1.0.4",
"mapbox-gl": "^1.5.0",
@@ -97,7 +100,9 @@
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-camera": {},
- "cordova-plugin-device-orientation": {}
+ "cordova-plugin-device-orientation": {},
+ "cordova-plugin-insomnia": {},
+ "cordova-plugin-vibration": {}
},
"platforms": [
"android",
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 8161d2c9..cb40a567 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -49,6 +49,9 @@ import { DynamicFormModule } from "./dynamic-form/dynamic-form.module";
import { LottieAnimationViewModule } from "ng-lottie";
import { Device } from "@ionic-native/device/ngx";
+import { Insomnia } from "@ionic-native/insomnia/ngx";
+import { Vibration } from "@ionic-native/vibration/ngx";
+
// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, "./assets/i18n/", ".json");
@@ -105,7 +108,9 @@ export function HttpLoaderFactory(http: HttpClient) {
// Geofence,
Camera,
DeviceOrientation,
- Device
+ Device,
+ Insomnia,
+ Vibration
],
bootstrap: [AppComponent]
})
diff --git a/src/app/form-elements/map/map.component.ts b/src/app/form-elements/map/map.component.ts
index 1afdf1bf..a44f5319 100644
--- a/src/app/form-elements/map/map.component.ts
+++ b/src/app/form-elements/map/map.component.ts
@@ -114,6 +114,15 @@ export class MapComponent implements OnInit, Field, AfterViewInit {
e.preventDefault();
}
if (this.config.featureType == "direction") {
+ let bearing = this.map.getBearing();
+
+ while (bearing > 360) {
+ bearing = bearing - 360;
+ }
+ while (bearing < 0) {
+ bearing = bearing + 360;
+ }
+
this.group.patchValue({ [this.config.name]: this.map.getBearing() });
}
});
diff --git a/src/app/models/themetasks.js b/src/app/models/themetasks.js
index d1b07d6e..09962c5c 100644
--- a/src/app/models/themetasks.js
+++ b/src/app/models/themetasks.js
@@ -1,288 +1,320 @@
-import { Validators } from '@angular/forms';
+import { Validators } from "@angular/forms";
export default [
- {
- "type": "theme-loc",
- "name": "Selbst-Lokalisation",
- "developer": [
- {
- "type": "input",
- "name": "text",
- "inputType": "area",
- "label": "Aufgabenstellung",
- "text": "Wo befindest du dich gerade? Markiere deine Position mit einem Klick auf der Karte.",
- "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt",
+ {
+ type: "theme-loc",
+ name: "Selbst-Lokalisation",
+ developer: [
+ {
+ type: "input",
+ name: "text",
+ inputType: "area",
+ label: "Aufgabenstellung",
+ text:
+ "Wo befindest du dich gerade? Markiere deine Position mit einem Klick auf der Karte.",
+ info:
+ "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt",
+ validation: [Validators.required, Validators.minLength(4)]
+ }
+ ]
+ },
+ {
+ type: "theme-object",
+ name: "Objektsuche",
+ developer: [
+ {
+ type: "select",
+ label: "Fragetyp",
+ name: "question-type",
+ selectOptions: [
+ {
+ label: "... mittels Beschreibung",
+ name: "description",
+ items: [
+ {
+ type: "input",
+ name: "object-description",
+ inputType: "area",
+ label: "Objektbeschreibung",
+ text: "",
+ info:
+ "Beschreibe das Objekt, das der Spieler finden soll, möglichst genau.",
validation: [Validators.required, Validators.minLength(4)]
- }
- ]
- },
- {
- "type": "theme-object",
- "name": "Objektsuche",
- "developer": [
- {
- "type": "select",
- "label": "Fragetyp",
- "name": "question-type",
- "selectOptions": [
- {
- "label": "... mittels Beschreibung",
- "name": "description",
- "items": [
- {
- "type": "input",
- "name": "object-description",
- "inputType": "area",
- "label": "Objektbeschreibung",
- "text": "",
- "info": "Beschreibe das Objekt, das der Spieler finden soll, möglichst genau.",
- validation: [Validators.required, Validators.minLength(4)]
- },
- {
- "type": "input",
- "name": "text",
- "inputType": "area",
- "label": "Aufgabenstellung",
- "text": "",
- "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
- validation: [Validators.required, Validators.minLength(4)]
- },
- {
- "type": "select",
- "label": "Antworttyp",
- "name": "answer-type",
- "selectOptions": [
- {
- "label": "Setzen eines Kartenpunktes",
- "name": "set-point",
- "items": [
- {
- "type": "map",
- "name": "point",
- "featureType": "point",
- "label": "Objektposition",
- "info": "Umrande das Objekt, das der Spieler finden soll, mit mehreren Klicks auf der Karte. Die Markierung wird dem Spieler nicht angezeigt",
- validation: [Validators.required]
- }
- ]
- },
- {
- "label": "Wählen eines Fotos",
- "name": "select-photo",
- "items": [
- {
- "type": "photoUploadMultipleChoice",
- "name": "multiple-choice",
- "label": "Multiple Choice",
- "info": "Lade ein Foto vom dem zu suchenden Objekt hoch sowie drei weitere Fotos, die nicht der korrekten Lösung entsprechen.",
- validation: [Validators.required]
- }
- ]
- }, {
- "label": "Aufnahme eines Fotos",
- "name": "take-photo",
- "items": []
- }
- ]
- }
- ]
- },
- {
- "label": "... mittels Foto",
- "name": "photo",
- "items": [
- {
- "type": "input",
- "name": "text",
- "inputType": "area",
- "label": "Aufgabenstellung",
- "text": "Suche in deiner Umgebung das Objekt, das du hier auf dem Foto siehst. Klicke das Objekt auf der Karte an.",
- "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
- validation: [Validators.required, Validators.minLength(4)]
- },
- {
- "type": "photoUpload",
- "name": "photo",
- "label": "Foto des zu suchenden Objekts",
- "text": "",
- "info": "Lade ein Foto von dem Objekt hoch, das der Spieler finden soll.",
- validation: [Validators.required, Validators.minLength(4)]
- }, {
- "type": "map",
- "name": "point",
- "featureType": "point",
- "label": "Objektposition",
- "info": "Umrande das Objekt, das der Spieler finden soll, mit mehreren Klicks auf der Karte. Die Markierung wird dem Spieler nicht angezeigt",
- validation: [Validators.required]
- }
- ]
- }, {
- "label": "... mittels Karte",
- "items": [
- {
- "type": "input",
- "name": "text",
- "inputType": "area",
- "label": "Aufgabenstellung",
- "text": "",
- "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
- validation: [Validators.required, Validators.minLength(4)]
- },
- {
- "type": "map",
- "name": "point",
- "featureType": "point",
- "label": "Objektposition",
- "info": "Umrande das Objekt, das der Spieler finden soll, mit mehreren Klicks auf der Karte. Diese Markierung wird dem Spieler während der Aufgabenstellung angezeigt",
- validation: [Validators.required]
- },
- {
- "type": "select",
- "label": "Antworttyp",
- "name": "answer-type",
- "selectOptions": [
- {
- "label": "Wählen eines Fotos",
- "items": [
- {
- "type": "photoUploadMultipleChoice",
- "name": "multiple-choice",
- "label": "Multiple Choice",
- "info": "Lade ein Foto vom dem zu suchenden Objekt hoch sowie drei weitere Fotos, die nicht der korrekten Lösung entsprechen.",
- validation: [Validators.required]
- }
- ]
- }, {
- "label": "Aufnahme eines Fotos",
- "items": []
- },
- ]
- }
- ]
- }
+ },
+ {
+ type: "input",
+ name: "text",
+ inputType: "area",
+ label: "Aufgabenstellung",
+ text: "",
+ info:
+ "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
+ validation: [Validators.required, Validators.minLength(4)]
+ },
+ {
+ type: "select",
+ label: "Antworttyp",
+ name: "answer-type",
+ selectOptions: [
+ {
+ label: "Setzen eines Kartenpunktes",
+ name: "set-point",
+ items: [
+ {
+ type: "map",
+ name: "point",
+ featureType: "point",
+ label: "Objektposition",
+ info:
+ "Umrande das Objekt, das der Spieler finden soll, mit mehreren Klicks auf der Karte. Die Markierung wird dem Spieler nicht angezeigt",
+ validation: [Validators.required]
+ }
+ ]
+ },
+ {
+ label: "Wählen eines Fotos",
+ name: "select-photo",
+ items: [
+ {
+ type: "photoUploadMultipleChoice",
+ name: "multiple-choice",
+ label: "Multiple Choice",
+ info:
+ "Lade ein Foto vom dem zu suchenden Objekt hoch sowie drei weitere Fotos, die nicht der korrekten Lösung entsprechen.",
+ validation: [Validators.required]
+ }
+ ]
+ },
+ {
+ label: "Aufnahme eines Fotos",
+ name: "take-photo",
+ items: []
+ }
+ ]
+ }
+ ]
+ },
+ {
+ label: "... mittels Foto",
+ name: "photo",
+ items: [
+ {
+ type: "input",
+ name: "text",
+ inputType: "area",
+ label: "Aufgabenstellung",
+ text:
+ "Suche in deiner Umgebung das Objekt, das du hier auf dem Foto siehst. Klicke das Objekt auf der Karte an.",
+ info:
+ "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
+ validation: [Validators.required, Validators.minLength(4)]
+ },
+ {
+ type: "photoUpload",
+ name: "photo",
+ label: "Foto des zu suchenden Objekts",
+ text: "",
+ info:
+ "Lade ein Foto von dem Objekt hoch, das der Spieler finden soll.",
+ validation: [Validators.required, Validators.minLength(4)]
+ },
+ {
+ type: "map",
+ name: "point",
+ featureType: "point",
+ label: "Objektposition",
+ info:
+ "Umrande das Objekt, das der Spieler finden soll, mit mehreren Klicks auf der Karte. Die Markierung wird dem Spieler nicht angezeigt",
+ validation: [Validators.required]
+ }
+ ]
+ },
+ {
+ label: "... mittels Karte",
+ items: [
+ {
+ type: "input",
+ name: "text",
+ inputType: "area",
+ label: "Aufgabenstellung",
+ text: "",
+ info:
+ "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
+ validation: [Validators.required, Validators.minLength(4)]
+ },
+ {
+ type: "map",
+ name: "point",
+ featureType: "point",
+ label: "Objektposition",
+ info:
+ "Umrande das Objekt, das der Spieler finden soll, mit mehreren Klicks auf der Karte. Diese Markierung wird dem Spieler während der Aufgabenstellung angezeigt",
+ validation: [Validators.required]
+ },
+ {
+ type: "select",
+ label: "Antworttyp",
+ name: "answer-type",
+ selectOptions: [
+ {
+ label: "Wählen eines Fotos",
+ items: [
+ {
+ type: "photoUploadMultipleChoice",
+ name: "multiple-choice",
+ label: "Multiple Choice",
+ info:
+ "Lade ein Foto vom dem zu suchenden Objekt hoch sowie drei weitere Fotos, die nicht der korrekten Lösung entsprechen.",
+ validation: [Validators.required]
+ }
+ ]
+ },
+ {
+ label: "Aufnahme eines Fotos",
+ items: []
+ }
]
- }
+ }
+ ]
+ }
]
- },
- {
- "type": "theme-direction",
- "name": "Richtungssuche",
- "developer": [
- {
- "type": "select",
- "label": "Fragetyp",
- "name": "question-type",
- "selectOptions": [
- {
- "label": "... durch Blickausrichtung",
- "items": [
- {
- "type": "input",
- "name": "text",
- "inputType": "area",
- "label": "Aufgabenstellung",
- "text": "Drehe dich, bis die Pfeile übereinander liegen. Markiere deine neue Blickrichtung mit einem Klick auf der Karte.",
- "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
- validation: [Validators.required, Validators.minLength(4)]
- },
- {
- "type": "map",
- "name": "direction",
- "featureType": "direction",
- "label": "Gewünschte Blickrichtung",
- "info": "Markiere die Richtung, in die der Spieler blicken soll, mit einem Klick auf der Karte. Die App wird den Spieler in diese Richtung „drehen“ und ihn daraufhin auffordern, seine neue Blickrichtung in die Karte einzuzeichnen",
- validation: [Validators.required]
- },
- ]
- }, {
- "label": "... mittels Foto",
- "name": "photo",
- "items": [
- {
- "type": "input",
- "name": "text",
- "inputType": "area",
- "label": "Aufgabenstellung",
- "text": "Markiere die Richtung, die du auf dem Bild siehst, mit einem Klick auf der Karte.",
- "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
- validation: [Validators.required, Validators.minLength(4)]
- },
- {
- "type": "photoUpload",
- "name": "photo",
- "label": "Foto der zu suchenden Richtung",
- "info": " Lade ein Foto hoch, das am Startpunkt aufgenommen wurde und in die gesuchte Richtung zeigt.",
- validation: [Validators.required, Validators.minLength(4)]
- }, {
- "type": "map",
- "name": "point",
- "featureType": "point",
- "label": "Richtung auf der Karte",
- "info": "Markiere die Richtung, die der Spieler finden soll, mit einem Klick auf der Karte. Diese Markierung wird dem Spieler bei Aufgabenstellung nicht angezeigt",
- validation: [Validators.required]
- },
- ]
- }, {
- "label": "... mittels Karte",
- "name": "question-type-map",
- "items": [
- {
- "type": "input",
- "name": "text",
- "inputType": "area",
- "label": "Aufgabenstellung",
- "text": "",
- "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
- validation: [Validators.required, Validators.minLength(4)]
- },
- {
- "type": "map",
- "name": "map-direction",
- "featureType": "direction",
- "label": "Richtung auf der Karte",
- "info": " Markiere die Richtung, die der Spieler finden soll, mit einem Klick auf der Karte. Diese Richtung wird dem Spieler bei Aufgabenstellung auf der Karte angezeigt.",
- validation: [Validators.required]
- }, {
- "type": "select",
- "label": "Antworttyp",
- "name": "answer-type",
- "selectOptions": [
- {
- "label": "Einnehmen einer Blickrichtung",
- "items": []
- }, {
- "label": "Wählen eines Fotos",
- "items": [
- {
- "type": "photoUploadMultipleChoice",
- "name": "multiple-choice",
- "label": "Multiple Choice",
- "info": "Lade ein Foto vom dem zu suchenden Objekt hoch sowie drei weitere Fotos, die nicht der korrekten Lösung entsprechen.",
- validation: [Validators.required]
- }
- ]
- },
- ]
- }
- ]
- }
+ }
+ ]
+ },
+ {
+ type: "theme-direction",
+ name: "Richtungssuche",
+ developer: [
+ {
+ type: "select",
+ label: "Fragetyp",
+ name: "question-type",
+ selectOptions: [
+ {
+ label: "... durch Blickausrichtung",
+ items: [
+ {
+ type: "input",
+ name: "text",
+ inputType: "area",
+ label: "Aufgabenstellung",
+ text:
+ "Drehe dich, bis die Pfeile übereinander liegen. Markiere deine neue Blickrichtung mit einem Klick auf der Karte.",
+ info:
+ "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
+ validation: [Validators.required, Validators.minLength(4)]
+ },
+ {
+ type: "map",
+ name: "direction",
+ featureType: "direction",
+ label: "Gewünschte Blickrichtung",
+ info:
+ "Markiere die Richtung, in die der Spieler blicken soll, mit einem Klick auf der Karte. Die App wird den Spieler in diese Richtung „drehen“ und ihn daraufhin auffordern, seine neue Blickrichtung in die Karte einzuzeichnen",
+ validation: [Validators.required]
+ }
+ ]
+ },
+ {
+ label: "... mittels Foto",
+ name: "photo",
+ items: [
+ {
+ type: "input",
+ name: "text",
+ inputType: "area",
+ label: "Aufgabenstellung",
+ text:
+ "Markiere die Richtung, die du auf dem Bild siehst, mit einem Klick auf der Karte.",
+ info:
+ "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
+ validation: [Validators.required, Validators.minLength(4)]
+ },
+ {
+ type: "photoUpload",
+ name: "photo",
+ label: "Foto der zu suchenden Richtung",
+ info:
+ " Lade ein Foto hoch, das am Startpunkt aufgenommen wurde und in die gesuchte Richtung zeigt.",
+ validation: [Validators.required, Validators.minLength(4)]
+ },
+ {
+ type: "map",
+ name: "direction",
+ featureType: "direction",
+ label: "Richtung auf der Karte",
+ info:
+ "Markiere die Richtung, die der Spieler finden soll, mit einem Klick auf der Karte. Diese Markierung wird dem Spieler bei Aufgabenstellung nicht angezeigt",
+ validation: [Validators.required]
+ }
+ ]
+ },
+ {
+ label: "... mittels Karte",
+ name: "question-type-map",
+ items: [
+ {
+ type: "input",
+ name: "text",
+ inputType: "area",
+ label: "Aufgabenstellung",
+ text: "",
+ info:
+ "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt.",
+ validation: [Validators.required, Validators.minLength(4)]
+ },
+ {
+ type: "map",
+ name: "direction",
+ featureType: "direction",
+ label: "Richtung auf der Karte",
+ info:
+ " Markiere die Richtung, die der Spieler finden soll, mit einem Klick auf der Karte. Diese Richtung wird dem Spieler bei Aufgabenstellung auf der Karte angezeigt.",
+ validation: [Validators.required]
+ },
+ {
+ type: "select",
+ label: "Antworttyp",
+ name: "answer-type",
+ selectOptions: [
+ {
+ label: "Einnehmen einer Blickrichtung",
+ items: []
+ },
+ {
+ label: "Wählen eines Fotos",
+ items: [
+ {
+ type: "photoUploadMultipleChoice",
+ name: "multiple-choice",
+ label: "Multiple Choice",
+ info:
+ "Lade ein Foto vom dem zu suchenden Objekt hoch sowie drei weitere Fotos, die nicht der korrekten Lösung entsprechen.",
+ validation: [Validators.required]
+ }
+ ]
+ }
]
- }
+ }
+ ]
+ }
]
- },
- // {
- // "type": "theme-object",
- // "name": "Objektsuche",
- // "developer": [
- // {
- // "type": "input",
- // "name": "text",
- // "inputType": "area",
- // "label": "Aufgabenstellung",
- // "text": "Wo befindest du dich gerade? Markiere deine Position mit einem Klick auf der Karte.",
- // "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt",
- // validation: [Validators.required, Validators.minLength(4)]
- // }
- // ]
- // }
-]
\ No newline at end of file
+ }
+ ]
+ }
+ // {
+ // "type": "theme-object",
+ // "name": "Objektsuche",
+ // "developer": [
+ // {
+ // "type": "input",
+ // "name": "text",
+ // "inputType": "area",
+ // "label": "Aufgabenstellung",
+ // "text": "Wo befindest du dich gerade? Markiere deine Position mit einem Klick auf der Karte.",
+ // "info": "Diese Aufgabenstellung wird dem Spieler im Spielverlauf angezeigt",
+ // validation: [Validators.required, Validators.minLength(4)]
+ // }
+ // ]
+ // }
+];
diff --git a/src/app/pages/create-game/create-game-overview/create-game-overview.page.ts b/src/app/pages/create-game/create-game-overview/create-game-overview.page.ts
index a550203a..bd4b3739 100644
--- a/src/app/pages/create-game/create-game-overview/create-game-overview.page.ts
+++ b/src/app/pages/create-game/create-game-overview/create-game-overview.page.ts
@@ -9,8 +9,7 @@ import { Game } from "../../../models/game";
import { GameFactoryService } from "../../../services/game-factory.service";
import { PopoverComponent } from "../../../popover/popover.component";
-import { GamesService } from 'src/app/services/games.service';
-
+import { GamesService } from "src/app/services/games.service";
@Component({
selector: "app-create-game-overview",
@@ -18,10 +17,10 @@ import { GamesService } from 'src/app/services/games.service';
styleUrls: ["./create-game-overview.page.scss"]
})
export class CreateGameOverviewPage implements OnInit {
- public model = this.gameFactory.getGame()
+ public model = this.gameFactory.getGame();
public lottieConfig: Object;
- showSuccess: boolean = false
- showUpload: boolean = false
+ showSuccess: boolean = false;
+ showUpload: boolean = false;
constructor(
public popoverController: PopoverController,
@@ -30,8 +29,8 @@ export class CreateGameOverviewPage implements OnInit {
public gamesService: GamesService
) {
this.lottieConfig = {
- path: 'assets/lottie/astronaut.json',
- renderer: 'canvas',
+ path: "assets/lottie/astronaut.json",
+ renderer: "canvas",
autoplay: true,
loop: true
};
@@ -39,7 +38,7 @@ export class CreateGameOverviewPage implements OnInit {
// #0a1b28
- ngOnInit() { }
+ ngOnInit() {}
async showTrackingInfo(ev: any, text: string) {
console.log(ev);
@@ -54,17 +53,21 @@ export class CreateGameOverviewPage implements OnInit {
uploadGame() {
this.gameFactory.addGameInformation(this.model);
- console.log(this.gameFactory.game)
+ console.log(this.gameFactory.game);
- this.showUpload = true
- this.gamesService.postGame(this.gameFactory.game).then(res => {
- if (res.status == 200) {
- this.showSuccess = true
- }
- }).catch(e => console.error(e))
+ this.showUpload = true;
+ this.gamesService
+ .postGame(this.gameFactory.game)
+ .then(res => {
+ if (res.status == 200) {
+ this.showSuccess = true;
+ this.gameFactory.flushGame();
+ }
+ })
+ .catch(e => console.error(e));
}
navigateHome() {
- this.navCtrl.navigateRoot('/')
+ this.navCtrl.navigateRoot("/");
}
}
diff --git a/src/app/pages/play-game/playing-game/playing-game.page.html b/src/app/pages/play-game/playing-game/playing-game.page.html
index 03ffc89d..911134e7 100644
--- a/src/app/pages/play-game/playing-game/playing-game.page.html
+++ b/src/app/pages/play-game/playing-game/playing-game.page.html
@@ -38,7 +38,8 @@
Aufgabe {{ taskIndex + 1 }} von {{ game.tasks.length }}
-
+
Distanz: {{ Math.round(targetDistance) }} m
+
console.log("success"), () => console.log("error"));
}
initGame() {
@@ -394,6 +402,7 @@ export class PlayingGamePage implements OnInit {
}
initTask() {
+ this.vibration.vibrate([100, 100, 100]);
console.log("Current task: ", this.task);
this._initMapFeatures();
this.trackerService.addEvent({
@@ -444,14 +453,16 @@ export class PlayingGamePage implements OnInit {
this.uploadDone = true;
}
});
- navigator.vibrate([300, 300, 300]);
+ this.vibration.vibrate([300, 300, 300]);
+ this.insomnia
+ .allowSleepAgain()
+ .then(() => console.log("success"), () => console.log("error"));
return;
}
this.task = this.game.tasks[this.taskIndex];
this.initTask();
console.log(this.taskIndex, this.task);
- navigator.vibrate([100, 100, 100]);
}
async onOkClicked() {
@@ -623,11 +634,10 @@ export class PlayingGamePage implements OnInit {
_initMapFeatures() {
const mapFeatures = this.task.settings.mapFeatures;
- console.log(mapFeatures);
+ console.log("MapFeatures: ", mapFeatures);
if (mapFeatures != undefined) {
for (let key in mapFeatures) {
if (mapFeatures.hasOwnProperty(key)) {
- console.log(key + " -> " + mapFeatures[key]);
switch (key) {
case "zoombar":
if (mapFeatures[key]) {
diff --git a/src/app/services/game-factory.service.ts b/src/app/services/game-factory.service.ts
index edfe052b..a11c581a 100644
--- a/src/app/services/game-factory.service.ts
+++ b/src/app/services/game-factory.service.ts
@@ -8,7 +8,7 @@ import { Game } from "./../models/game";
export class GameFactoryService {
public game: Game;
- constructor() { }
+ constructor() {}
addGameInformation(data: any) {
this.game = {
@@ -40,13 +40,12 @@ export class GameFactoryService {
getGame() {
if (!this.game) {
- this.game = new Game(
- Math.floor(Date.now() / 1000),
- "",
- true,
- [],
- );
+ this.game = new Game(Math.floor(Date.now() / 1000), "", true, []);
}
return this.game;
}
+
+ flushGame() {
+ this.game = undefined;
+ }
}
diff --git a/yarn.lock b/yarn.lock
index 8490a763..1baf1bbf 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -960,6 +960,13 @@
dependencies:
"@types/cordova" latest
+"@ionic-native/insomnia@^5.16.0":
+ version "5.16.0"
+ resolved "https://registry.yarnpkg.com/@ionic-native/insomnia/-/insomnia-5.16.0.tgz#383acc88ead0c0d93360fae0d633ee014aeb2faf"
+ integrity sha512-oRexR6UaVMEMBZOlCAGJmWPzepaTytLknz1bKUe6Z5zZ7zbLfj4mKeOPnKHtu/iZF2cLYCydCogIO+XF0jzbfA==
+ dependencies:
+ "@types/cordova" latest
+
"@ionic-native/splash-screen@^5.0.0":
version "5.15.0"
resolved "https://registry.yarnpkg.com/@ionic-native/splash-screen/-/splash-screen-5.15.0.tgz#34624f272cc7654977883a427aa3f5653e26032e"
@@ -974,6 +981,13 @@
dependencies:
"@types/cordova" latest
+"@ionic-native/vibration@^5.16.0":
+ version "5.16.0"
+ resolved "https://registry.yarnpkg.com/@ionic-native/vibration/-/vibration-5.16.0.tgz#9d627c5a989e55bdcfdde7d4fa0bf5d8ec8c0839"
+ integrity sha512-+gI1aXvSUz4IuDoS0ISNLiasuk0SuHo3jj2Lek6ddAJI1IhUlikr8VCcLxHWRkuW1gqXBPWbLAJNvHF5WQEkaA==
+ dependencies:
+ "@types/cordova" latest
+
"@ionic/angular-toolkit@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@ionic/angular-toolkit/-/angular-toolkit-2.0.0.tgz#2095f3b0ed731600fe590aa024682fdd532a4833"
@@ -2951,6 +2965,11 @@ cordova-plugin-statusbar@^2.4.2:
resolved "https://registry.yarnpkg.com/cordova-plugin-statusbar/-/cordova-plugin-statusbar-2.4.3.tgz#cc557aef66c27484e0f7f045004040d03321f82d"
integrity sha512-ThmXzl6QIKWFXf4wWw7Q/zpB+VKkz3VM958+5A0sXD4jmR++u7KnGttLksXshVwWr6lvGwUebLYtIyXwS4Ovcg==
+cordova-plugin-vibration@^3.1.1:
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/cordova-plugin-vibration/-/cordova-plugin-vibration-3.1.1.tgz#38fcdd9a7675cfb44d86339c1b2cb129017e9e00"
+ integrity sha512-qgv67Rueo4Pydfant3TwnXeFiN9dl+6lKMM6h5jYg9XewiGAGOr8vfWsTvQssC3m3xMKGS1ap3xPNH+BzZ4RMA==
+
cordova-plugin-whitelist@^1.3.3:
version "1.3.4"
resolved "https://registry.yarnpkg.com/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.4.tgz#31938545c7c3e7de35c20ab08c2c3afa06e8a3f9"