Structure de données jeu client

This commit is contained in:
2024-12-11 17:26:36 +01:00
parent d1adba04da
commit 7aa9dde5a9
14 changed files with 238 additions and 28 deletions

12
client/hooks/useGame.ts Normal file
View File

@ -0,0 +1,12 @@
import { useAppDispatch, useAppSelector } from "./useStore"
import { setPlayerId, updateMoney } from "@/utils/features/game/gameSlice"
export const useGame = () => useAppSelector((state) => state.game)
export const useSetPlayerId = () => {
const dispath = useAppDispatch()
return (playerId: number) => dispath(setPlayerId(playerId))
}
export const useUpdateMoney = () => {
const dispatch = useAppDispatch()
return (money: number) => dispatch(updateMoney(money))
}