diff --git a/bob_party/src/components/PlayerBox.tsx b/bob_party/src/components/PlayerBox.tsx
new file mode 100644
index 0000000..7948eca
--- /dev/null
+++ b/bob_party/src/components/PlayerBox.tsx
@@ -0,0 +1,39 @@
+import { FC, ReactNode, useCallback } from "react"
+import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, TextStyle } from "react-native"
+import React from "react"
+import { trace } from "console"
+import { Game } from "../core/game"
+
+/*
+ Importing the correct stylesheet
+*/
+import styles from './style/Game.style';
+import LobbySolo from "../screens/LobbySolo"
+import ManagerMatch from "../services/matchServices/managerMatch"
+import MatchCreator from "../core/Match/matchCreator"
+import { useMatchStore } from "../context/matchContext"
+import { MANAGER_MATCH, MANAGER_USER } from "../../appManagers"
+import { Match } from "../core/Match/match"
+import { User } from "../core/User/user"
+
+export const PlayerBox :
+
+/*
+ * match : match that must be displayed
+ * nav : tool needed to allow the navigation between the screens
+*/
+FC<{user: User}> =
+({user}) =>
+{
+ return (
+
+
+ {user.getUsername()}
+
+ )
+
+
+}
\ No newline at end of file
diff --git a/bob_party/src/core/tests/matchSolo.test.ts b/bob_party/src/core/tests/matchSolo.test.ts
index c2cc7b8..027b58b 100644
--- a/bob_party/src/core/tests/matchSolo.test.ts
+++ b/bob_party/src/core/tests/matchSolo.test.ts
@@ -1,5 +1,4 @@
import MatchSolo from '../Match/matchSolo';
-import { Conversation } from '../Conversation';
import { Skin } from '../Skin';
import { User } from '../User/user';
import { GameSolo } from '../GameSolo';
@@ -21,10 +20,12 @@ let myMap = new Map([
[100, 5],
[150, 6]
]);
-let game=new GameSolo(1, "bo jeu", img, "super jeu", 1, 1, myMap);
-let match = new MatchSolo(1, false, tabU, game);
let tabU2:User[] = [];
+let game=new GameSolo(1, "bo jeu", img, "super jeu", 1, 1, myMap);
let game2 = new GameSolo(2, "jeu magnifique", img, "wow jeu", 1, 1, myMap)
+let match = new MatchSolo(1, false, tabU, game);
+let match2 = new MatchSolo(1, false, tabU2, game2);
+let match3 = new MatchSolo(1, false, tabU, game);
// Get tests
@@ -36,50 +37,47 @@ describe('Match get tests', () => {
expect(match.getInGame()).toBe(false);
})
it('should return tabU [usr] (users)', () => {
- expect(match.getTabUsers()).toBe(tabU);
+ expect(match.getTabUsers()).toEqual(match3.getTabUsers());
})
it('should return game', () => {
- expect(match.getGame).toBe(game);
+ expect(match.getGame()).toEqual(match3.getGame());
})
})
-// Setting new values
-match.setGame(game2);
-match.setInGame(true);
-match.setTabUser(tabU2);
-
-
// Set tests
describe('Match set tests', () => {
it('should return tabU2 [] (users)', () => {
- expect(match.getTabUsers()).toBe(tabU2);
+ match.setTabUser(tabU2);
+ expect(match.getTabUsers()).toEqual(match2.getTabUsers());
})
it('should return true', () => {
+ match.setInGame(true);
expect(match.getInGame()).toBe(true);
})
it('should return game2', () => {
- expect(match.getGame).toBe(game2);
+ match.setGame(game2);
+ expect(match.getGame()).toEqual(match2.getGame());
})
})
// Update Post-Match tests
describe('Update post-match tests', () => {
- it('should return 3', () => {
- match.updatePostMatch(tabU[0],50);
- expect(tabU[0].getCurrentCoins()).toBe(3);
+ it('should return 50', () => {
+ match.updatePostMatch(tabU[0],3);
+ expect(tabU[0].getCurrentCoins()).toBe(50);
})
- it('should return 8', () => {
- match.updatePostMatch(tabU[0],100);
- expect(tabU[0].getCurrentCoins()).toBe(8);
+ it('should return 75', () => {
+ match.updatePostMatch(usr2,4);
+ expect(usr2.getCurrentCoins()).toBe(75);
})
- it('should return 4', () => {
- match.updatePostMatch(usr2,75);
- expect(usr2.getCurrentCoins()).toBe(4);
+ it('should return 150', () => {
+ match.updatePostMatch(tabU[0],5);
+ expect(tabU[0].getCurrentCoins()).toBe(150);
})
- it('should return 10', () => {
- match.updatePostMatch(usr2,150);
- expect(usr2.getCurrentCoins()).toBe(10);
+ it('should return 225', () => {
+ match.updatePostMatch(usr2,6);
+ expect(usr2.getCurrentCoins()).toBe(225);
})
})
\ No newline at end of file
diff --git a/bob_party/src/navigation/AppNavigator.tsx b/bob_party/src/navigation/AppNavigator.tsx
index 142751d..1f727c4 100644
--- a/bob_party/src/navigation/AppNavigator.tsx
+++ b/bob_party/src/navigation/AppNavigator.tsx
@@ -14,6 +14,7 @@ import SignIn from '../screens/SignIn'
import SignUp from '../screens/SignUp'
import LobbySolo from '../screens/LobbySolo'
import CookieClicker from '../Games/CookieClicker/cookieClicker'
+import MatchMaking from '../screens/MatchMaking'
const HomeStack = createStackNavigator();
@@ -93,7 +94,7 @@ const GameSoloStack = createStackNavigator();
function GameSoloStackScreen() {
return (
-
+
);
diff --git a/bob_party/src/screens/MatchMaking.tsx b/bob_party/src/screens/MatchMaking.tsx
new file mode 100644
index 0000000..c425628
--- /dev/null
+++ b/bob_party/src/screens/MatchMaking.tsx
@@ -0,0 +1,47 @@
+import { StatusBar } from 'expo-status-bar'
+import { View, Image, Text, Button} from 'react-native'
+import React from 'react';
+import stylesScreen from './style/screens.style';
+import styles from './style/Settings.style';
+import { TopBar } from '../components/TopBar';
+import { BotBar } from '../components/BotBar';
+import { Conversation } from '../core/conversation';
+import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
+import { useMatchStore } from '../context/matchContext';
+import { FlatList, TextInput } from 'react-native-gesture-handler';
+import { PlayerBox } from '../components/PlayerBox';
+
+
+function MatchMaking(props: { navigation: any; }) {
+
+ const { navigation } = props
+
+ const match = useMatchStore().match;
+
+ return (
+
+
+ usr.getUsername()}
+ renderItem={({item}) => }
+ />
+
+
+
+
+
+ );
+}
+
+export default MatchMaking
\ No newline at end of file
diff --git a/bob_party/src/services/tests/loaderUserApi.test.ts b/bob_party/src/services/tests/loaderUserApi.test.ts
deleted file mode 100644
index 8b82af6..0000000
--- a/bob_party/src/services/tests/loaderUserApi.test.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import LoaderUserApi from '../userServices/loaderUserApi';
-import ILoaderUser from '../userServices/ILoaderUser';
-import { Match } from '../../core/Match/match';
-import MatchSolo from '../../core/Match/matchSolo';
-import { GameSolo } from '../../core/gameSolo';
-import tabUS from '../../constUser';
-import { Conversation } from '../../core/conversation';
-
-// Instances
-const img = "";
-let loader:ILoaderUser = new LoaderUserApi();
-let map = new Map([
- [50, 3],
- [75, 4],
- [100, 5],
- [150, 6]
-]);
-let game:GameSolo = new GameSolo(1, 'SuperJeu', img, 'source', 1, 1, map);
-let match:Match = new MatchSolo(1, false, tabUS, game);
-let convo:Conversation = new Conversation(1, tabUS, [], 'superConvo');
-
-
-// Tests
-describe('LoaderUserApi tests', () => {
- describe('loadById tests', () => {
- it('should return UserTest (id: 48)', () => {
- expect(loader.loadByID(48)).toEqual(tabUS[0]);
- })
- it('should return null', () => {
- expect(loader.loadByID(99999999999)).toBe(null);
- })
- })
- describe('loadByUserName tests', () => {
- it('should return USerTest (name: WeshWesh)', () => {
- expect(loader.loadByUsername('WeshWesh')).toEqual(tabUS[0]);
- })
- it('should return null', () => {
- expect(loader.loadByUsername('jExistePas')).toBe(null);
- })
- })
- describe('loadByUserNamePassword tests', () => {
- it('should return UserTest (name: WeshWesh, password: MdpDeOuf)', () => {
- expect(loader.loadByUsernamePassword('WeshWesh', 'MdpDeOuf')).toEqual(tabUS[0]);
- })
- it('should return null', () => {
- expect(loader.loadByUsernamePassword('jExistePas', 'jExistePas')).toBe(null);
- })
- })
- describe('loadUserByMatch tests', () => {
- it('should return tabUS', () => {
- expect(loader.loadUserByMatch(match)).toEqual(tabUS);
- })
- it('should return null', () => {
- expect(loader.loadByUsernamePassword('jExistePas', 'jExistePas')).toEqual(null);
- })
- })
- describe('loadUserByConversation tests', () => {
- it('should return tabUS', () => {
- expect(loader.loadUserByConversation(convo)).toEqual(tabUS);
- })
- })
-})
\ No newline at end of file
diff --git a/bob_party/src/services/tests/saverUserApi.test.ts b/bob_party/src/services/tests/saverUserApi.test.ts
deleted file mode 100644
index f56e5e6..0000000
--- a/bob_party/src/services/tests/saverUserApi.test.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-import LoaderUserApi from '../userServices/loaderUserApi';
-import SaverUserApi from '../userServices/saverUserApi';
-
-
-// Instances
-let saver:SaverUserApi = new SaverUserApi();
-let loader = new LoaderUserApi();
-
-
-// Tests
-
-describe('SaverUserApi tests', () => {
- describe('saverUser tests', () => {
- })
-})
-*/
-
-it('should return true', () => {
- expect(1+1).toBe(2);
-})
\ No newline at end of file
diff --git a/bob_party/src/services/tests/stubUser.test.ts b/bob_party/src/services/tests/stubUser.test.ts
deleted file mode 100644
index 04295e0..0000000
--- a/bob_party/src/services/tests/stubUser.test.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import StubUser from '../userServices/stub';
-import { User } from '../../core/User/user';
-import { Skin } from '../../core/skin';
-import { GameSolo } from '../../core/gameSolo';
-import MatchSolo from '../../core/Match/matchSolo';
-import { Match } from '../../core/Match/match';
-import { Conversation } from '../../core/conversation';
-
-// Instances
-const img = "";
-let stub:StubUser = new StubUser();
-let map = new Map([
- [50, 3],
- [75, 4],
- [100, 5],
- [150, 6]
-]);
-let tabUS:User[] = [
- new User(1, "WeshWesh", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, new Skin(1, "Bob", img, 0), [new Skin(1, "Bob", img, 0)]),
- new User(2, "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, new Skin(1, "Bob", img, 0), [new Skin(1, "Bob", img, 0)]),
- new User(3, "Alban", "oui", "ouioui", "homme", new Date(2022,12,12), 555, 667, 12, new Skin(1, "Bob", img, 0), [new Skin(1, "Bob", img, 0)],),
- new User(4, "Fefe63", "jesuishm", "ouioui", "homme", new Date(2022,12,12), 12222, 123324, 12, new Skin(1, "Bob", img, 0), [new Skin(1, "Bob", img, 0)]),
-];
-let game:GameSolo = new GameSolo(1, 'SuperJeu', img, 'source', 1, 1, map);
-let match:Match = new MatchSolo(1, false, tabUS, game);
-let convo:Conversation = new Conversation(1, tabUS, [], 'superConvo');
-
-
-// Tests
-describe('StubUser tests', () => {
- describe('loadAllUser tests', () => {
- it('should return tabUS', () => {
- expect(stub.loadAllUser()).toEqual(tabUS);
- })
- })
- describe('loadById tests', () => {
- it('should return UserTest (id: 48)', () => {
- expect(stub.loadByID(48)).toEqual(tabUS[0]);
- })
- it('should return null', () => {
- expect(stub.loadByID(999999999999)).toBe(null);
- })
- })
- describe('loadByUserName tests', () => {
- it('should return USerTest (name: WeshWesh)', () => {
- expect(stub.loadByUsername('WeshWesh')).toEqual(tabUS[0]);
- })
- it('should return null', () => {
- expect(stub.loadByUsername('jExistePas')).toBe(null);
- })
- })
- describe('loadByUserNamePassword tests', () => {
- it('should return UserTest (name: WeshWesh, password: MdpDeOuf)', () => {
- expect(stub.loadByUsernamePassword('WeshWesh', 'MdpDeOuf')).toEqual(tabUS[0]);
- })
- it('should return null', () => {
- expect(stub.loadByUsernamePassword('jExistePas', 'jExistePas')).toBe(null);
- })
- })
- describe('loadUserByMatch tests', () => {
- it('should return tabUS', () => {
- expect(stub.loadUserByMatch(match)).toEqual(tabUS);
- })
- it('should return null', () => {
- expect(stub.loadByUsernamePassword('jExistePas', 'jExistePas')).toEqual(null);
- })
- })
- describe('loadUserByConversation tests', () => {
- it('should return tabUS', () => {
- expect(stub.loadUserByConversation(convo)).toEqual(tabUS);
- })
- })
- describe('loadLastId', () => {
- it('should return U0005', () => {
- expect(stub.loadLastId()).toBe('U0005');
- })
- })
-})
\ No newline at end of file
diff --git a/bob_party/src/services/userServices/ILoaderUser.ts b/bob_party/src/services/userServices/ILoaderUser.ts
index 46eafbf..7f30e04 100644
--- a/bob_party/src/services/userServices/ILoaderUser.ts
+++ b/bob_party/src/services/userServices/ILoaderUser.ts
@@ -43,10 +43,4 @@ export default interface ILoaderUser{
* return an array of User
*/
loadUserByConversation(c:Conversation): Promise;
-
- /**
- * loadLastId methode that load the last id used to create a user
- * return a String
- */
- loadLastId(): Promise;
}
\ No newline at end of file
diff --git a/bob_party/src/services/userServices/loaderUserApi.ts b/bob_party/src/services/userServices/loaderUserApi.ts
index 70a102e..2c1a091 100644
--- a/bob_party/src/services/userServices/loaderUserApi.ts
+++ b/bob_party/src/services/userServices/loaderUserApi.ts
@@ -129,8 +129,4 @@ export default class LoaderUserApi implements ILoaderUser{
}
return 1;
}
-
-
-
-
}
\ No newline at end of file
diff --git a/bob_party/src/services/userServices/stub.ts b/bob_party/src/services/userServices/stub.ts
index 6843696..e1af498 100644
--- a/bob_party/src/services/userServices/stub.ts
+++ b/bob_party/src/services/userServices/stub.ts
@@ -1,5 +1,7 @@
import { Conversation } from "../../core/conversation";
+import { GameSolo } from "../../core/gameSolo";
import { Match } from "../../core/Match/match";
+import MatchSolo from "../../core/Match/matchSolo";
import { Skin } from "../../core/skin";
import { User } from "../../core/User/user";
import ILoaderUser from "./ILoaderUser";
@@ -8,12 +10,24 @@ export default class StubUser implements ILoaderUser{
skin:Skin=new Skin(1, "Bob","https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/BobsSkins/BobClassic.png", 0);
-
tabUS:User[]=[
new User(1, "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, this.skin, [this.skin]),
new User(2, "WeshWesh", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, this.skin, [this.skin]),
];
+ convo:Conversation = new Conversation(1, this.tabUS, [], 'superConvo');
+
+ map = new Map([
+ [50, 3],
+ [75, 4],
+ [100, 5],
+ [150, 6]
+ ]);
+
+ game:GameSolo = new GameSolo(1, 'SuperJeu', "", 'source', 1, 1, this.map);
+
+ match:Match = new MatchSolo(1, false, this.tabUS, this.game);
+
async loadAllUser(): Promise {
return this.tabUS;
}
@@ -57,9 +71,5 @@ export default class StubUser implements ILoaderUser{
});
return tabUser;
}
-
- async loadLastId(): Promise {
- throw new Error("Method not implemented.");
- }
}
\ No newline at end of file