From cd1aff13db6dce418ac8e5b8a552b933864e9a94 Mon Sep 17 00:00:00 2001 From: Pierre Ferreira Date: Tue, 14 Nov 2023 15:07:58 +0100 Subject: [PATCH] ajout de l'interface pour le mode solo :art: --- cryptide_project/src/App.tsx | 7 +- cryptide_project/src/Components/TurnBar.tsx | 6 +- cryptide_project/src/Pages/Play.tsx | 2 +- cryptide_project/src/Pages/SoloGame.css | 10 +- cryptide_project/src/Pages/SoloGame.tsx | 210 ++++++++++---------- 5 files changed, 126 insertions(+), 109 deletions(-) diff --git a/cryptide_project/src/App.tsx b/cryptide_project/src/App.tsx index e2dafb6..14974c0 100644 --- a/cryptide_project/src/App.tsx +++ b/cryptide_project/src/App.tsx @@ -77,11 +77,10 @@ function App() { } /> } /> } /> - } /> + }/> } /> - } /> - - + }/> + diff --git a/cryptide_project/src/Components/TurnBar.tsx b/cryptide_project/src/Components/TurnBar.tsx index 155bbce..1d90aad 100644 --- a/cryptide_project/src/Components/TurnBar.tsx +++ b/cryptide_project/src/Components/TurnBar.tsx @@ -12,6 +12,6 @@ const TurnBar = () => {

Dummy, à vous de jouer !

); - }; - - export default TurnBar; \ No newline at end of file +}; + +export default TurnBar; \ No newline at end of file diff --git a/cryptide_project/src/Pages/Play.tsx b/cryptide_project/src/Pages/Play.tsx index b6ead60..2eab011 100644 --- a/cryptide_project/src/Pages/Play.tsx +++ b/cryptide_project/src/Pages/Play.tsx @@ -82,7 +82,7 @@ function Play() { - + diff --git a/cryptide_project/src/Pages/SoloGame.css b/cryptide_project/src/Pages/SoloGame.css index 8823002..4f2769b 100644 --- a/cryptide_project/src/Pages/SoloGame.css +++ b/cryptide_project/src/Pages/SoloGame.css @@ -53,11 +53,19 @@ border-radius: 20px 20px 0px 0px; } -.playerlistDiv{ +.nbLaps{ position: absolute; z-index: 1; left: 10px; top :50px; + + margin: 10px 20px; + padding: 20px; + border-radius: 15px; + border: solid 2px; + + font-size: 30px; + color: #fff; } #endgamebutton{ diff --git a/cryptide_project/src/Pages/SoloGame.tsx b/cryptide_project/src/Pages/SoloGame.tsx index d1f8a09..3b2cced 100644 --- a/cryptide_project/src/Pages/SoloGame.tsx +++ b/cryptide_project/src/Pages/SoloGame.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import Switch from "react-switch"; /* Style */ -import "./InGame.css" +import "./SoloGame.css" import {useTheme} from '../Style/ThemeContext' /* Component */ import GraphContainer from '../Components/GraphContainer'; @@ -32,6 +32,8 @@ import { HiLanguage } from 'react-icons/hi2'; import { Nav, NavDropdown } from 'react-bootstrap'; import { FormattedMessage } from 'react-intl'; import Color from '../model/Color'; +import TurnBar from '../Components/TurnBar'; +import { useGame } from '../Contexts/GameContext'; //@ts-ignore const SoloGame = ({locale, changeLocale}) => { @@ -39,11 +41,17 @@ const SoloGame = ({locale, changeLocale}) => { const theme = useTheme(); const [showChoiceBar, setShowChoiceBar] = useState(false); + const [showTurnBar, setShowTurnBar] = useState(false); + const handleNodeClick = (shouldShowChoiceBar: boolean) => { setShowChoiceBar(shouldShowChoiceBar); }; + const handleShowTurnBar = (shouldShowTurnBar: boolean) => { + setShowTurnBar(shouldShowTurnBar); + }; + /* offcanvas */ //? faire une fonction pour close et show en fonction de l'etat du canva ? //? comment faire pour eviter la recopie de tout le code a chaque canvas boostrap ? @@ -61,7 +69,7 @@ const SoloGame = ({locale, changeLocale}) => { const handleChange = () => { if (show){ - handleClose() + handleClose() } else { handleShow() @@ -94,132 +102,134 @@ const SoloGame = ({locale, changeLocale}) => { const [SwitchEnabled, setSwitchEnabled] = useState(false) const indices = Stub.GenerateIndice() + const { indice, players } = useGame(); + return (
-
- {/* texte changeable et a traduire */} -

Dummy, à vous de jouer !

-
+
- + +
+ +
+ Tour : 5
- {/*
- -
*/} - -
- -
+
-
- - - - {/* */} - - - + + {/* - - - -
+ */} - + + + + + + + + {/* + + Joueurs +

Il y a {players.length} joueurs

+
+ + + +
*/} + + - Indice + Indice {/* Possède les cheveux noir ou joue au basket */} - {indices[0].ToString(locale)}
- {indices[1].ToString(locale)}
- {indices[2].ToString(locale)} + {indice?.ToString(locale)}
-
+
- { - //* canva pour les paramètres - } - - - param Paramètres - - - - - - - - - -
- {showChoiceBar && } -
-
{/* tmp */} - -
- -); + + param Paramètres + + + + + + + + +
+ {showChoiceBar && } +
+ {/* +
{/* tmp + +
+ */} + + ); };