ajout du bouton pour l'EdJ, et gestion de son interface en conséquence

pull/81/head
Pierre Ferreira 1 year ago
parent 18694b9ab6
commit d4171022ff

@ -23,6 +23,7 @@ interface MyGraphComponentProps {
changecptTour: (newcptTour : number) => void
addToHistory: (message : string) => void
solo : boolean
isDaily : boolean
setNetwork: (network: Network) => void
showLast: boolean
}
@ -42,7 +43,7 @@ let lastNodes: NodePerson[] = []
let firstEnigme = true
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, addToHistory, showLast, setNetwork}) => {
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, isDaily, addToHistory, showLast, setNetwork}) => {
let cptTour: number = 0
const {user} = useAuth()
@ -259,6 +260,7 @@ let cptTour: number = 0
setNetwork(network)
if (isDaily){
dailyEnigme.forEach((pairs, index) => {
pairs.forEach((pair) => {
const i = indices.findIndex((indice) => pair.first.getId() === indice.getId())
@ -273,6 +275,7 @@ let cptTour: number = 0
}
})
});
}
indices.forEach((i, index) => {
console.log(i.ToString("fr") + " => " + positionToEmoji(index, true))

@ -62,6 +62,13 @@ const InGame = ({locale, changeLocale}) => {
IsSolo=false
}
//* Gestion daily
let isDaily: boolean = true
const isDailytmp = params.get('daily');
if (isDailytmp == "false"){
isDaily=false
}
//* Historique
const [history, setHistory] = useState<string[]>([]);
const [showLast, setShowLast] = useState(false)
@ -212,6 +219,7 @@ const InGame = ({locale, changeLocale}) => {
changecptTour={changecptTour}
addToHistory={addToHistory}
solo={IsSolo}
isDaily={isDaily}
setPlayerTouched={handleSetPlayerTouched}
playerTouched={playerTouched}
setNetwork={setNetworkData}
@ -219,7 +227,7 @@ const InGame = ({locale, changeLocale}) => {
</div>
{IsSolo &&
{IsSolo && !isDaily &&
<div className='nbLaps' style={{
backgroundColor: theme.colors.primary,
borderColor: theme.colors.secondary
@ -228,12 +236,13 @@ const InGame = ({locale, changeLocale}) => {
</div>
}
{!isDaily &&
<div className='historique' id="history-container">
{history.map((item, index) => (
<div key={index}>{item}</div>
))}
</div>
}
<div className='paramDiv'>
<button className='button'
@ -289,7 +298,8 @@ const InGame = ({locale, changeLocale}) => {
<img src={Check} alt="check" height="40"/>
</button> */}
{!IsSolo && <Link to='/info' target='_blank'>
{!IsSolo &&
<Link to='/info' target='_blank'>
<button className='button'
style={{
backgroundColor: theme.colors.tertiary,
@ -315,7 +325,9 @@ const InGame = ({locale, changeLocale}) => {
<img src={ eye } alt="indice" height="40"/>
</button>}
{IsSolo && <button className='button' onClick={generateTEX}
{IsSolo &&
<button className='button' onClick={generateTEX}
style={{
backgroundColor: theme.colors.tertiary,
borderColor: theme.colors.secondary

@ -91,6 +91,16 @@ function Play() {
}
function launchMastermind(){
const [networkPerson, choosenPerson, choosenIndices] = GameCreator.CreateGame(3, 30)
setPersonData(choosenPerson)
setPersonNetworkData(networkPerson)
setIndicesData(choosenIndices)
setIndicesData(choosenIndices)
navigate('/game?solo=true&daily=false');
}
function launchEngimeJour(){
const [networkPerson, choosenPerson, choosenIndices] = GameCreator.CreateGame(3, 30)
setPersonData(choosenPerson)
setPersonNetworkData(networkPerson)
@ -101,11 +111,10 @@ function Play() {
const map = EnigmeDuJourCreator.createEnigme(networkPerson, choosenIndices, choosenPerson, Stub.GenerateIndice())
setDailyEnigmeData(map)
}
navigate('/game?solo=true');
navigate('/game?solo=true&daily=true');
}
useEffect(() => {
const handleLobbyCreated = (newRoom: any) => {
setRoom(newRoom);
@ -150,6 +159,7 @@ function Play() {
</div>
<div className='buttonGroupVertical'>
<button onClick={launchMastermind} className="ButtonNav" style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}> Jouer seul </button>
<button onClick={launchEngimeJour} className="ButtonNav" style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}> Jouer seul mais aujourd'hui</button>
<button onClick={createLobby} className="ButtonNav" style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}> Créer une partie </button>
<button className="ButtonNav" style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}> Rejoindre </button>

Loading…
Cancel
Save