From 2782dd04569c9523a5dd610e7c7bd34a47f50ed0 Mon Sep 17 00:00:00 2001 From: Thomas Chazot Date: Tue, 6 Dec 2022 15:32:16 +0100 Subject: [PATCH] push pour alban --- .../src/Games/CookieClicker/cookieClicker.tsx | 14 +++++++------ bob_party/src/components/TopBar.tsx | 17 +++++++++++++++ bob_party/src/screens/LobbySolo.tsx | 21 ++++++++++--------- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/bob_party/src/Games/CookieClicker/cookieClicker.tsx b/bob_party/src/Games/CookieClicker/cookieClicker.tsx index 38c3c61..d2a0bd1 100644 --- a/bob_party/src/Games/CookieClicker/cookieClicker.tsx +++ b/bob_party/src/Games/CookieClicker/cookieClicker.tsx @@ -10,6 +10,7 @@ import { Alert, } from 'react-native' import { MANAGER_USER } from '../../../App'; +import { useMatchStore } from '../../context/matchContext'; import { useUserStore } from '../../context/userContext'; import { Match } from '../../core/Match/match'; import { User } from '../../core/User/user'; @@ -19,10 +20,13 @@ function CookieClicker(props: { navigation: any}){ const { navigation } = props + const GAMING_TIME=15; const setUser = useUserStore((state) => state.setUser); + const resetMatch = useMatchStore((state) => state.resetMatch); + const [count, setCount] = useState(0); const [money, setMoney] = useState(0); @@ -85,13 +89,11 @@ function CookieClicker(props: { navigation: any}){ let tmp: User | null; tmp=MANAGER_USER.getCurrentUser(); if (tmp!=null){ - /* - if (match.getTabUsers().includes(tmp)){ - match.updatePostMatch(tmp, count); - setUser(tmp); - + if (useMatchStore().match?.getTabUsers().includes(tmp)){ + useMatchStore().match?.updatePostMatch(tmp, count); + setUser(tmp); } - */ + resetMatch(); navigation.goBack(); } } diff --git a/bob_party/src/components/TopBar.tsx b/bob_party/src/components/TopBar.tsx index c80e775..8e8aeb9 100644 --- a/bob_party/src/components/TopBar.tsx +++ b/bob_party/src/components/TopBar.tsx @@ -13,6 +13,7 @@ import { useSelector } from "react-redux" import { RootState } from "../redux/store" import { MANAGER_USER } from "../../App" import { useUserStore } from "../context/userContext" +import { useMatchStore } from "../context/matchContext" /* Images required @@ -32,6 +33,9 @@ FC<{nav: any, state?: string}> = ({nav, state}) => { + const resetMatch = useMatchStore((state) => state.resetMatch); + + /* The display of this component depends of the screen from where it has been called: * From the Settings (icon) : Name of the page + cross button * From other : skin + Title + parameters icon @@ -49,6 +53,19 @@ FC<{nav: any, state?: string}> = ) + + case 'matchmacking': + return ( + + + + + BOB PARTY + { resetMatch(); nav.goBack()}}> + + + + ) default: return ( diff --git a/bob_party/src/screens/LobbySolo.tsx b/bob_party/src/screens/LobbySolo.tsx index ad51edc..24e32f6 100644 --- a/bob_party/src/screens/LobbySolo.tsx +++ b/bob_party/src/screens/LobbySolo.tsx @@ -1,5 +1,5 @@ import { StatusBar } from 'expo-status-bar' -import { View} from 'react-native' +import { View, Image} from 'react-native' import React from 'react'; import stylesScreen from './style/screens.style' import { TopBar } from '../components/TopBar'; @@ -10,9 +10,6 @@ import { MANAGER_MATCH } from '../../App'; import { useMatchStore } from '../context/matchContext'; - -let tabConv:Conversation[]=[]; - function LobbySolo(props: { navigation: any; }) { const { navigation } = props @@ -21,16 +18,20 @@ function LobbySolo(props: { navigation: any; }) { return ( - - navigation.navigate('GameChoice')} + + + navigation.navigate('GameChoice')} + /> + source={{uri: match?.getGame().getImageSource()}} + /> ); }