reachedRiddles
This commit is contained in:
1 parent
e6f2448e94
commit
d301cf6d9a
4 files changed
+5
-5
No files matched your search
@@ -26,6 +26,7 @@ export default function Intro() {
|
||||
const [ videoPaused, setVideoPaused ] = useState(false);
|
||||
const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voice_over, "off");
|
||||
const [ boughtHintsStr, setBoughtHints ] = useLocalStorage(PREF.bought_hints, "");
|
||||
const [ reachedRiddlesStr, setReachedRiddles ] = useLocalStorage(PREF.reached_riddles, "");
|
||||
const introVideoRef = useRef<HTMLVideoElement | null>(null);
|
||||
const [ granted, setGranted ] = useState(false);
|
||||
|
||||
@@ -38,6 +39,7 @@ export default function Intro() {
|
||||
setBoughtHints("");
|
||||
setPlayers("");
|
||||
setWorthyWords("");
|
||||
setReachedRiddles("");
|
||||
setVoiceOverState("on");
|
||||
setStep("2");
|
||||
};
|
||||
|
||||
@@ -94,10 +94,6 @@ export default function Tour() {
|
||||
const [ voiceOverStr, ] = useLocalStorage(PREF.voice_over, "");
|
||||
const [ reachedRiddlesStr, ] = useLocalStorage(PREF.reached_riddles, "");
|
||||
|
||||
const reachedRiddles = useMemo(() => {
|
||||
return getReachedRiddles();
|
||||
}, [reachedRiddlesStr]);
|
||||
|
||||
const permissionsGranted = gpsStatus === "granted" && cameraStatus === "granted";
|
||||
|
||||
const _dismissFunc = () => {
|
||||
@@ -197,6 +193,7 @@ export default function Tour() {
|
||||
|
||||
const distanceMeters = userLngLat.distanceTo(markerLngLat);
|
||||
const isNearby = distanceMeters <= r.requiredDistance;
|
||||
const reachedRiddles = getReachedRiddles();
|
||||
const reachedAlready = reachedRiddles.includes(r.step);
|
||||
|
||||
if (isNearby || demoMode || reachedAlready) {
|
||||
|
||||
+1
-1
@@ -17,4 +17,4 @@ const isDev = process.env.NODE_ENV === "development";
|
||||
|
||||
export const HTTP_SCHEME = isDev ? "http" : "https";
|
||||
export const WS_SCHEME = isDev ? "ws" : "wss";
|
||||
export const API_PREFIX = isDev ? "192.168.0.110:8080" : "api.excaliburs-erben.de";
|
||||
export const API_PREFIX = isDev ? "localhost:8080" : "api.excaliburs-erben.de";
|
||||
@@ -8,6 +8,7 @@ export function addReachedRiddle(step: number) {
|
||||
riddles.push(step);
|
||||
localStorage.setItem(PREF.reached_riddles, JSON.stringify(riddles));
|
||||
window.dispatchEvent(new Event('storage'));
|
||||
return riddles;
|
||||
}
|
||||
|
||||
export function getReachedRiddles(): number[] {
|
||||
|
||||
Reference in new issue
Block a user