mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-14 15:07:59 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63aace2b07 | ||
|
|
ba9ca354fc | ||
|
|
e79c728e6a |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "life-trinket",
|
"name": "life-trinket",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.9.5",
|
"version": "0.9.7",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18",
|
"node": ">=18",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Checkbox } from '@mui/material';
|
|||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { twc } from 'react-twc';
|
import { twc } from 'react-twc';
|
||||||
import { theme } from '../../Data/theme';
|
import { theme } from '../../Data/theme';
|
||||||
|
import { useAnalytics } from '../../Hooks/useAnalytics';
|
||||||
import { useGlobalSettings } from '../../Hooks/useGlobalSettings';
|
import { useGlobalSettings } from '../../Hooks/useGlobalSettings';
|
||||||
import { usePlayers } from '../../Hooks/usePlayers';
|
import { usePlayers } from '../../Hooks/usePlayers';
|
||||||
import { useSafeRotate } from '../../Hooks/useSafeRotate';
|
import { useSafeRotate } from '../../Hooks/useSafeRotate';
|
||||||
@@ -17,8 +18,8 @@ import {
|
|||||||
ResetGame,
|
ResetGame,
|
||||||
} from '../../Icons/generated';
|
} from '../../Icons/generated';
|
||||||
import { Player, Rotation } from '../../Types/Player';
|
import { Player, Rotation } from '../../Types/Player';
|
||||||
|
import { PreStartMode } from '../../Types/Settings';
|
||||||
import { RotationDivProps } from '../Buttons/CommanderDamage';
|
import { RotationDivProps } from '../Buttons/CommanderDamage';
|
||||||
import { useAnalytics } from '../../Hooks/useAnalytics';
|
|
||||||
|
|
||||||
const PlayerMenuWrapper = twc.div`
|
const PlayerMenuWrapper = twc.div`
|
||||||
flex
|
flex
|
||||||
@@ -112,6 +113,7 @@ const PlayerMenu = ({
|
|||||||
setRandomizingPlayer,
|
setRandomizingPlayer,
|
||||||
saveCurrentGame,
|
saveCurrentGame,
|
||||||
initialGameSettings,
|
initialGameSettings,
|
||||||
|
setPreStartCompleted,
|
||||||
} = useGlobalSettings();
|
} = useGlobalSettings();
|
||||||
|
|
||||||
const analytics = useAnalytics();
|
const analytics = useAnalytics();
|
||||||
@@ -133,8 +135,14 @@ const PlayerMenu = ({
|
|||||||
const handleResetGame = () => {
|
const handleResetGame = () => {
|
||||||
resetCurrentGame();
|
resetCurrentGame();
|
||||||
setShowPlayerMenu(false);
|
setShowPlayerMenu(false);
|
||||||
|
|
||||||
setPlaying(false);
|
setPlaying(false);
|
||||||
|
|
||||||
|
if (settings.preStartMode === PreStartMode.RandomKing) {
|
||||||
setRandomizingPlayer(true);
|
setRandomizingPlayer(true);
|
||||||
|
setPreStartCompleted(false);
|
||||||
|
}
|
||||||
|
|
||||||
analytics.trackEvent('reset_game');
|
analytics.trackEvent('reset_game');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ const getOrientation = () => {
|
|||||||
: 'landscape';
|
: 'landscape';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ANIMATION_INTRO_LENGTH = 500;
|
||||||
|
|
||||||
|
const BEFORE_INTRO_TIMER_LENGTH = 100;
|
||||||
|
|
||||||
export const FingerGame = () => {
|
export const FingerGame = () => {
|
||||||
const { players } = usePlayers();
|
const { players } = usePlayers();
|
||||||
|
|
||||||
@@ -34,7 +38,7 @@ export const FingerGame = () => {
|
|||||||
aboutToStartTimerRef.current = setTimeout(() => {
|
aboutToStartTimerRef.current = setTimeout(() => {
|
||||||
setSelectedTouchPoint(undefined);
|
setSelectedTouchPoint(undefined);
|
||||||
setPlaying(true);
|
setPlaying(true);
|
||||||
}, 500);
|
}, ANIMATION_INTRO_LENGTH);
|
||||||
|
|
||||||
setTimerStarted(true);
|
setTimerStarted(true);
|
||||||
return;
|
return;
|
||||||
@@ -46,7 +50,7 @@ export const FingerGame = () => {
|
|||||||
const randomIndex = Math.floor(Math.random() * touchPoints.length);
|
const randomIndex = Math.floor(Math.random() * touchPoints.length);
|
||||||
const randomTouchPoint = touchPoints[randomIndex];
|
const randomTouchPoint = touchPoints[randomIndex];
|
||||||
setSelectedTouchPoint(randomTouchPoint);
|
setSelectedTouchPoint(randomTouchPoint);
|
||||||
}, 250);
|
}, BEFORE_INTRO_TIMER_LENGTH);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +103,7 @@ export const FingerGame = () => {
|
|||||||
aboutToStartTimerRef.current = setTimeout(() => {
|
aboutToStartTimerRef.current = setTimeout(() => {
|
||||||
setSelectedTouchPoint(undefined);
|
setSelectedTouchPoint(undefined);
|
||||||
setPlaying(true);
|
setPlaying(true);
|
||||||
}, 500);
|
}, ANIMATION_INTRO_LENGTH);
|
||||||
setTimerStarted(true);
|
setTimerStarted(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -180,7 +184,7 @@ export const FingerGame = () => {
|
|||||||
key={`touch-point-${index}`}
|
key={`touch-point-${index}`}
|
||||||
data-is-selected={selectedTouchPoint?.id === point.id}
|
data-is-selected={selectedTouchPoint?.id === point.id}
|
||||||
data-unloading={timerStarted}
|
data-unloading={timerStarted}
|
||||||
className="absolute rounded-full translate-x-[-50%] translate-y-[-50%] transition-all duration-1000
|
className="absolute rounded-full translate-x-[-50%] translate-y-[-50%] transition-all duration-500
|
||||||
h-[75px] w-[75px]
|
h-[75px] w-[75px]
|
||||||
data-[unloading=false]:data-[is-selected=true]:h-[250px] data-[unloading=false]:data-[is-selected=true]:w-[250px]
|
data-[unloading=false]:data-[is-selected=true]:h-[250px] data-[unloading=false]:data-[is-selected=true]:w-[250px]
|
||||||
data-[unloading=true]:h-[0px] data-[unloading=true]:w-[0px] data-[unloading=true]:duration-[400ms]
|
data-[unloading=true]:h-[0px] data-[unloading=true]:w-[0px] data-[unloading=true]:duration-[400ms]
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ const questions = [
|
|||||||
'Who has the most piercings?',
|
'Who has the most piercings?',
|
||||||
'Who has the most expensive shoes?',
|
'Who has the most expensive shoes?',
|
||||||
'Who has the most most amount of teeth?',
|
'Who has the most most amount of teeth?',
|
||||||
'Who has the most least amount of teeth?',
|
'Who has the least amount of teeth?',
|
||||||
'Who has the most least amount of teeth?',
|
|
||||||
'Who lives closest to the equator?',
|
'Who lives closest to the equator?',
|
||||||
'Who is the tallest person in the group?',
|
'Who is the tallest person in the group?',
|
||||||
'Who is the shortest person in the group?',
|
'Who is the shortest person in the group?',
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ export const Play = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
players.length > 1 &&
|
||||||
!preStartCompleted &&
|
!preStartCompleted &&
|
||||||
settings.preStartMode !== PreStartMode.None &&
|
settings.preStartMode !== PreStartMode.None &&
|
||||||
!playing &&
|
!playing &&
|
||||||
|
|||||||
Reference in New Issue
Block a user