fix slot machine apparition
Browse files- client/src/pages/Game.jsx +26 -23
client/src/pages/Game.jsx
CHANGED
|
@@ -81,6 +81,7 @@ function GameContent() {
|
|
| 81 |
const { isSoundEnabled, setIsSoundEnabled, playSound } = useSoundSystem();
|
| 82 |
const [loadingMessage, setLoadingMessage] = useState(0);
|
| 83 |
const [isDebugVisible, setIsDebugVisible] = useState(false);
|
|
|
|
| 84 |
|
| 85 |
const {
|
| 86 |
sessionId,
|
|
@@ -241,11 +242,7 @@ function GameContent() {
|
|
| 241 |
segments[0].images.length > 0;
|
| 242 |
|
| 243 |
if (isGameReady) {
|
| 244 |
-
|
| 245 |
-
const timer = setTimeout(() => {
|
| 246 |
-
setIsTransitionLoading(false);
|
| 247 |
-
}, 1000);
|
| 248 |
-
return () => clearTimeout(timer);
|
| 249 |
}
|
| 250 |
}
|
| 251 |
}, [isTransitionLoading, segments]);
|
|
@@ -364,24 +361,6 @@ function GameContent() {
|
|
| 364 |
);
|
| 365 |
}
|
| 366 |
|
| 367 |
-
// Slot machine : dès que l'univers est disponible
|
| 368 |
-
if (gameUniverse && slotMachineState.style && isInitialLoading) {
|
| 369 |
-
return (
|
| 370 |
-
<Box sx={{ width: "100%", height: "100vh" }}>
|
| 371 |
-
<UniverseSlotMachine
|
| 372 |
-
style={slotMachineState.style}
|
| 373 |
-
genre={slotMachineState.genre}
|
| 374 |
-
epoch={slotMachineState.epoch}
|
| 375 |
-
activeIndex={slotMachineState.activeIndex}
|
| 376 |
-
onComplete={() => {
|
| 377 |
-
setIsInitialLoading(false);
|
| 378 |
-
setIsTransitionLoading(true);
|
| 379 |
-
}}
|
| 380 |
-
/>
|
| 381 |
-
</Box>
|
| 382 |
-
);
|
| 383 |
-
}
|
| 384 |
-
|
| 385 |
// Loading final : après la slot machine jusqu'à ce que le jeu soit prêt
|
| 386 |
if (
|
| 387 |
isTransitionLoading ||
|
|
@@ -413,6 +392,30 @@ function GameContent() {
|
|
| 413 |
);
|
| 414 |
}
|
| 415 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
return (
|
| 417 |
<motion.div
|
| 418 |
initial={{ opacity: 0 }}
|
|
|
|
| 81 |
const { isSoundEnabled, setIsSoundEnabled, playSound } = useSoundSystem();
|
| 82 |
const [loadingMessage, setLoadingMessage] = useState(0);
|
| 83 |
const [isDebugVisible, setIsDebugVisible] = useState(false);
|
| 84 |
+
const [isSlotMachineVisible, setIsSlotMachineVisible] = useState(true);
|
| 85 |
|
| 86 |
const {
|
| 87 |
sessionId,
|
|
|
|
| 242 |
segments[0].images.length > 0;
|
| 243 |
|
| 244 |
if (isGameReady) {
|
| 245 |
+
setIsTransitionLoading(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
}
|
| 247 |
}
|
| 248 |
}, [isTransitionLoading, segments]);
|
|
|
|
| 361 |
);
|
| 362 |
}
|
| 363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 364 |
// Loading final : après la slot machine jusqu'à ce que le jeu soit prêt
|
| 365 |
if (
|
| 366 |
isTransitionLoading ||
|
|
|
|
| 392 |
);
|
| 393 |
}
|
| 394 |
|
| 395 |
+
// Slot machine : dès que l'univers est disponible
|
| 396 |
+
if (
|
| 397 |
+
gameUniverse &&
|
| 398 |
+
slotMachineState.style &&
|
| 399 |
+
isInitialLoading &&
|
| 400 |
+
isSlotMachineVisible
|
| 401 |
+
) {
|
| 402 |
+
return (
|
| 403 |
+
<Box sx={{ width: "100%", height: "100vh" }}>
|
| 404 |
+
<UniverseSlotMachine
|
| 405 |
+
style={slotMachineState.style}
|
| 406 |
+
genre={slotMachineState.genre}
|
| 407 |
+
epoch={slotMachineState.epoch}
|
| 408 |
+
activeIndex={slotMachineState.activeIndex}
|
| 409 |
+
onComplete={() => {
|
| 410 |
+
setIsInitialLoading(false);
|
| 411 |
+
setIsSlotMachineVisible(false);
|
| 412 |
+
setIsTransitionLoading(true);
|
| 413 |
+
}}
|
| 414 |
+
/>
|
| 415 |
+
</Box>
|
| 416 |
+
);
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
return (
|
| 420 |
<motion.div
|
| 421 |
initial={{ opacity: 0 }}
|