feat: Ajustes tecnicos para ruleta y posicion de puntaje
This commit is contained in:
+4
-1
@@ -13,6 +13,7 @@ type Screen = 'intro' | 'cover' | 'game' | 'result'
|
|||||||
interface ResultState {
|
interface ResultState {
|
||||||
aprobado: boolean
|
aprobado: boolean
|
||||||
sinIntentos: boolean
|
sinIntentos: boolean
|
||||||
|
correctas: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
@@ -23,6 +24,7 @@ export default function App() {
|
|||||||
const [resultState, setResultState] = useState<ResultState>({
|
const [resultState, setResultState] = useState<ResultState>({
|
||||||
aprobado: false,
|
aprobado: false,
|
||||||
sinIntentos: intentosAgotados(),
|
sinIntentos: intentosAgotados(),
|
||||||
|
correctas: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
function handleIntroContinue() {
|
function handleIntroContinue() {
|
||||||
@@ -38,7 +40,7 @@ export default function App() {
|
|||||||
setScore(Math.round((correctas / 12) * 100), 100, 0)
|
setScore(Math.round((correctas / 12) * 100), 100, 0)
|
||||||
setLessonStatus(aprobado ? 'passed' : 'failed')
|
setLessonStatus(aprobado ? 'passed' : 'failed')
|
||||||
finishSCORM()
|
finishSCORM()
|
||||||
setResultState({ aprobado, sinIntentos: intentosAgotados() })
|
setResultState({ aprobado, sinIntentos: intentosAgotados(), correctas })
|
||||||
setScreen('result')
|
setScreen('result')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +110,7 @@ export default function App() {
|
|||||||
<Result
|
<Result
|
||||||
aprobado={resultState.aprobado}
|
aprobado={resultState.aprobado}
|
||||||
sinIntentos={resultState.sinIntentos}
|
sinIntentos={resultState.sinIntentos}
|
||||||
|
correctas={resultState.correctas}
|
||||||
onReintentar={handleReintentar}
|
onReintentar={handleReintentar}
|
||||||
/>
|
/>
|
||||||
</ScaleWrapper>
|
</ScaleWrapper>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export default function RuletaSVG({ categorias, rotacion, isSpinning, onClick }:
|
|||||||
<div className="relative flex flex-col items-center justify-center w-full select-none">
|
<div className="relative flex flex-col items-center justify-center w-full select-none">
|
||||||
|
|
||||||
{/* ─── Puntero ─── */}
|
{/* ─── Puntero ─── */}
|
||||||
<div className="absolute top-0 left-1/2 -translate-x-1/2 z-20" style={{ marginTop: '0px' }}>
|
<div className="absolute top-0 left-1/2 -translate-x-1/2 z-20" style={{ marginTop: '20px' }}>
|
||||||
<img
|
<img
|
||||||
src="./img/indicador.png"
|
src="./img/indicador.png"
|
||||||
alt="Indicador"
|
alt="Indicador"
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
interface ResultProps {
|
interface ResultProps {
|
||||||
aprobado: boolean
|
aprobado: boolean
|
||||||
sinIntentos: boolean
|
sinIntentos: boolean
|
||||||
|
correctas: number
|
||||||
onReintentar: () => void
|
onReintentar: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Result(_props: ResultProps) {
|
export default function Result({ correctas }: ResultProps) {
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full h-full">
|
<div className="flex w-full h-full">
|
||||||
{/* ─── Columna izquierda 50% ─── */}
|
{/* ─── Columna izquierda 50% ─── */}
|
||||||
@@ -57,6 +58,25 @@ export default function Result(_props: ResultProps) {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Calificación */}
|
||||||
|
<div
|
||||||
|
className="px-8 py-4 rounded-xl text-center mt-4"
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#ed1f24',
|
||||||
|
width: '90%',
|
||||||
|
alignSelf: 'center',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<p className="text-white font-bold" style={{ fontSize: '28px' }}>
|
||||||
|
Calificación: {Math.round((correctas / 12) * 100)}%
|
||||||
|
</p>
|
||||||
|
<p className="text-white mt-1" style={{ fontSize: '28px', opacity: 0.9 }}>
|
||||||
|
{correctas} de 12 aciertos
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* ─── Columna derecha 50% ─── */}
|
{/* ─── Columna derecha 50% ─── */}
|
||||||
|
|||||||
@@ -49,10 +49,11 @@ function crearPool(): Record<number, Pregunta[]> {
|
|||||||
|
|
||||||
export function useRuleta() {
|
export function useRuleta() {
|
||||||
const poolInicial = useMemo(() => crearPool(), [])
|
const poolInicial = useMemo(() => crearPool(), [])
|
||||||
|
const rotacionInicial = useMemo(() => Math.random() * 360, [])
|
||||||
|
|
||||||
const [estado, setEstado] = useState<EstadoJuego>({
|
const [estado, setEstado] = useState<EstadoJuego>({
|
||||||
isSpinning: false,
|
isSpinning: false,
|
||||||
rotacion: 0,
|
rotacion: rotacionInicial,
|
||||||
preguntaActual: null,
|
preguntaActual: null,
|
||||||
categoriaActual: null,
|
categoriaActual: null,
|
||||||
mostrarFeedback: false,
|
mostrarFeedback: false,
|
||||||
@@ -66,7 +67,7 @@ export function useRuleta() {
|
|||||||
tiempoRestante: TIEMPO_LIMITE,
|
tiempoRestante: TIEMPO_LIMITE,
|
||||||
})
|
})
|
||||||
|
|
||||||
const rotacionRef = useRef(0)
|
const rotacionRef = useRef(rotacionInicial)
|
||||||
const isSpinningRef = useRef(false)
|
const isSpinningRef = useRef(false)
|
||||||
const completadoRef = useRef(false)
|
const completadoRef = useRef(false)
|
||||||
const usadasRef = useRef<Record<number, number>>({})
|
const usadasRef = useRef<Record<number, number>>({})
|
||||||
|
|||||||
Reference in New Issue
Block a user