Riddle_6 DEBUG
This commit is contained in:
1 parent
2c7075847f
commit
919bf03041
3 files changed
+62
-23
No files matched your search
+1
-1
@@ -12,7 +12,7 @@ const nextConfig: NextConfig = {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
output: 'export',
|
output: 'export',
|
||||||
allowedDevOrigins: ['192.168.0.110'],
|
allowedDevOrigins: ['192.168.0.110', '10.8.0.23'],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withSerwist(nextConfig);
|
export default withSerwist(nextConfig);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import OldButton from "../OldButton";
|
import OldButton from "../OldButton";
|
||||||
import styles from "@/css/RiddleStyles.module.css";
|
import styles from "@/css/RiddleStyles.module.css";
|
||||||
import screenStyles from "@/css/RiddleScreen.module.css";
|
import screenStyles from "@/css/RiddleScreen.module.css";
|
||||||
@@ -14,14 +14,44 @@ import ChargedButton from "../ChargedButton";
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import extraStyles from "@/components/riddles-css/Riddle_6.module.css";
|
import extraStyles from "@/components/riddles-css/Riddle_6.module.css";
|
||||||
|
|
||||||
|
let acl = null;
|
||||||
|
let animVal = 0.0;
|
||||||
|
|
||||||
export default function Riddle_6({
|
export default function Riddle_6({
|
||||||
riddle,
|
riddle,
|
||||||
exitFunction,
|
exitFunction,
|
||||||
showBanner
|
showBanner
|
||||||
}: RiddleScreenControls) {
|
}: RiddleScreenControls) {
|
||||||
|
const [ page, setPage ] = useState(2);
|
||||||
|
const [aclTest, setAclTest ] = useState("X: -\nY: -\nZ: -\nO: -");
|
||||||
|
const [ overallChange, setOverallChange ] = useState(0);
|
||||||
|
const [ animValue, setAnimValue ] = useState(0.0);
|
||||||
|
|
||||||
const [ page, setPage ] = useState(0);
|
useEffect(() => {
|
||||||
|
if (page === 2 && acl === null) {
|
||||||
|
acl = new Accelerometer({ frequency: 60 });
|
||||||
|
let lastAclReading: number[] | null = null;
|
||||||
|
acl.addEventListener("reading", () => {
|
||||||
|
const readings = [acl.x.toFixed(2), acl.y.toFixed(2), acl.z.toFixed(2)];
|
||||||
|
if (lastAclReading !== null) {
|
||||||
|
animVal = Math.max(0, animVal - 25.5);
|
||||||
|
const o = (lastAclReading[0] - readings[0]) + (lastAclReading[1] - readings[1]) + (lastAclReading[2] - readings[2]);
|
||||||
|
setOverallChange(o);
|
||||||
|
if (Math.abs(o) > 3) {
|
||||||
|
animVal = 255;
|
||||||
|
}
|
||||||
|
setAclTest(`X: ${readings[0]}\nY: ${readings[1]}\nZ: ${readings[2]}\nO: ${o}`);
|
||||||
|
setAnimValue(animVal);
|
||||||
|
} else {
|
||||||
|
setAclTest(`X: ${readings[0]}\nY: ${readings[1]}\nZ: ${readings[2]}\nO: -`);
|
||||||
|
}
|
||||||
|
lastAclReading = [...readings];
|
||||||
|
});
|
||||||
|
acl.start();
|
||||||
|
showBanner(false); // FIXME: TESTING
|
||||||
|
}
|
||||||
|
}, [page]);
|
||||||
|
|
||||||
const pages = [
|
const pages = [
|
||||||
(
|
(
|
||||||
<div key={0}>
|
<div key={0}>
|
||||||
@@ -52,28 +82,37 @@ export default function Riddle_6({
|
|||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
<div key={2}>
|
<div key={2} style={{width: "100%"}}>
|
||||||
<div className={styles["content"]}>
|
<div className={styles["content"]}>
|
||||||
<div className={screenStyles["title"]}>
|
<div className={screenStyles["title"]}>
|
||||||
<p className="eisenkraft-regular" style={{fontSize: "1.25rem", color: "var(--blue)"}}>{riddle["station_name"]}</p>
|
<p className="eisenkraft-regular" style={{fontSize: "1.25rem", color: "var(--blue)"}}>{riddle["station_name"]}</p>
|
||||||
<p className="eisenkraft-regular" style={{fontSize: "1.75rem", color: "var(--blue)"}}>{riddle["station_title"]}</p>
|
<p className="eisenkraft-regular" style={{fontSize: "1.75rem", color: "var(--blue)"}}>{riddle["station_title"]}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className={extraStyles["heart-container"]}>
|
<div className={extraStyles["heart-container"]}>
|
||||||
<div className={clsx(extraStyles["heart"])}>
|
<div className={clsx(extraStyles["heart"])} style={{backgroundColor: "rgb(" + animValue + ", 0, 0)"}}>
|
||||||
|
<p style={{color: "white", whiteSpace: "pre-line"}}>{aclTest}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["buttons"]}>
|
<div className={styles["buttons"]}>
|
||||||
|
<ChargedButton
|
||||||
|
holdDuration={300}
|
||||||
|
red={true}
|
||||||
|
onAction={() => {
|
||||||
|
setPage(3);
|
||||||
|
showBanner(true);
|
||||||
|
}}
|
||||||
|
>Done Testing...</ChargedButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
<div key={3}>
|
<div key={3}>
|
||||||
<div className={styles["content"]}>
|
<div className={styles["content"]}>
|
||||||
<RiddleCompleteBanner points={200} win={true}></RiddleCompleteBanner>
|
<RiddleCompleteBanner points={500} win={true}></RiddleCompleteBanner>
|
||||||
<p>Der Fels gibt nach, und nach all den Jahren liegt Excalibur wieder in der Hand eines Menschen. Die Prophezeiung hat gewählt.</p>
|
<p>Endlich herrscht vollkommene Ruhe, und für einen kurzen Augenblick scheint selbst der Wald mit euch den Atem anzuhalten.</p>
|
||||||
<p>Bevor ihr das Schwert zurückgebt, haltet diesen Augenblick fest. Hebt Excalibur, versammelt euch und macht ein Foto, das ebenso gut seinen Platz in den Chroniken von Stettenfels finden könnte. Triumphiert ruhig ein wenig – schließlich zieht man nicht jeden Tag ein legendäres Königsschwert aus einem Felsen.</p>
|
<p>Ihr habt verstanden, was Sir Galahad von einem Herrscher verlangt: Nicht jede Herausforderung wird durch Stärke gewonnen; manchmal zeigt sich wahre Größe darin, den richtigen Augenblick abzuwarten.</p>
|
||||||
<p>Erst wenn euer Beweis für die Nachwelt geschaffen ist, steckt Excalibur zurück in den Stein. Denn aus der Ferne erreicht euch noch immer kein Jubel, sondern nur Schweigen. Offenbar genügt es nicht mehr, das Schwert zu ziehen.</p>
|
<p>Die Prüfung ist bestanden, und unter den alten Rittern beginnt sich die Nachricht zu verbreiten, dass der neue Auserwählte mehr besitzt als Excalibur – nämlich Selbstbeherrschung.</p>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["buttons"]}>
|
<div className={styles["buttons"]}>
|
||||||
<OldButton red={false} disabled={false} onAction={() => exitFunction()}>ZURÜCK ZUR KARTE</OldButton>
|
<OldButton red={false} disabled={false} onAction={() => exitFunction()}>ZURÜCK ZUR KARTE</OldButton>
|
||||||
|
|||||||
@@ -15,19 +15,6 @@ import OldPopUp from "../OldPopUp";
|
|||||||
import { MAX_POINTS, MIN_POINTS } from "@/utils/points";
|
import { MAX_POINTS, MIN_POINTS } from "@/utils/points";
|
||||||
|
|
||||||
export default function Tour() {
|
export default function Tour() {
|
||||||
const [ stepStr, setStep ] = useLocalStorage(PREF.step, "0");
|
|
||||||
const [ activeRiddle, setActiveRiddle ] = useState<string | null>(null);
|
|
||||||
const [ clickedMarker, setClickedMarker ] = useState(null);
|
|
||||||
const [ tourCode, setTourCode ] = useLocalStorage(PREF.code, "");
|
|
||||||
const [ completedRiddlesStr, setCompletedRiddles ] = useLocalStorage(PREF.completed_riddles, "");
|
|
||||||
const [ , setPlayers ] = useLocalStorage(PREF.players, "");
|
|
||||||
const [ pointsStr, setPoints ] = useLocalStorage(PREF.points, "0");
|
|
||||||
const [ markers, setMarkers ] = useState<PlaceMarker[]>([]);
|
|
||||||
const { gpsStatus, cameraStatus } = usePermissions();
|
|
||||||
const points = Number.parseInt(pointsStr);
|
|
||||||
|
|
||||||
const permissionsGranted = gpsStatus === "granted" && cameraStatus === "granted";
|
|
||||||
|
|
||||||
const riddleData = {
|
const riddleData = {
|
||||||
"riddle_1": {
|
"riddle_1": {
|
||||||
"id": "riddle_1",
|
"id": "riddle_1",
|
||||||
@@ -76,6 +63,19 @@ export default function Tour() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [ stepStr, setStep ] = useLocalStorage(PREF.step, "0");
|
||||||
|
const [ activeRiddle, setActiveRiddle ] = useState<string | null>("riddle_6");
|
||||||
|
const [ clickedMarker, setClickedMarker ] = useState(riddleData[5]);
|
||||||
|
const [ tourCode, setTourCode ] = useLocalStorage(PREF.code, "");
|
||||||
|
const [ completedRiddlesStr, setCompletedRiddles ] = useLocalStorage(PREF.completed_riddles, "");
|
||||||
|
const [ , setPlayers ] = useLocalStorage(PREF.players, "");
|
||||||
|
const [ pointsStr, setPoints ] = useLocalStorage(PREF.points, "0");
|
||||||
|
const [ markers, setMarkers ] = useState<PlaceMarker[]>([]);
|
||||||
|
const { gpsStatus, cameraStatus } = usePermissions();
|
||||||
|
const points = Number.parseInt(pointsStr);
|
||||||
|
|
||||||
|
const permissionsGranted = gpsStatus === "granted" && cameraStatus === "granted";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let timerId: string | number | NodeJS.Timeout | undefined;
|
let timerId: string | number | NodeJS.Timeout | undefined;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user