@ -1,19 +0,0 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.6888e917.css",
|
||||
"main.js": "/static/js/main.b6842da5.js",
|
||||
"static/js/787.a1c84483.chunk.js": "/static/js/787.a1c84483.chunk.js",
|
||||
"static/media/Person.png": "/static/media/Person.f7ba6be9e4afca5ca897.png",
|
||||
"static/media/bot.png": "/static/media/bot.057c187a23ead0769e7f.png",
|
||||
"static/media/eye.png": "/static/media/eye.cd074d043a80f09623ac.png",
|
||||
"static/media/reset.png": "/static/media/reset.82632189f4cbd1644b7a.png",
|
||||
"index.html": "/index.html",
|
||||
"main.6888e917.css.map": "/static/css/main.6888e917.css.map",
|
||||
"main.b6842da5.js.map": "/static/js/main.b6842da5.js.map",
|
||||
"787.a1c84483.chunk.js.map": "/static/js/787.a1c84483.chunk.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.6888e917.css",
|
||||
"static/js/main.b6842da5.js"
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 3.8 KiB |
@ -1 +0,0 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.b6842da5.js"></script><link href="/static/css/main.6888e917.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 9.4 KiB |
@ -1,25 +0,0 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
@ -1,2 +0,0 @@
|
||||
"use strict";(self.webpackChunkcryptide=self.webpackChunkcryptide||[]).push([[787],{787:(e,t,n)=>{n.r(t),n.d(t,{getCLS:()=>y,getFCP:()=>g,getFID:()=>C,getLCP:()=>P,getTTFB:()=>D});var i,r,a,o,u=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if("first-input"===e&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},f=function(e,t){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},s=function(e){addEventListener("pageshow",(function(t){t.persisted&&e(t)}),!0)},m=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},v=-1,p=function(){return"hidden"===document.visibilityState?0:1/0},d=function(){f((function(e){var t=e.timeStamp;v=t}),!0)},l=function(){return v<0&&(v=p(),d(),s((function(){setTimeout((function(){v=p(),d()}),0)}))),{get firstHiddenTime(){return v}}},g=function(e,t){var n,i=l(),r=u("FCP"),a=function(e){"first-contentful-paint"===e.name&&(f&&f.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=e.startTime,r.entries.push(e),n(!0)))},o=window.performance&&performance.getEntriesByName&&performance.getEntriesByName("first-contentful-paint")[0],f=o?null:c("paint",a);(o||f)&&(n=m(e,r,t),o&&a(o),s((function(i){r=u("FCP"),n=m(e,r,t),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,n(!0)}))}))})))},h=!1,T=-1,y=function(e,t){h||(g((function(e){T=e.value})),h=!0);var n,i=function(t){T>-1&&e(t)},r=u("CLS",0),a=0,o=[],v=function(e){if(!e.hadRecentInput){var t=o[0],i=o[o.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(a+=e.value,o.push(e)):(a=e.value,o=[e]),a>r.value&&(r.value=a,r.entries=o,n())}},p=c("layout-shift",v);p&&(n=m(i,r,t),f((function(){p.takeRecords().map(v),n(!0)})),s((function(){a=0,T=-1,r=u("CLS",0),n=m(i,r,t)})))},E={passive:!0,capture:!0},w=new Date,L=function(e,t){i||(i=t,r=e,a=new Date,F(removeEventListener),S())},S=function(){if(r>=0&&r<a-w){var e={entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+r};o.forEach((function(t){t(e)})),o=[]}},b=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){L(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,E),removeEventListener("pointercancel",i,E)};addEventListener("pointerup",n,E),addEventListener("pointercancel",i,E)}(t,e):L(t,e)}},F=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,b,E)}))},C=function(e,t){var n,a=l(),v=u("FID"),p=function(e){e.startTime<a.firstHiddenTime&&(v.value=e.processingStart-e.startTime,v.entries.push(e),n(!0))},d=c("first-input",p);n=m(e,v,t),d&&f((function(){d.takeRecords().map(p),d.disconnect()}),!0),d&&s((function(){var a;v=u("FID"),n=m(e,v,t),o=[],r=-1,i=null,F(addEventListener),a=p,o.push(a),S()}))},k={},P=function(e,t){var n,i=l(),r=u("LCP"),a=function(e){var t=e.startTime;t<i.firstHiddenTime&&(r.value=t,r.entries.push(e),n())},o=c("largest-contentful-paint",a);if(o){n=m(e,r,t);var v=function(){k[r.id]||(o.takeRecords().map(a),o.disconnect(),k[r.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,v,{once:!0,capture:!0})})),f(v,!0),s((function(i){r=u("LCP"),n=m(e,r,t),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,k[r.id]=!0,n(!0)}))}))}))}},D=function(e){var t,n=u("TTFB");t=function(){try{var t=performance.getEntriesByType("navigation")[0]||function(){var e=performance.timing,t={entryType:"navigation",startTime:0};for(var n in e)"navigationStart"!==n&&"toJSON"!==n&&(t[n]=Math.max(e[n]-e.navigationStart,0));return t}();if(n.value=n.delta=t.responseStart,n.value<0||n.value>performance.now())return;n.entries=[t],e(n)}catch(e){}},"complete"===document.readyState?setTimeout(t,0):addEventListener("load",(function(){return setTimeout(t,0)}))}}}]);
|
||||
//# sourceMappingURL=787.a1c84483.chunk.js.map
|
@ -1,123 +0,0 @@
|
||||
/*!
|
||||
Copyright (c) 2018 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
||||
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
||||
<http://stuartk.com/jszip>
|
||||
|
||||
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
||||
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
||||
|
||||
JSZip uses the library pako released under the MIT license :
|
||||
https://github.com/nodeca/pako/blob/main/LICENSE
|
||||
*/
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/*! Hammer.JS - v2.0.17-rc - 2019-12-16
|
||||
* http://naver.github.io/egjs
|
||||
*
|
||||
* Forked By Naver egjs
|
||||
* Copyright (c) hammerjs
|
||||
* Licensed under the MIT license */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @remix-run/router v1.11.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* React Router DOM v6.18.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* React Router v6.18.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
//! Il faudra possiblement faire une gestion des mode de jeu, pour modifier les regles en fonction de ce dernier.
|
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 11 KiB |
@ -0,0 +1,209 @@
|
||||
const path = require('path');
|
||||
const DatabaseService = require(path.resolve(__dirname, '../services/DatabaseService'));
|
||||
|
||||
const ENIGME_FACILE = "enigme_facile";
|
||||
const ENIGME_MOYEN = "enigme_moyenne";
|
||||
const ENIGME_DIFFICILE = "enigme_difficile";
|
||||
|
||||
class SessionController {
|
||||
// ---------------------------------------------------
|
||||
// ----------------- GET DAILY STATS -----------------
|
||||
// ---------------------------------------------------
|
||||
|
||||
static async getDailyMastermind(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const dailyMastermindStats = await db.getDailyMastermindStats();
|
||||
|
||||
res.status(200).json({ tab : dailyMastermindStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyMastermind.' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static async getDailyEasyEnigma(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const dailyEasyEnigmaStats = await db.getDailyEnigmaStats(ENIGME_FACILE);
|
||||
|
||||
res.status(200).json({ tab : dailyEasyEnigmaStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyEasyEnigma.' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static async getDailyMediumEnigma(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const dailyMediumEnigmaStats = await db.getDailyEnigmaStats(ENIGME_MOYEN);
|
||||
|
||||
res.status(200).json({ tab : dailyMediumEnigmaStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyMediumEnigma.' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static async getDailyHardEnigma(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const dailyHardEnigmaStats = await db.getDailyEnigmaStats(ENIGME_DIFFICILE);
|
||||
|
||||
res.status(200).json({ tab : dailyHardEnigmaStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyHardEnigma.' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static async getDailyOnline(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const dailyOnlineStats = await db.getDailyOnlineStats();
|
||||
|
||||
res.status(200).json({ tab : dailyOnlineStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyOnline' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------
|
||||
// ---------------- GET WEEKLY STATS -----------------
|
||||
// ---------------------------------------------------
|
||||
|
||||
static async getWeeklyMastermind(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const weeklyMastermindStats = await db.getWeeklyMastermindStats();
|
||||
|
||||
res.status(200).json({ tab : weeklyMastermindStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyMastermind.' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static async getWeeklyEasyEnigma(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const weeklyEasyEnigmaStats = await db.getWeeklyEnigmaStats(ENIGME_FACILE);
|
||||
|
||||
res.status(200).json({ tab : weeklyEasyEnigmaStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyEasyEnigma.' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static async getWeeklyMediumEnigma(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const weeklyMediumEnigmaStats = await db.getWeeklyEnigmaStats(ENIGME_MOYEN);
|
||||
|
||||
res.status(200).json({ tab : weeklyMediumEnigmaStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyMediumEnigma.' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static async getWeeklyHardEnigma(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const weeklyHardEnigmaStats = await db.getWeeklyEnigmaStats(ENIGME_DIFFICILE);
|
||||
|
||||
res.status(200).json({ tab : weeklyHardEnigmaStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyHardEnigma.' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static async getWeeklyOnline(req, res){
|
||||
const db = new DatabaseService();
|
||||
|
||||
try{
|
||||
await db.connect();
|
||||
|
||||
const weeklyOnlineStats = await db.getWeeklyOnlineStats();
|
||||
|
||||
res.status(200).json({ tab : weeklyOnlineStats });
|
||||
}
|
||||
catch(error){
|
||||
console.error(error);
|
||||
res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyOnline' });
|
||||
}
|
||||
finally{
|
||||
await db.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = SessionController;
|
@ -0,0 +1,15 @@
|
||||
/* Ajoutez ces styles dans votre fichier CSS ou utilisez un préprocesseur comme SCSS */
|
||||
.tabsStats {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.stats {
|
||||
background-color: #f0f0f0;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Personnalisez davantage selon vos préférences */
|
||||
|
@ -0,0 +1,331 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { DataSet, Network} from "vis-network/standalone/esm/vis-network";
|
||||
import GraphCreator from "../model/Graph/GraphCreator";
|
||||
import "./GraphContainer.css";
|
||||
import IndiceTesterFactory from "../model/Factory/IndiceTesterFactory";
|
||||
import Person from "../model/Person";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useGame } from "../Contexts/GameContext";
|
||||
import { socket } from "../SocketConfig"
|
||||
import { colorToEmoji, positionToColor, positionToEmoji } from "../ColorHelper";
|
||||
import { ColorToHexa } from "../model/EnumExtender";
|
||||
import Bot from "../model/Bot";
|
||||
import NodePerson from "../model/Graph/NodePerson";
|
||||
import { useAuth } from "../Contexts/AuthContext";
|
||||
import Indice from "../model/Indices/Indice";
|
||||
import Pair from "../model/Pair";
|
||||
import Player from "../model/Player";
|
||||
import JSONParser from "../JSONParser";
|
||||
import User from "../model/User";
|
||||
import { json } from "body-parser";
|
||||
import html2canvas from 'html2canvas';
|
||||
import jsPDF from 'jspdf';
|
||||
import {basePath} from "../AdressSetup"
|
||||
import PersonNetwork from "../model/PersonsNetwork";
|
||||
|
||||
interface TutorialGraphProps {
|
||||
setNetwork: (network: Network) => void
|
||||
showLast: boolean
|
||||
setPlayerIndex: (playerIndex: number) => void
|
||||
handleShowTurnBar: (bool: boolean) => void
|
||||
handleTurnBarTextChange: (text: string) => void
|
||||
addToHistory: (text: string) => void
|
||||
setPlayerTouched: (playerIndex: number) => void
|
||||
playerTouched: number
|
||||
tutoStep: number
|
||||
setTutoStep: (step: number) => void
|
||||
setGreyForEveryone: (func: () => void) => void
|
||||
displayModalstep: (step: number) => void;
|
||||
}
|
||||
|
||||
let lastNodes: NodePerson[] = []
|
||||
let firstIndex = true
|
||||
let first = true
|
||||
let touchedPlayer = -1
|
||||
let stepTuto = -1
|
||||
|
||||
|
||||
|
||||
|
||||
const TutorialGraph: React.FC<TutorialGraphProps> = ({showLast, setNetwork, setPlayerIndex, handleShowTurnBar, handleTurnBarTextChange, addToHistory, setPlayerTouched, playerTouched, tutoStep, setTutoStep, setGreyForEveryone, displayModalstep}) => {
|
||||
let cptTour: number = 0
|
||||
|
||||
//* Gestion du temps :
|
||||
let initMtn = 0
|
||||
|
||||
const {isLoggedIn, user, manager} = useAuth();
|
||||
const {setIndiceData, setIndicesData, setActualPlayerIndexData, setWinnerData, setPlayersData, setNetworkDataData, setPersonData} = useGame();
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
|
||||
const navigate = useNavigate();
|
||||
const [lastIndex, setLastIndex] = useState(-1)
|
||||
|
||||
if (first){
|
||||
first = false
|
||||
setActualPlayerIndexData(0)
|
||||
handleTurnBarTextChange("C'est à vous de jouer !")
|
||||
handleShowTurnBar(true)
|
||||
}
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
touchedPlayer=playerTouched
|
||||
}, [playerTouched])
|
||||
|
||||
useEffect(() => {
|
||||
stepTuto = tutoStep
|
||||
if(stepTuto===1){
|
||||
handleShowTurnBar(true)
|
||||
}
|
||||
}, [tutoStep])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const tab: NodePerson[] = []
|
||||
for(const n of lastNodes.reverse()){
|
||||
|
||||
}
|
||||
lastNodes = tab
|
||||
if (showLast){
|
||||
socket.emit("opacity activated", socket.id)
|
||||
}
|
||||
else{
|
||||
socket.emit("opacity deactivated", socket.id)
|
||||
}
|
||||
|
||||
}, [showLast])
|
||||
|
||||
let playerIndex: number = 0
|
||||
|
||||
if (firstIndex){
|
||||
firstIndex=false
|
||||
setPlayerIndex(playerIndex)
|
||||
}
|
||||
let index = 0
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
|
||||
let jsonGraph = require("../tuto/graph.json")
|
||||
let jsonIndice = require("../tuto/indices.json")
|
||||
|
||||
const personNetwork = JSONParser.JSONToNetwork(JSON.stringify(jsonGraph))
|
||||
const indices = JSONParser.JSONToIndices(jsonIndice)
|
||||
|
||||
setIndiceData(indices[0])
|
||||
if (personNetwork == null){
|
||||
return
|
||||
}
|
||||
const graph = GraphCreator.CreateGraph(personNetwork)
|
||||
|
||||
const nodes = new DataSet(graph.nodesPerson);
|
||||
|
||||
setIndicesData(indices)
|
||||
setPersonData(personNetwork.getPersons()[4])
|
||||
|
||||
let n = graph.nodesPerson;
|
||||
let e = graph.edges;
|
||||
const graphState = { n, e };
|
||||
|
||||
// Sauvegarder l'état dans localStorage
|
||||
localStorage.setItem('graphState', JSON.stringify(graphState));
|
||||
|
||||
const container = document.getElementById('graph-container');
|
||||
if (!container) {
|
||||
console.error("Container not found");
|
||||
return;
|
||||
}
|
||||
// Charger les données dans le graph
|
||||
|
||||
// Configuration des options du Graphe
|
||||
const initialOptions = {
|
||||
|
||||
layout: {
|
||||
improvedLayout: true,
|
||||
hierarchical: {
|
||||
enabled: false,
|
||||
direction: 'LR', // LR (Left to Right) ou autre selon votre préférence
|
||||
sortMethod: 'hubsize'
|
||||
},
|
||||
randomSeed: 3
|
||||
},
|
||||
physics: {
|
||||
enabled: true,
|
||||
barnesHut: {
|
||||
gravitationalConstant: -1000,
|
||||
springConstant: 0.001,
|
||||
springLength: 100
|
||||
},
|
||||
solver: "repulsion",
|
||||
repulsion: {
|
||||
nodeDistance: 100 // Put more distance between the nodes.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const networkData = { nodes: nodes, edges: graph.edges };
|
||||
const network = new Network(container, networkData, initialOptions);
|
||||
network.stabilize();
|
||||
setNetwork(network)
|
||||
|
||||
const myFunctionInsideEffect = () => {
|
||||
if (stepTuto === 3){
|
||||
const tabGrey = [0, 1, 2, 3, 5, 6, 7, 8, 9]
|
||||
for (const i of tabGrey){
|
||||
nodes.update({id: i, color: "#808080"})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
setGreyForEveryone(() => myFunctionInsideEffect);
|
||||
|
||||
|
||||
network.on("click", async (params) => {
|
||||
|
||||
if(params.nodes.length > 0){
|
||||
}
|
||||
});
|
||||
|
||||
network.on("dragging", (params) => {
|
||||
if (params.nodes.length > 0) {
|
||||
// Un nœud a été cliqué
|
||||
initialOptions.physics.enabled = false;
|
||||
network.setOptions(initialOptions);
|
||||
setNetwork(network)
|
||||
}
|
||||
});
|
||||
|
||||
network.on("click", async (params) => {
|
||||
if(params.nodes.length > 0){
|
||||
if (stepTuto === 0 && touchedPlayer === 1){
|
||||
const node = nodes.get().find((n: NodePerson) => n.id === params.nodes[0])
|
||||
|
||||
if (node === undefined)return;
|
||||
if (node.id === 7){
|
||||
nodes.update({id: node.id, label: node.label + positionToEmoji(1, true)})
|
||||
handleShowTurnBar(false)
|
||||
setPlayerIndex(1)
|
||||
setPlayerTouched(-1)
|
||||
await delay(500)
|
||||
const node2 = nodes.get().find((n: NodePerson) => n.id === params.nodes[0])
|
||||
if (node2 === undefined)return;
|
||||
nodes.update({id: node.id, label: node2.label + positionToEmoji(2, false)})
|
||||
await delay(500)
|
||||
const node3 = nodes.get().find((n: NodePerson) => n.id === 8)
|
||||
if (node3 === undefined)return;
|
||||
nodes.update({id: node3.id, label: node3.label + positionToEmoji(1, false)})
|
||||
setPlayerIndex(2)
|
||||
await delay(500)
|
||||
const node4 = nodes.get().find((n: NodePerson) => n.id === 0)
|
||||
if (node4 === undefined)return;
|
||||
nodes.update({id: node4.id, label: node4.label + positionToEmoji(1, true)})
|
||||
setPlayerIndex(0)
|
||||
setTutoStep(1)
|
||||
|
||||
displayModalstep(1);
|
||||
}
|
||||
}
|
||||
else if(stepTuto === 1 && touchedPlayer === 2){
|
||||
const node = nodes.get().find((n: NodePerson) => n.id === params.nodes[0])
|
||||
if (node === undefined){
|
||||
return;
|
||||
}
|
||||
if (node.id === 0){
|
||||
nodes.update({id: node.id, label: node.label + positionToEmoji(2, false)})
|
||||
setPlayerTouched(-1)
|
||||
displayModalstep(2);
|
||||
handleTurnBarTextChange("Mauvais choix, posez un carré !")
|
||||
const tabGrey = [7, 0, 4, 1, 8]
|
||||
for (const id of tabGrey){
|
||||
const node = nodes.get().find((n: NodePerson) => n.id === id)
|
||||
if (node === undefined)return;
|
||||
nodes.update({id: node.id, color: "#808080"})
|
||||
}
|
||||
setTutoStep(2)
|
||||
}
|
||||
}
|
||||
else if(stepTuto === 2){
|
||||
const node = nodes.get().find((n: NodePerson) => n.id === params.nodes[0])
|
||||
if (node === undefined)return;
|
||||
if (node.id === 9){
|
||||
const tabColor = [7, 0, 4, 1, 8]
|
||||
nodes.update({id: node.id, label: node.label + positionToEmoji(0, false)})
|
||||
for(const id of tabColor){
|
||||
const pers = personNetwork.getPersons().find((p: Person) => p.getId() === id)
|
||||
if (pers !== undefined){
|
||||
nodes.update({id: id, color: ColorToHexa(pers.getColor())})
|
||||
}
|
||||
}
|
||||
handleShowTurnBar(false)
|
||||
setPlayerIndex(1)
|
||||
await delay(500)
|
||||
const node2 = nodes.get().find((n: NodePerson) => n.id === 4)
|
||||
if (node2 === undefined)return;
|
||||
nodes.update({id: node2.id, label: node2.label + positionToEmoji(2, true)})
|
||||
setPlayerIndex(2)
|
||||
await delay(500)
|
||||
const node3 = nodes.get().find((n: NodePerson) => n.id === 3)
|
||||
if (node3 === undefined)return;
|
||||
nodes.update({id: node3.id, label: node3.label + positionToEmoji(0, false)})
|
||||
await delay(500)
|
||||
const node4 = nodes.get().find((n: NodePerson) => n.id === 1)
|
||||
if (node4 === undefined)return;
|
||||
nodes.update({id: node4.id, label: node4.label + positionToEmoji(2, false)})
|
||||
setPlayerIndex(0)
|
||||
handleTurnBarTextChange("A vous de jouer !")
|
||||
handleShowTurnBar(true)
|
||||
setTutoStep(3)
|
||||
displayModalstep(3);
|
||||
}
|
||||
}
|
||||
else if(stepTuto === 3 && touchedPlayer === 3){
|
||||
const node = nodes.get().find((n: NodePerson) => n.id === params.nodes[0])
|
||||
if (node === undefined)return;
|
||||
if (node.id === 4){
|
||||
nodes.update({id: node.id, label: node.label + positionToEmoji(0, true)})
|
||||
setPlayerTouched(-1)
|
||||
await delay(500)
|
||||
const node2 = nodes.get().find((n: NodePerson) => n.id === 4)
|
||||
if (node2 === undefined)return;
|
||||
nodes.update({id: node2.id, label: node2.label + positionToEmoji(1, true)})
|
||||
await delay(500)
|
||||
|
||||
for(const person of personNetwork.getPersons()){
|
||||
nodes.update({id: person.getId(), color: ColorToHexa(person.getColor())})
|
||||
}
|
||||
if (user != null){
|
||||
const winner = user;
|
||||
setNetworkDataData(networkData)
|
||||
setActualPlayerIndexData(-1)
|
||||
setLastIndex(-1)
|
||||
setPlayerTouched(-1)
|
||||
setWinnerData(winner)
|
||||
first = true
|
||||
navigate(`${basePath}/endgame`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
setPlayerTouched(-1)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}, []); // Le tableau vide signifie que cela ne s'exécutera qu'une fois après le premier rendu
|
||||
|
||||
return (
|
||||
<>
|
||||
<div id="graph-container"/>
|
||||
</>
|
||||
);
|
||||
|
||||
function delay(ms: number): Promise<void> {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default TutorialGraph;
|
@ -0,0 +1,755 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import Switch from "react-switch";
|
||||
import {saveAs} from "file-saver"
|
||||
|
||||
/* Style */
|
||||
import "./InGame.css"
|
||||
import {useTheme} from '../Style/ThemeContext'
|
||||
/* Component */
|
||||
import GraphContainer from '../Components/GraphContainer';
|
||||
import PlayerList from '../Components/PlayerList';
|
||||
import TurnBar from '../Components/TurnBar';
|
||||
|
||||
/* Icon */
|
||||
import Param from "../res/icon/param.png";
|
||||
import Info from "../res/icon/infoGreen.png";
|
||||
import Check from "../res/icon/checkboxGreen.png";
|
||||
import MGlass from "../res/icon/magnifying-glass.png";
|
||||
import Reset from "../res/icon/reset.png";
|
||||
import Oeye from "../res/icon/eye.png";
|
||||
import Ceye from "../res/icon/hidden.png";
|
||||
import ImgBot from "../res/img/bot.png";
|
||||
|
||||
import detective from "../res/img/tuto/tuto-detective.jpg";
|
||||
import ava from "../res/img/tuto/tuto-ava2.png";
|
||||
import indicetxt from "../res/img/tuto/tuto-indiceTxt.png"
|
||||
import rep from "../res/img/tuto/tuto-rep.png";
|
||||
import joueurs from "../res/img/tuto/tuto-joueurs.png";
|
||||
import graph from "../res/img/tuto/tuto-graph.png";
|
||||
|
||||
import step1 from "../res/img/tuto/tuto2-1.png";
|
||||
import step2 from "../res/img/tuto/tuto2-2.png";
|
||||
import step3 from "../res/img/tuto/tuto2-3.png";
|
||||
import step4 from "../res/img/tuto/tuto2-4.png";
|
||||
import step5 from "../res/img/tuto/tuto2-5.png";
|
||||
import step6 from "../res/img/tuto/tuto2-6.png";
|
||||
|
||||
/* nav */
|
||||
import { Link, Navigate, useNavigate, useNavigationType } from 'react-router-dom';
|
||||
|
||||
/* Boostrap */
|
||||
import Offcanvas from 'react-bootstrap/Offcanvas';
|
||||
import Modal from 'react-bootstrap/Modal';
|
||||
import Card from 'react-bootstrap/Card';
|
||||
import Button from 'react-bootstrap/Button';
|
||||
|
||||
/* Model */
|
||||
import Stub from '../model/Stub';
|
||||
import { useGame } from '../Contexts/GameContext';
|
||||
import { socket } from '../SocketConfig';
|
||||
import { Network } from 'vis-network';
|
||||
import {generateLatexCode, generateLatexCodeEnigme} from '../Script/LatexScript';
|
||||
import Pair from '../model/Pair';
|
||||
import Indice from '../model/Indices/Indice';
|
||||
import {basePath} from "../AdressSetup"
|
||||
import TutorialGraph from '../Components/TutorialGraph';
|
||||
import { useAuth } from '../Contexts/AuthContext';
|
||||
import EasyBot from '../model/EasyBot';
|
||||
import { set } from 'lodash';
|
||||
|
||||
|
||||
let cptNavigation = 0
|
||||
|
||||
//@ts-ignore
|
||||
const Tutorial = ({locale, changeLocale}) => {
|
||||
const {personNetwork, person, indices, players, setPlayersData, indice, actualPlayerIndex} = useGame()
|
||||
const {user} = useAuth()
|
||||
|
||||
|
||||
const theme = useTheme();
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [greyForEveryone, setGreyForEveryone] = useState<() => void>(() => {});
|
||||
|
||||
const setGreyForEveryoneData = (func: () => void) => {
|
||||
setGreyForEveryone(func)
|
||||
}
|
||||
|
||||
const navigationType = useNavigationType()
|
||||
cptNavigation++
|
||||
if (cptNavigation % 2 == 0){
|
||||
if (navigationType.toString() == "POP"){
|
||||
socket.emit("player quit")
|
||||
navigate(`${basePath}/`)
|
||||
}
|
||||
}
|
||||
|
||||
//* Historique
|
||||
const [history, setHistory] = useState<string[]>([]);
|
||||
const [showLast, setShowLast] = useState(false)
|
||||
const [askedWrong, setAskedWrong] = useState(false)
|
||||
const [importToPdf, setImportToPdf] = useState(false)
|
||||
const [importToJSON, setImportToJSON] = useState(false)
|
||||
const [tutoStep, setTutoStep] = useState(0)
|
||||
|
||||
const setTutoStepData = (step: number) => {
|
||||
setTutoStep(step)
|
||||
}
|
||||
|
||||
const setImportToJSONData = (imp: boolean) => {
|
||||
setImportToJSON(imp)
|
||||
}
|
||||
|
||||
const setImportToPdfData = (imp: boolean) => {
|
||||
setImportToPdf(imp)
|
||||
}
|
||||
|
||||
// Fonction pour ajouter un élément à l'historique
|
||||
const addToHistory = (message: string) => {
|
||||
setHistory(prevHistory => [...prevHistory, message]);
|
||||
};
|
||||
|
||||
const setShowLastData = () =>{
|
||||
setLastVisible(!showLast);
|
||||
setShowLast(!showLast);
|
||||
}
|
||||
|
||||
const setAskedWrongData = (askedWrong: boolean) => {
|
||||
setAskedWrong(askedWrong)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const historyContainer = document.getElementById('history-container');
|
||||
if (historyContainer) {
|
||||
historyContainer.scrollTop = historyContainer.scrollHeight;
|
||||
}
|
||||
}, [history]);
|
||||
|
||||
useEffect(() => {
|
||||
if (user == null){
|
||||
return
|
||||
}
|
||||
setPlayersData([user, new EasyBot("Scooby-Doo", "Scooby-Doo", ImgBot), new EasyBot("Batman", "Batman", ImgBot)])
|
||||
}, [])
|
||||
|
||||
|
||||
|
||||
const [showChoiceBar, setShowChoiceBar] = useState(false);
|
||||
const [showTurnBar, setShowTurnBar] = useState(false);
|
||||
const [turnBarText, setTurnBarText] = useState("");
|
||||
const [playerTouched, setPlayerTouched] = useState(-2)
|
||||
const [playerIndex, setPlayerIndex] = useState(-2)
|
||||
|
||||
|
||||
const [network, setNetwork] = useState<Network | null>(null)
|
||||
const [networkEnigme, setNetworkEnigme] = useState<Map<number, Pair<Indice, boolean>[]> | null>(null)
|
||||
|
||||
const setNetworkData = (network: Network) => {
|
||||
setNetwork(network)
|
||||
}
|
||||
|
||||
const setNetworkEnigmeData = (networkEnigme: Map<number, Pair<Indice, boolean>[]>) => {
|
||||
setNetworkEnigme(networkEnigme)
|
||||
}
|
||||
|
||||
const handleNodeClick = (shouldShowChoiceBar: boolean) => {
|
||||
setShowChoiceBar(shouldShowChoiceBar);
|
||||
};
|
||||
|
||||
const handleSetPlayerTouched = (newPlayerTouched: number) => {
|
||||
setPlayerTouched(newPlayerTouched);
|
||||
};
|
||||
|
||||
|
||||
const handleShowTurnBar = (shouldShowTurnBar: boolean) => {
|
||||
setShowTurnBar(shouldShowTurnBar);
|
||||
};
|
||||
|
||||
const handleTurnBarTextChange = (newTurnBarText: string) =>{
|
||||
setTurnBarText(newTurnBarText)
|
||||
}
|
||||
|
||||
const setPlayerIndexData = (playerIndex: number) => {
|
||||
setPlayerIndex(playerIndex)
|
||||
}
|
||||
|
||||
|
||||
const resetGraph = () => {
|
||||
setisLoading(true);
|
||||
socket.emit("reset graph", socket.id)
|
||||
setTimeout(() => {
|
||||
setisLoading(false);
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
/* 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 ?
|
||||
const [show, setShow] = useState(false);
|
||||
const handleClose = () => setShow(false);
|
||||
const handleShow = () => setShow(true);
|
||||
|
||||
const [showP, setShowP] = useState(false);
|
||||
const handleCloseP = () => setShowP(false);
|
||||
const handleShowP = () => setShowP(true);
|
||||
|
||||
const [showS, setShowS] = useState(false);
|
||||
const handleCloseS = () => setShowS(false);
|
||||
const handleShowS = () => setShowS(true);
|
||||
|
||||
const [cptTour, setcptTour] = useState(0);
|
||||
|
||||
const [LastVisible, setLastVisible] = useState(false);
|
||||
|
||||
const [isLoading, setisLoading] = useState(false);
|
||||
|
||||
|
||||
//@ts-ignore
|
||||
const changecptTour = (newcptTour) => {
|
||||
setcptTour(newcptTour);
|
||||
};
|
||||
|
||||
const handleChange = () => {
|
||||
if (show){
|
||||
handleClose()
|
||||
}
|
||||
else {
|
||||
handleShow()
|
||||
}
|
||||
};
|
||||
|
||||
const handleChangeS = () => {
|
||||
if (showS){
|
||||
handleCloseS()
|
||||
}
|
||||
else {
|
||||
handleShowS()
|
||||
}
|
||||
};
|
||||
|
||||
const eye = LastVisible ? Oeye : Ceye; //icon que l'on affiche pour l'oeil : fermé ou ouvert.
|
||||
|
||||
/* Windows open */
|
||||
//@ts-ignore
|
||||
const openInNewTab = (url) => { //! avec url ==> dangereux
|
||||
window.open(url);
|
||||
};
|
||||
|
||||
const [SwitchEnabled, setSwitchEnabled] = useState(false)
|
||||
const allIndices = Stub.GenerateIndice()
|
||||
|
||||
const nbPlayer = players.length;
|
||||
const navdeduc = 'deduc?actualId=' + actualPlayerIndex + '&nbPlayer=' + nbPlayer;
|
||||
|
||||
|
||||
|
||||
//* gestion demo */
|
||||
const [showM, setShowM] = useState(false);
|
||||
const [showTuto2, setShowTuto2] = useState(false);
|
||||
const [showTuto21, setShowTuto21] = useState(false);
|
||||
const [showTuto22, setShowTuto22] = useState(false);
|
||||
const [showTuto3, setShowTuto3] = useState(false);
|
||||
|
||||
const handleCloseM = () => {
|
||||
setShowM(false);
|
||||
handleShowHelp()
|
||||
}
|
||||
const handleShowM = () => setShowM(true);
|
||||
|
||||
const handleCloseHelp = () => {
|
||||
switch(tutoStep){
|
||||
case 0:
|
||||
setShowTuto2(false);
|
||||
break;
|
||||
case 1:
|
||||
setShowTuto21(false);
|
||||
break;
|
||||
case 2:
|
||||
setShowTuto22(false);
|
||||
break;
|
||||
case 3:
|
||||
setShowTuto3(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const handleShowHelp = () => {
|
||||
switch(tutoStep){
|
||||
case 0:
|
||||
setShowTuto2(true);
|
||||
break;
|
||||
case 1:
|
||||
setShowTuto21(true);
|
||||
break;
|
||||
case 2:
|
||||
setShowTuto22(true);
|
||||
break;
|
||||
case 3:
|
||||
setShowTuto3(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleCloseTuto2 = () => setShowTuto2(false);
|
||||
const handleShowTuto2 = () => setShowTuto2(true);
|
||||
|
||||
const handleCloseTuto21 = () => setShowTuto21(false);
|
||||
const handleShowTuto21 = () => setShowTuto21(true);
|
||||
|
||||
const handleCloseTuto22 = () => setShowTuto22(false);
|
||||
const handleShowTuto22 = () => setShowTuto22(true);
|
||||
|
||||
const handleCloseTuto3 = () => setShowTuto3(false);
|
||||
const handleShowTuto3 = () => setShowTuto3(true);
|
||||
|
||||
|
||||
const [step, setStep] = useState(-1);
|
||||
|
||||
//@ts-ignore
|
||||
const displayModalstep = (step: number) => {
|
||||
//* for step 2
|
||||
setStep(0); // remise a 0 de step
|
||||
switch(step) {
|
||||
case 1:
|
||||
setShowTuto21(true);
|
||||
break;
|
||||
case 2:
|
||||
setShowTuto22(true);
|
||||
break;
|
||||
case 3:
|
||||
setShowTuto3(true);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleShowM();
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div id="mainDiv">
|
||||
{showTurnBar && <TurnBar text={turnBarText}/>}
|
||||
<div id='graphDiv'>
|
||||
<TutorialGraph tutoStep={tutoStep}
|
||||
setTutoStep={setTutoStepData}
|
||||
handleShowTurnBar={handleShowTurnBar}
|
||||
handleTurnBarTextChange={handleTurnBarTextChange}
|
||||
addToHistory={addToHistory}
|
||||
setPlayerTouched={handleSetPlayerTouched}
|
||||
playerTouched={playerTouched}
|
||||
setNetwork={setNetworkData}
|
||||
showLast={showLast}
|
||||
setPlayerIndex={setPlayerIndexData}
|
||||
setGreyForEveryone={setGreyForEveryoneData}
|
||||
displayModalstep={displayModalstep}/>
|
||||
</div>
|
||||
|
||||
<div className='historique' id="history-container">
|
||||
{history.map((item, index) => (
|
||||
<div key={index}>{item}</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
|
||||
<div className='menuGame'>
|
||||
{/* <Button variant="primary" onClick={handleShowM}>
|
||||
tuto 1
|
||||
</Button>
|
||||
<Button variant="primary" onClick={handleShowTuto2} disabled={tuto1disable}>
|
||||
tuto 2
|
||||
</Button> */}
|
||||
|
||||
<Button variant="primary" onClick={handleShowHelp}>
|
||||
Aide
|
||||
</Button>
|
||||
<Link to={`${basePath}/info`} target='_blank'>
|
||||
<button className='button'
|
||||
style={{
|
||||
backgroundColor: theme.colors.tertiary,
|
||||
borderColor: theme.colors.secondary
|
||||
}}>
|
||||
<img src={Info} alt="info" height="40"/>
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
<button className='button' onClick={handleChange}
|
||||
style={{
|
||||
backgroundColor: theme.colors.tertiary,
|
||||
borderColor: theme.colors.secondary
|
||||
}}>
|
||||
<img src={MGlass} alt="indice" height="40"/>
|
||||
</button>
|
||||
|
||||
<button className='button' onClick={setShowLastData}
|
||||
style={{
|
||||
backgroundColor: theme.colors.tertiary,
|
||||
borderColor: theme.colors.secondary
|
||||
}}>
|
||||
<img src={ eye } alt="indice" height="40"/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div className='playerlistDiv'>
|
||||
<PlayerList players={players} setPlayerTouched={handleSetPlayerTouched} playerTouched={playerTouched} playerIndex={playerIndex} askedWrong={askedWrong} greyForEveryone={greyForEveryone}/>
|
||||
</div>
|
||||
|
||||
|
||||
<Offcanvas show={show}
|
||||
onHide={handleClose}
|
||||
placement='end'
|
||||
scroll={true}
|
||||
backdrop={false}
|
||||
style={{ height: '20%', width: '25%', top: '60vh' }}>
|
||||
<Offcanvas.Header closeButton>
|
||||
<Offcanvas.Title>Indice</Offcanvas.Title>
|
||||
</Offcanvas.Header>
|
||||
<Offcanvas.Body>
|
||||
{indice?.ToString(locale)}
|
||||
</Offcanvas.Body>
|
||||
</Offcanvas>
|
||||
|
||||
|
||||
|
||||
<Modal
|
||||
show={showM}
|
||||
onHide={handleCloseM}
|
||||
backdrop="static"
|
||||
keyboard={false}
|
||||
size="lg"
|
||||
style={{ maxHeight: '100vh'}}>
|
||||
<Modal.Header>
|
||||
<Modal.Title>Tutoriel</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body style={{ display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
|
||||
{step === -1 && (
|
||||
<Card style={{ width: '90%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={detective} style={{width:'300px', height:'300px'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title> Bienvenue dans SocialGraph</Card.Title>
|
||||
<Card.Text>
|
||||
Vous incarnez un détective assoiffé de gloire, confronté à un crime. <br/>
|
||||
Cependant, d'autres enquêteurs sont également sur le coup, tous cherchant à décrocher le titre de meilleur détective du monde. <br/>
|
||||
Chacun possède un indice crucial pour identifier le coupable, il va falloir déduire l'indice de vos concurrents si vous souhaitez l'emporter ! <br/>
|
||||
Interrogez vos concurrents pour obtenir des réponses par oui ou non, mais méfiez-vous, un refus a des conséquences. <br/>
|
||||
Soyez le premier à déduire les indices des autres et à trouver le coupable pour remporter la reconnaissance tant convoitée. <br />
|
||||
<i>Si vous avez le moindre doute, cliquer sur le bouton "aide" pour afficher l'étape actuel du tuto</i>
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
{step === 0 && (
|
||||
<Card style={{ width: '90%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={ava} style={{width:'300px', height:'300px'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Les Suspects</Card.Title>
|
||||
<Card.Text>
|
||||
Voici comment est représenté un suspect, chaque suspect possède différentes caractéristiques, que ce soit leur nom, âge, sport et leur couleur de cheveux.
|
||||
<br />
|
||||
Par exemple, ici, nous avons <b>Ava</b>, qui a <b>40 ans</b>, qui pratique du <b>Basket</b> et du <b>Tennis</b>, qui a les cheveux <b>Roux</b> et qui possède <b>2 amis</b> : Carter et Liam.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{step === 1 && (
|
||||
<Card style={{ width: '90%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={indicetxt} style={{width:'300px', height:'auto'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Les indices</Card.Title>
|
||||
<Card.Text>
|
||||
Dans ce jeu, chaque détective possède un indice, qui permet d'identifier une caractéristique du coupable, votre indice est le suivant :
|
||||
<br />
|
||||
"<u>Le suspect a entre 20 et 29 ans</u>".
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{step === 3 && (
|
||||
<Card style={{ width: '90%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={joueurs} style={{width:'auto', height:'300px'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Les Détectives</Card.Title>
|
||||
<Card.Text>
|
||||
Il est possible de voir les détectives sur le côté gauche de l'écran, ils sont représentés par des cercles de couleurs différentes. Le contour carré signifie que ce détective est en pleine réflexion.
|
||||
<br />
|
||||
Pour interroger un détective à propos d'un suspect, il suffit de le sélectionner, puis de cliquer sur le suspect que vous souhaitez. Il vous répondra donc ce qu'il pense de ce suspect selon son indice.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{step === 4 && (
|
||||
<Card style={{ width: '90%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={rep} style={{width:'300px', height:'300px'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Les réponses</Card.Title>
|
||||
<Card.Text>
|
||||
Les détéctives vous répondrons que par des ronds ou des carrés de leur couleur.
|
||||
<br />
|
||||
<ul>
|
||||
<li>
|
||||
Un <u>carré</u> signifie que son indice innocente le suspect.
|
||||
</li>
|
||||
<li>
|
||||
Un <u>rond</u> signifie que son indice peut incréminer le suspect.
|
||||
</li>
|
||||
</ul>
|
||||
Par exemple, ici :<br />
|
||||
l'indice du détéctive Scooby-Doo (<u>Vert</u>) permet d'innocenter Logan.
|
||||
<br/>Eleanor peut être suspectée par l'indice du détective Batman (<u>Jaune</u>).
|
||||
<br/>Evelyn est innocentée par l'indice de <u>3 détéctive différents</u>.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{step === 5 && (
|
||||
<Card style={{ width: '90%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Header>
|
||||
<button className='button'
|
||||
style={{
|
||||
backgroundColor: theme.colors.tertiary,
|
||||
borderColor: theme.colors.secondary
|
||||
}}>
|
||||
<img src={Info} alt="info" height="40"/>
|
||||
</button>
|
||||
</Card.Header>
|
||||
<Card.Body>
|
||||
<Card.Title>Les règles du jeu</Card.Title>
|
||||
<Card.Text>
|
||||
Ce bouton vous mène à la page d'<b>information du jeu</b>, avec toutes les règles du jeu, que ce soit les objectifs, les indices, le déroulement, etc.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{step === 2 && (
|
||||
<Card style={{ width: '90%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Header>
|
||||
<button className='button'
|
||||
style={{
|
||||
backgroundColor: theme.colors.tertiary,
|
||||
borderColor: theme.colors.secondary
|
||||
}}>
|
||||
<img src={MGlass} alt="info" height="40"/>
|
||||
</button>
|
||||
</Card.Header>
|
||||
<Card.Body>
|
||||
<Card.Title>L'indice</Card.Title>
|
||||
<Card.Text>
|
||||
Ce bouton vous permet d'afficher votre indice personnel, gardez le secret ! Il s'agit de votre meilleur atout pour gagner.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{step === 6 && (
|
||||
<Card style={{ width: '90%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={graph} style={{width:'auto', height:'300px'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Place à la pratique !</Card.Title>
|
||||
<Card.Text>
|
||||
Bien joué ! Vous avez maintenanttoutes les bases d'un veritable détéctive.
|
||||
<br/>
|
||||
Vous allez à présent avoir un exercice pratique pour la résolution d'une enquête, au côté de ces très chère Batman et Scooby-Doo.
|
||||
<br/>
|
||||
Cliquer sur "Poursuivre" pour commencer votre première partie.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
|
||||
|
||||
</Modal.Body>
|
||||
<Modal.Footer style={{display:'flex'}}>
|
||||
<div style={{ width:'100%', display:'flex', justifyContent:'start'}}>
|
||||
<label style={{ color:'gray'}}>Étape {step+1}/7</label>
|
||||
</div>
|
||||
{ step != -1 && (<Button variant="primary" onClick={() => setStep(step - 1)}>Précédent</Button>)}
|
||||
{ step === 6 ? (<Button variant="primary" onClick={handleCloseM}>Poursuivre</Button>) :
|
||||
<Button variant="primary" onClick={() => setStep(step + 1)}>Suivant</Button>}
|
||||
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
show={showTuto2}
|
||||
onHide={handleCloseTuto2}
|
||||
backdrop="static"
|
||||
keyboard={false}
|
||||
size="lg"
|
||||
style={{ maxHeight: '100vh'}}>
|
||||
<Modal.Header>
|
||||
<Modal.Title>Tutoriel</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body style={{ display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
|
||||
<Card style={{ width: '100%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={step1} style={{width:'auto', height:'300px'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Premier pas</Card.Title>
|
||||
<Card.Text>
|
||||
Bienvenue dans cette seconde partie, où nous allons apprendre le déroulé d'une veritable enquête.
|
||||
<br/>
|
||||
Dans un premier temps, sélectionnez le joueur <b>Scooby-Doo</b> et questionnez le à propos du suspect nommé <b>Violet</b> en cliquant sur cette dernière.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
|
||||
</Modal.Body>
|
||||
<Modal.Footer style={{display:'flex'}}>
|
||||
<Button variant="primary" onClick={handleCloseTuto2}>Compris !</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
show={showTuto21}
|
||||
onHide={handleCloseTuto21}
|
||||
backdrop="static"
|
||||
keyboard={false}
|
||||
size="lg"
|
||||
style={{ maxHeight: '100vh'}}>
|
||||
<Modal.Header>
|
||||
<Modal.Title>Tutoriel</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body style={{ display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
{step === 0 && (
|
||||
<Card style={{ width: '100%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={step2} style={{width:'300px', height:'auto'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Votre premier tour</Card.Title>
|
||||
<Card.Text>
|
||||
Super, <u>Violet a été identifié par l'indice de Scooby-Doo</u>, c'est une information essentielle ! Cependant, cela ne signifie <i>pas forcément</i> qu'elle est coupable.
|
||||
<br/>
|
||||
C'est à présent le tour aux autres joueurs de jouer, regardons ce qu'ils ont fait.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{step === 1 && (
|
||||
<Card style={{ width: '100%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={step3} style={{width:'200px', height:'auto'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Premier tour des autres joueurs</Card.Title>
|
||||
<Card.Text>
|
||||
Il semblerait que Scooby-Doo ait lui aussi interrogé Batman à propos de Violet, et que ce dernier ait répondu <b>non</b> par un carré.
|
||||
Cela signifie que Violet n'est pas coupable, et qu'elle est donc innocente !
|
||||
<br/>
|
||||
Scooby-Doo a donc fait une erreur, en questionnant quelqu'un pouvant innocenter Violet. En guise de <b>punition</b>, il doit, lui aussi, poser un carré sur un autre joueur, révélant aussi plus d'information sur son indice.
|
||||
Nous savons donc maintenant que l'indice de Scooby-Doo ne permet pas d'identifier Sebastian.
|
||||
<br/>
|
||||
Ensuite, Batman a questionné Scooby-Doo à propos de Charlotte, qui est identifié par l'indice de Scooby-Doo.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{step === 2 && (
|
||||
<Card style={{ width: '100%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={step4} style={{width:'300px', height:'auto'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>Second tour</Card.Title>
|
||||
<Card.Text>
|
||||
Vous remarquez que <u>votre indice identifie lui aussi Charlotte</u>, et si nous demandions à Batman, si ce dernier pense que Charlotte est la coupable ?
|
||||
<br/>
|
||||
Cela nous permettrait donc de mettre fin à la partie !
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
|
||||
</Modal.Body>
|
||||
<Modal.Footer style={{display:'flex'}}>
|
||||
<div style={{ width:'100%', display:'flex', justifyContent:'start'}}>
|
||||
<label style={{ color:'gray'}}>Étape {step+1}/3</label>
|
||||
</div>
|
||||
{ step != 0 && (<Button variant="primary" onClick={() => setStep(step - 1)}>Précédent</Button>)}
|
||||
{ step === 2 ? (<Button variant="primary" onClick={handleCloseTuto21}>Fermer</Button>) :
|
||||
<Button variant="primary" onClick={() => setStep(step + 1)}>Suivant</Button>}
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
show={showTuto22}
|
||||
onHide={handleCloseTuto22}
|
||||
backdrop="static"
|
||||
keyboard={false}
|
||||
size="lg"
|
||||
style={{ maxHeight: '100vh'}}>
|
||||
<Modal.Header>
|
||||
<Modal.Title>Tutoriel</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body style={{ display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
|
||||
<Card style={{ width: '100%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={step5} style={{width:'300px', height:'auto'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>La punition</Card.Title>
|
||||
<Card.Text>
|
||||
Mince, il semblerait que l'indice de Batman innocente Charlotte, et que vous avez donc commit une erreur, la <b>punition</b> s'applique !
|
||||
<br/>
|
||||
Vous devez donc poser un <u>carré sur un autre joueur</u>, révélant ainsi plus d'information sur votre indice.
|
||||
<br/>
|
||||
Mais rien n'est joué ! Posons notre carré sur <b>Liam</b> pour cela, sélectionnez directement le suspect désiré.
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Modal.Body>
|
||||
<Modal.Footer style={{display:'flex'}}>
|
||||
<Button variant="primary" onClick={handleCloseTuto22}>Compris !</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
show={showTuto3}
|
||||
onHide={handleCloseTuto3}
|
||||
backdrop="static"
|
||||
keyboard={false}
|
||||
size="lg"
|
||||
style={{ maxHeight: '100vh'}}>
|
||||
<Modal.Header>
|
||||
<Modal.Title>End Game</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body style={{ display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card style={{ width: '100%', display:'flex', justifyContent:'center', alignItems:'center', flexDirection:'column'}}>
|
||||
<Card.Img variant="top" src={step6} style={{width:'250px', height:'auto'}}/>
|
||||
<Card.Body>
|
||||
<Card.Title>La fin du jeu</Card.Title>
|
||||
<Card.Text>
|
||||
Ce tour est lui aussi riche en informations !
|
||||
<br/>
|
||||
Vous avez à présent assez d'information pour deviner les indices des autres :
|
||||
<ul>
|
||||
<li>
|
||||
Scooby-Doo semble avoir : <i>{indices[1]?.ToString(locale)}</i>.
|
||||
</li>
|
||||
<li>
|
||||
Batman semble avoir : <i>{indices[2]?.ToString(locale)}</i>.
|
||||
</li>
|
||||
<li>
|
||||
Et votre indice est : <i>{indices[0]?.ToString(locale)}</i>.
|
||||
</li>
|
||||
</ul>
|
||||
Vous avez à présent toutes les cartes en main pour deviner qui est le coupable, cliquer sur le bouton <b>Ask Everyone</b>, puis séléctionné un suspect pour émettre une <b>accusation</b> pour deviner, bonne chance !
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Modal.Body>
|
||||
<Modal.Footer style={{display:'flex'}}>
|
||||
<Button variant="primary" onClick={handleCloseTuto3}>Compris !</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export default Tutorial;
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
"names": [
|
||||
"Sherlock Holmes",
|
||||
"Inspecteur Gadget",
|
||||
"Scooby-Doo",
|
||||
"Marple",
|
||||
"Spocky",
|
||||
"Phoenix",
|
||||
"Batman",
|
||||
"James Bond",
|
||||
"Sherlockio",
|
||||
"Verra",
|
||||
"Hercule Poirot",
|
||||
"Colombo",
|
||||
"MacGyver",
|
||||
"Lupin",
|
||||
"D. Conan",
|
||||
"Pr. Layton",
|
||||
"Dr. Watson"
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 64 KiB |
@ -0,0 +1,244 @@
|
||||
import {ADRESSE_DBSERVER} from '../AdressSetup';
|
||||
|
||||
class ScoreboardService {
|
||||
|
||||
// ------------------------------ GET ------------------------------
|
||||
// ----------------------------- DAILY -----------------------------
|
||||
// ----------------------------- STATS -----------------------------
|
||||
|
||||
static async getDailyMastermindStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyMastermind', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
static async getDailyEasyEnigmaStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyEasyEnigma', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
static async getDailyMediumEnigmaStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyMediumEnigma', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
static async getDailyHardEnigmaStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyHardEnigma', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
static async getDailyOnlineStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyOnline', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------ GET ------------------------------
|
||||
// ----------------------------- WEEKLY ----------------------------
|
||||
// ----------------------------- STATS -----------------------------
|
||||
|
||||
static async getWeeklyMastermindStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyMastermind', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
static async getWeeklyEasyEnigmaStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyEasyEnigma', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
static async getWeeklyMediumEnigmaStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyMediumEnigma', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
static async getWeeklyHardEnigmaStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyHardEnigma', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
static async getWeeklyOnlineStats() {
|
||||
try {
|
||||
const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyOnline', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(errorResponse.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ScoreboardService;
|
@ -0,0 +1 @@
|
||||
{"persons":[{"id":0,"name":"Charlotte","age":25,"color":2,"sports":[4],"friends":[{"id":4,"name":"Sophia","age":20,"color":4,"sports":[1,3]},{"id":3,"name":"Aurora","age":19,"color":0,"sports":[4,2]},{"id":7,"name":"Violet","age":24,"color":2,"sports":[3]},{"id":5,"name":"Alice","age":68,"color":3,"sports":[0]}]},{"id":1,"name":"Carter","age":20,"color":1,"sports":[1,0],"friends":[{"id":4,"name":"Sophia","age":20,"color":4,"sports":[1,3]},{"id":2,"name":"Ava","age":40,"color":3,"sports":[2,3]}]},{"id":2,"name":"Ava","age":40,"color":3,"sports":[2,3],"friends":[{"id":1,"name":"Carter","age":20,"color":1,"sports":[1,0]},{"id":9,"name":"Liam","age":19,"color":4,"sports":[0]}]},{"id":3,"name":"Aurora","age":19,"color":0,"sports":[4,2],"friends":[{"id":4,"name":"Sophia","age":20,"color":4,"sports":[1,3]},{"id":0,"name":"Charlotte","age":25,"color":2,"sports":[4]},{"id":8,"name":"Sebastian","age":13,"color":0,"sports":[1]},{"id":9,"name":"Liam","age":19,"color":4,"sports":[0]},{"id":6,"name":"Benjamin","age":52,"color":1,"sports":[0,2,4]}]},{"id":4,"name":"Sophia","age":20,"color":4,"sports":[1,3],"friends":[{"id":3,"name":"Aurora","age":19,"color":0,"sports":[4,2]},{"id":0,"name":"Charlotte","age":25,"color":2,"sports":[4]},{"id":1,"name":"Carter","age":20,"color":1,"sports":[1,0]}]},{"id":5,"name":"Alice","age":68,"color":3,"sports":[0],"friends":[{"id":0,"name":"Charlotte","age":25,"color":2,"sports":[4]},{"id":6,"name":"Benjamin","age":52,"color":1,"sports":[0,2,4]}]},{"id":6,"name":"Benjamin","age":52,"color":1,"sports":[0,2,4],"friends":[{"id":3,"name":"Aurora","age":19,"color":0,"sports":[4,2]},{"id":5,"name":"Alice","age":68,"color":3,"sports":[0]}]},{"id":7,"name":"Violet","age":24,"color":2,"sports":[3],"friends":[{"id":0,"name":"Charlotte","age":25,"color":2,"sports":[4]}]},{"id":8,"name":"Sebastian","age":13,"color":0,"sports":[1],"friends":[{"id":3,"name":"Aurora","age":19,"color":0,"sports":[4,2]}]},{"id":9,"name":"Liam","age":19,"color":4,"sports":[0],"friends":[{"id":2,"name":"Ava","age":40,"color":3,"sports":[2,3]},{"id":3,"name":"Aurora","age":19,"color":0,"sports":[4,2]}]}]}
|
@ -0,0 +1 @@
|
||||
"[{\"type\":\"AgeIndice\",\"id\":5,\"minimum\":20,\"maximum\":29},{\"type\":\"SportIndice\",\"id\":24,\"sports\":[2,3]},{\"type\":\"ColorEdgesIndice\",\"id\":27,\"neighborsColors\":[0]}]"
|