Modifications on the GameList component

peristanceBDD
Alban GUILHOT 2 years ago
parent 4895af2547
commit 8cf6e36928

@ -9,6 +9,7 @@ import { Game } from "../core/game"
import { useGameStore } from "../context/gameContext" import { useGameStore } from "../context/gameContext"
import { GameComponent } from "./GameComponent" import { GameComponent } from "./GameComponent"
import ManagerGame from "../services/gameService/managerGame" import ManagerGame from "../services/gameService/managerGame"
import { MANAGER_GAME, MANAGER_USER } from "../../appManagers"
export const GameList : export const GameList :
@ -19,13 +20,14 @@ FC<{nav: any}> =
let gameList : Game[] | undefined; let gameList : Game[] | undefined;
if(currentGameType === "solo" ){ if(MANAGER_GAME.currentGameType === "solo" ){
console.log("sole"); console.log("solo");
gameList = useGameStore((state) => state.tabGameSolo); gameList = MANAGER_GAME.getTabGameSolo();
console.log(gameList);
} }
else if(currentGameType === "multi"){ else if(MANAGER_GAME.currentGameType === "multi"){
console.log("multi"); console.log("multi");
gameList = useGameStore((state) => state.tabGameMulti); gameList = MANAGER_GAME.getTabGameMulti();
} }
else{ else{
console.log("crotte"); console.log("crotte");

@ -11,6 +11,7 @@ import { MANAGER_CONVERSATION, MANAGER_GAME, MANAGER_USER } from '../../appManag
import { socket } from '../../socketConfig'; import { socket } from '../../socketConfig';
import { useConversationStore } from '../context/conversationContext'; import { useConversationStore } from '../context/conversationContext';
import { Message } from '../core/message'; import { Message } from '../core/message';
import ManagerUser from '../services/userServices/managerUser';
@ -23,8 +24,6 @@ function Home(props: { navigation: any; }) {
//It has to be in the home page that way the database will reload the conversations when the user receive a message een if he is in another page //It has to be in the home page that way the database will reload the conversations when the user receive a message een if he is in another page
@ -38,11 +37,11 @@ function Home(props: { navigation: any; }) {
<View style={stylesScreen.bodyCenter}> <View style={stylesScreen.bodyCenter}>
<ButtonGameTypeChoice <ButtonGameTypeChoice
title='Jouer Seul' title='Jouer Seul'
onPress={() => { navigation.navigate('GameChoiceTab') }} onPress={() => { MANAGER_GAME.currentGameType="solo";navigation.navigate('GameChoiceTab') }}
/> />
<ButtonGameTypeChoice <ButtonGameTypeChoice
title='Défier mes amis' title='Défier mes amis'
onPress={() => navigation.navigate('GameChoiceTab')} onPress={() => { MANAGER_GAME.currentGameType="multi" ; navigation.navigate('GameChoiceTab')}}
/> />
</View> </View>
<BotBar <BotBar

Loading…
Cancel
Save