diff --git a/bob_party/App.tsx b/bob_party/App.tsx
index 06e0f20..57e11c0 100644
--- a/bob_party/App.tsx
+++ b/bob_party/App.tsx
@@ -1,6 +1,20 @@
import React from 'react'
+import { GameMulti } from './src/core/gameMulti'
+import { GameSolo } from './src/core/gameSolo'
+import { Match } from './src/core/match'
+import { MatchMulti } from './src/core/matchMulti'
import MainTabNavigator from './src/navigation/AppNavigator'
+import FakeSaverUser from './src/screens/services/userServices/fakeSaverUser'
+import ManagerUser from './src/screens/services/userServices/ManagerUser'
+import StubUser from './src/screens/services/userServices/stub'
+
export default function App() {
- return
+ let m=new ManagerUser(new StubUser, new FakeSaverUser);
+ let tabU=m.getLoaderUser().loadAllUser();
+ m.setCurrentUser(tabU[0]);
+
+ let match= new MatchMulti("00001", [...tabU], new GameMulti("1", "SNAKE", require('./assets/Icons/UnSelected/Gamepad.png'),"ouin", 1, 1, new Map));
+ console.log(m.getLoaderUser().loadUserByMatch(match));
+ //return
}
diff --git a/bob_party/index.js b/bob_party/index.js
index 1bb9aed..1bf4263 100644
--- a/bob_party/index.js
+++ b/bob_party/index.js
@@ -3,10 +3,15 @@ import App from './App'
import store from './src/redux/store'
import { Provider } from 'react-redux'
+
export default function Index(){
+
return(
+
+ /*
+ */
)
}
\ No newline at end of file
diff --git a/bob_party/src/screens/Home.tsx b/bob_party/src/screens/Home.tsx
index 4d7521f..bd05e30 100644
--- a/bob_party/src/screens/Home.tsx
+++ b/bob_party/src/screens/Home.tsx
@@ -8,20 +8,14 @@ import { Conversation } from '../core/conversation';
import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
import { useSelector } from 'react-redux';
import { RootState } from '../redux/store';
-import Stub from '../Services/StubManager/Stub';
+
//const test= new GameSolo("test", require('bob_party/assets/ImagesJeux/BatailleNavale.jpeg'), "test", );
let tabConv:Conversation[]=[];
-let manager=new Stub();
-
-
-
function Home(props: { navigation: any; }) {
- console.log(manager.managerUser.getUserById("14"));
- console.log(manager.managerUser.getUserById("0"));
const { navigation } = props
diff --git a/bob_party/src/screens/services/conversationService/ILoaderConversation.ts b/bob_party/src/screens/services/conversationService/ILoaderConversation.ts
new file mode 100644
index 0000000..fa03e90
--- /dev/null
+++ b/bob_party/src/screens/services/conversationService/ILoaderConversation.ts
@@ -0,0 +1,25 @@
+import { Conversation } from "../../../core/conversation";
+import { User } from "../../../core/User/user";
+
+export default interface ILoaderConversation{
+
+ /**
+ * loadAllConversation methode that load every Conversation in the data management system
+ * return an array of Conversation
+ */
+ loadAllConversation(): Conversation[];
+
+ /**
+ * loadByID methode that load an array of Conversation from the data management system by its id
+ * id the id we want to search
+ * return a Conversation if found, if not null
+ */
+ loadByID(id:string): Conversation | null;
+
+ /**
+ * loadByUser methode that load an array of Conversation from the data management system using a user
+ * u the user we want the conversations of
+ * return an array of Conversation
+ */
+ loadByUser(u:User): Conversation[];
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/conversationService/ISaverConversation.ts b/bob_party/src/screens/services/conversationService/ISaverConversation.ts
new file mode 100644
index 0000000..d24a7f9
--- /dev/null
+++ b/bob_party/src/screens/services/conversationService/ISaverConversation.ts
@@ -0,0 +1,23 @@
+import { Conversation } from "../../../core/conversation";
+
+export default interface ISaverConversation{
+
+ /**
+ * saveConversation methode that save a Conversation in the data management system
+ * c the Conversation we want to save
+ */
+
+ saveConversation(c:Conversation): void;
+
+ /**
+ * deleteConversation methode that delete a Conversation in the data management system
+ * c the Conversation we want to delete
+ */
+ deleteConversation(c:Conversation):void;
+
+ /**
+ * updateConversation methode that update a Conversation in the data management system
+ * c the Conversation we want to update
+ */
+ updateConversation(c:Conversation): void;
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/matchServices/ILoaderMatch.ts b/bob_party/src/screens/services/matchServices/ILoaderMatch.ts
new file mode 100644
index 0000000..7ea53f6
--- /dev/null
+++ b/bob_party/src/screens/services/matchServices/ILoaderMatch.ts
@@ -0,0 +1,17 @@
+import { Match } from "../../../core/match";
+
+export default interface ILoaderMatch{
+
+ /**
+ * loadAllMatch methode that load every Match from the data management system
+ * return an array of Match
+ */
+ loadAllMatch(): Match[];
+
+ /**
+ * loadByID methode that load a match from the data management system by its id
+ * id the id we want to search
+ * return a Match if found, if not null
+ */
+ loadByID(id:string): Match | null;
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/matchServices/ISaverMatch.ts b/bob_party/src/screens/services/matchServices/ISaverMatch.ts
new file mode 100644
index 0000000..9c88319
--- /dev/null
+++ b/bob_party/src/screens/services/matchServices/ISaverMatch.ts
@@ -0,0 +1,23 @@
+import { Match } from "../../../core/match";
+
+export default interface ISaverMatch{
+
+ /**
+ * saveMatch methode that save a Match in the data management system
+ * m the Match we want to save
+ */
+
+ saveMatch(m:Match): void;
+
+ /**
+ * deleteMatch methode that delete a Match in the data management system
+ * m the Match we want to delete
+ */
+ deleteMatch(m:Match):void;
+
+ /**
+ * updateMatch methode that update a Match in the data management system
+ * m the Match we want to update
+ */
+ updateMatch(m:Match): void;
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/messageService/IMessageLoader.ts b/bob_party/src/screens/services/messageService/IMessageLoader.ts
new file mode 100644
index 0000000..eb7ed67
--- /dev/null
+++ b/bob_party/src/screens/services/messageService/IMessageLoader.ts
@@ -0,0 +1,25 @@
+import { Conversation } from "../../../core/conversation";
+import { Message } from "../../../core/message";
+
+export default interface ILoaderMessage{
+
+ /**
+ * loadAllMessage methode that load every Message from the data management system
+ * return an array of Message
+ */
+ loadAllMessage(): Message[];
+
+ /**
+ * loadByID methode that load a Message from the data management system by its id
+ * id the id we want to search
+ * return a Message if found, if not null
+ */
+ loadByID(id:string): Message | null;
+
+ /**
+ * loadByUser methode that load an array of Message from the data management system using a Conversation
+ * c the Conversation we want the Messages of
+ * return an array of Message
+ */
+ loadByConversation(c:Conversation): Message[];
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/messageService/IMessageSaver.ts b/bob_party/src/screens/services/messageService/IMessageSaver.ts
new file mode 100644
index 0000000..a83ae9e
--- /dev/null
+++ b/bob_party/src/screens/services/messageService/IMessageSaver.ts
@@ -0,0 +1,12 @@
+import { Message } from "../../../core/message";
+
+export default interface ISaverMessage{
+
+ /**
+ * saveMessage methode that save a Message in the data management system
+ * m the Message we want to save
+ */
+
+ saveMessage(m:Message): void;
+
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/userServices/ILoaderUser.ts b/bob_party/src/screens/services/userServices/ILoaderUser.ts
index 034c2eb..cb7829c 100644
--- a/bob_party/src/screens/services/userServices/ILoaderUser.ts
+++ b/bob_party/src/screens/services/userServices/ILoaderUser.ts
@@ -1,8 +1,46 @@
+import { Conversation } from "../../../core/conversation";
+import { Match } from "../../../core/match";
import { User } from "../../../core/User/user";
export default interface ILoaderUser{
+ /**
+ * loadAllUser methode that load every user from the data management system
+ * return an array of User
+ */
+ loadAllUser(): User[];
+
+ /**
+ * loadByID methode that load a user from the data management system by his id
+ * id the id we want to search
+ * return a User if found, if not null
+ */
loadByID(id:string): User | null;
+
+ /**
+ * loadByUsername methode that load a user from the data management system by his username
+ * username the username we want to search
+ * return a User if found, if not null
+ */
loadByUsername(username:string): User | null;
+
+ /**
+ * loadByUsernamePassword methode that load a user from the data management system by his username and his password
+ * username the username we want to search
+ * password the password we want to search
+ * return a User if found, if not null
+ */
loadByUsernamePassword(username:string, password:string): User | null;
+
+ /**
+ * loadUserByMatch methode that load every user in a game
+ * return an array of User
+ */
+ loadUserByMatch(m:Match): User[];
+
+ /**
+ * laodUserByConversation methode that load every user in a Conversation
+ * return an array of User
+ */
+ laodUserByConversation(c:Conversation): User[];
}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/userServices/ISaverUser.ts b/bob_party/src/screens/services/userServices/ISaverUser.ts
index 08c5088..871c0b3 100644
--- a/bob_party/src/screens/services/userServices/ISaverUser.ts
+++ b/bob_party/src/screens/services/userServices/ISaverUser.ts
@@ -2,6 +2,22 @@ import { User } from "../../../core/User/user";
export default interface ISaverUser{
- saveUser(u:User): void;
- deleteUser(u:User):void;
+ /**
+ * saveUser methode that save a User in the data management system
+ * u the user we want to save
+ */
+
+ saveUser(u:User): void;
+
+ /**
+ * deleteUser methode that delete a User in the data management system
+ * u the user we want to delete
+ */
+ deleteUser(u:User):void;
+
+ /**
+ * updateUser methode that update a User in the data management system
+ * u the user we want to update
+ */
+ updateUser(u:User): void;
}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/userServices/ManagerUser.ts b/bob_party/src/screens/services/userServices/ManagerUser.ts
new file mode 100644
index 0000000..20b6db5
--- /dev/null
+++ b/bob_party/src/screens/services/userServices/ManagerUser.ts
@@ -0,0 +1,42 @@
+import { User } from "../../../core/User/user";
+import ILoaderUser from "./ILoaderUser";
+import ISaverUser from "./ISaverUser";
+
+export default class ManagerUser{
+
+ private currentUser: User | null;
+
+ private loaderUser: ILoaderUser;
+
+ private saverUser: ISaverUser;
+
+ constructor(loader:ILoaderUser, saver:ISaverUser){
+ this.currentUser=null;
+ this.loaderUser=loader;
+ this.saverUser=saver;
+ }
+
+ getCurrentUser(){
+ return this.currentUser;
+ }
+
+ setCurrentUser(u:User){
+ this.currentUser=u;
+ }
+
+ getLoaderUser(){
+ return this.loaderUser;
+ }
+
+ setLoaderUser(l:ILoaderUser){
+ this.loaderUser=l;
+ }
+
+ getsaverUser(){
+ return this.saverUser;
+ }
+
+ setsaverUser(s:ISaverUser){
+ this.saverUser=s;
+ }
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/userServices/fakeSaverUser.ts b/bob_party/src/screens/services/userServices/fakeSaverUser.ts
new file mode 100644
index 0000000..d19e8e4
--- /dev/null
+++ b/bob_party/src/screens/services/userServices/fakeSaverUser.ts
@@ -0,0 +1,16 @@
+import { User } from "../../../core/User/user";
+import ISaverUser from "./ISaverUser";
+
+
+export default class FakeSaverUser implements ISaverUser{
+
+ saveUser(u: User): void {
+ return;
+ }
+ deleteUser(u: User): void {
+ return;
+ }
+ updateUser(u: User): void {
+ return;
+ }
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/userServices/loaderUserApi.ts b/bob_party/src/screens/services/userServices/loaderUserApi.ts
new file mode 100644
index 0000000..c65f90d
--- /dev/null
+++ b/bob_party/src/screens/services/userServices/loaderUserApi.ts
@@ -0,0 +1,29 @@
+import { Conversation } from "../../../core/conversation";
+import { Match } from "../../../core/match";
+import { User } from "../../../core/User/user";
+import ILoaderUser from "./ILoaderUser";
+
+export default class LoaderUserApi implements ILoaderUser{
+
+ loadAllUser(): User[] {
+ throw new Error("Method not implemented.");
+ }
+ loadByID(id: string): User | null {
+ throw new Error("Method not implemented.");
+ }
+ loadByUsername(username: string): User | null {
+ throw new Error("Method not implemented.");
+ }
+ loadByUsernamePassword(username: string, password: string): User | null {
+ throw new Error("Method not implemented.");
+ }
+ loadUserByMatch(m: Match): User[] {
+ throw new Error("Method not implemented.");
+ }
+ laodUserByConversation(c: Conversation): User[] {
+ throw new Error("Method not implemented.");
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/userServices/saverUserApi.ts b/bob_party/src/screens/services/userServices/saverUserApi.ts
new file mode 100644
index 0000000..318e7fb
--- /dev/null
+++ b/bob_party/src/screens/services/userServices/saverUserApi.ts
@@ -0,0 +1,17 @@
+import { User } from "../../../core/User/user";
+import ISaverUser from "./ISaverUser";
+
+
+export default class SaverUserApi implements ISaverUser{
+
+ saveUser(u: User): void {
+ throw new Error("Method not implemented.");
+ }
+ deleteUser(u: User): void {
+ throw new Error("Method not implemented.");
+ }
+ updateUser(u: User): void {
+ throw new Error("Method not implemented.");
+ }
+
+}
\ No newline at end of file
diff --git a/bob_party/src/screens/services/userServices/stub.ts b/bob_party/src/screens/services/userServices/stub.ts
new file mode 100644
index 0000000..7e37f45
--- /dev/null
+++ b/bob_party/src/screens/services/userServices/stub.ts
@@ -0,0 +1,59 @@
+import { Conversation } from "../../../core/conversation";
+import { Match } from "../../../core/match";
+import { Skin } from "../../../core/skin";
+import { User } from "../../../core/User/user";
+import ILoaderUser from "./ILoaderUser";
+
+export default class StubUser implements ILoaderUser{
+
+ tabUS:User[]=[
+ new User("14", "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0), [new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0)]),
+ new User("48", "WeshWesh", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0), [new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0)]),
+ new User("17", "Alban", "oui", "ouioui", "homme", new Date(2022,12,12), 555, 667, 12, new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0), [new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0)],),
+ new User("17", "Fefe63", "jesuishm", "ouioui", "homme", new Date(2022,12,12), 12222, 123324, 12, new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0), [new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0)]),
+ ];
+
+ loadAllUser(): User[] {
+ return this.tabUS;
+ }
+ loadByID(id: string): User | null {
+ for(let u of this.tabUS){
+ if (u.getId()==id){
+ return u;
+ }
+ }
+ return null;
+ }
+ loadByUsername(username: string): User | null {
+ for(let u of this.tabUS){
+ if (u.getUsername()==username){
+ return u;
+ }
+ }
+ return null;
+ }
+ loadByUsernamePassword(username: string, password: string): User | null {
+ for(let u of this.tabUS){
+ if (u.getUsername()==username && u.getPassword()==password){
+ return u;
+ }
+ }
+ return null;
+ }
+
+ loadUserByMatch(m: Match): User[] {
+ let tabUser:User[]=[];
+ m.getTabUsers().forEach(u => {
+ tabUser.push(u);
+ });
+ return tabUser;
+ }
+ laodUserByConversation(c: Conversation): User[] {
+ let tabUser:User[]=[];
+ c.getTabUser().forEach(u => {
+ tabUser.push(u);
+ });
+ return tabUser;
+ }
+
+}
\ No newline at end of file