mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 10:20:16 +01:00
Ajout zones en pavage + fix dockefiles
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
"use client";
|
||||
import { useLocation } from "@/hook/useLocation";
|
||||
import { useSocketListener } from "@/hook/useSocketListener";
|
||||
import { createContext, use, useContext, useEffect, useMemo, useRef, useState } from "react";
|
||||
import useLocation from "@/hook/useLocation";
|
||||
import useSocketListener from "@/hook/useSocketListener";
|
||||
import { createContext, useContext, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useSocket } from "./socketContext";
|
||||
import { useTeamConnexion } from "./teamConnexionContext";
|
||||
import { GameState } from "@/util/gameState";
|
||||
|
||||
const teamContext = createContext();
|
||||
|
||||
const teamContext = createContext()
|
||||
function TeamProvider({children}) {
|
||||
export function TeamProvider({children}) {
|
||||
const [teamInfos, setTeamInfos] = useState({});
|
||||
const [gameState, setGameState] = useState(GameState.SETUP);
|
||||
const [gameSettings, setGameSettings] = useState(null);
|
||||
@@ -21,17 +21,12 @@ function TeamProvider({children}) {
|
||||
|
||||
teamInfosRef.current = teamInfos;
|
||||
|
||||
useSocketListener(teamSocket, "update_team", (newTeamInfos) => {
|
||||
setTeamInfos({...teamInfosRef.current, ...newTeamInfos});
|
||||
});
|
||||
|
||||
useSocketListener(teamSocket, "update_team", (newTeamInfos) => setTeamInfos({...teamInfosRef.current, ...newTeamInfos}) );
|
||||
useSocketListener(teamSocket, "game_state", setGameState);
|
||||
useSocketListener(teamSocket, "zone", setZone);
|
||||
useSocketListener(teamSocket, "new_zone", setZoneExtremities);
|
||||
useSocketListener(teamSocket, "game_settings", setGameSettings);
|
||||
|
||||
|
||||
|
||||
//Send the current position to the server when the user is logged in
|
||||
useEffect(() => {
|
||||
console.log("sending position", measuredLocation);
|
||||
@@ -48,8 +43,6 @@ function TeamProvider({children}) {
|
||||
);
|
||||
}
|
||||
|
||||
function useTeamContext() {
|
||||
export function useTeamContext() {
|
||||
return useContext(teamContext);
|
||||
}
|
||||
|
||||
export { TeamProvider, useTeamContext };
|
||||
Reference in New Issue
Block a user