Merge branch 'typescript' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into typescript
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
2ceac8dafc
@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
import { Message } from "./core/message"
|
|
||||||
import { Conversation } from "./core/conversation"
|
|
||||||
import tabSkinApp from './constSkin'
|
|
||||||
import { User } from "./core/User/user";
|
|
||||||
|
|
||||||
|
|
||||||
let UserActu:User=new User("14", "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, undefined);
|
|
||||||
let UserTest:User=new User("48", "Wesh Wesh", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[5], tabSkinApp, undefined);
|
|
||||||
|
|
||||||
let tabMessageTest:Message[]=[
|
|
||||||
new Message("Salut", UserActu, new Date(2022,12,12,11,30,40)),
|
|
||||||
new Message("Wesh", UserTest, new Date(2022,12,13,12,20,40)),
|
|
||||||
new Message("Ca va", UserActu, new Date(2022,12,14, 12, 30, 35)),
|
|
||||||
new Message("Ouais et toi?", UserTest, new Date(2022,12,14,12,35,0)),
|
|
||||||
]
|
|
||||||
|
|
||||||
let tabUS:User[]=[UserActu, UserTest];
|
|
||||||
|
|
||||||
let conv = new Conversation(tabUS, tabMessageTest, "le super nom");
|
|
||||||
|
|
||||||
let tabConv:Conversation[]=[conv];
|
|
||||||
|
|
||||||
export default tabConv;
|
|
||||||
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
const tabNat = [
|
|
||||||
{ label: "France", value: "Français" },
|
|
||||||
{ label: "Allemagne", value: "Allemand" },
|
|
||||||
{ label: "Espagne", value: "Espagnol" },
|
|
||||||
{ label: "Royaume-Uni", value: "Anglais" },
|
|
||||||
{ label: "États-Unis", value: "Américain" },
|
|
||||||
{ label: "Italie", value: "Italien" },
|
|
||||||
]
|
|
||||||
|
|
||||||
export default tabNat;
|
|
@ -1,14 +0,0 @@
|
|||||||
import { Skin } from "./core/skin";
|
|
||||||
|
|
||||||
let tabSkinApp:Skin[]=[
|
|
||||||
new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0),
|
|
||||||
new Skin("S0002", "Bob Blue",require('bob_party/assets/BobsSkins/BobBlue.png'), 100),
|
|
||||||
new Skin("S0003", "Bob BW",require('bob_party/assets/BobsSkins/BobBW.png'), 100),
|
|
||||||
new Skin("S0004", "Bob Green",require('bob_party/assets/BobsSkins/BobGreen.png'), 100),
|
|
||||||
new Skin("S0005", "Bob P&T",require('bob_party/assets/BobsSkins/BobPinkTurquoise.png'), 100),
|
|
||||||
new Skin("S0006", "Bob Red",require('bob_party/assets/BobsSkins/BobRed.png'), 100),
|
|
||||||
new Skin("S0007", "Bob Cute",require('bob_party/assets/BobsSkins/BobYellowGreenBlueHeart.png'), 100),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
export default tabSkinApp;
|
|
@ -1,15 +0,0 @@
|
|||||||
import { Message } from "./core/message"
|
|
||||||
import { Conversation } from "./core/conversation"
|
|
||||||
import tabSkinApp from './constSkin'
|
|
||||||
import { User } from "./core/User/user";
|
|
||||||
import tabConv from "./constCov";
|
|
||||||
|
|
||||||
|
|
||||||
let UserActu:User=new User("14", "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, undefined);
|
|
||||||
let UserTest:User=new User("48", "WeshWesh", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[2], tabSkinApp, undefined);
|
|
||||||
let Alban:User=new User("17", "Alban", "oui", "ouioui", "homme", new Date(2022,12,12), 555, 667, 12, tabSkinApp[1], tabSkinApp, tabConv);
|
|
||||||
let Fefe63:User=new User("17", "Fefe63", "jesuishm", "ouioui", "homme", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[6], tabSkinApp, undefined);
|
|
||||||
|
|
||||||
let tabUS:User[]=[UserActu, UserTest, Alban, Fefe63];
|
|
||||||
|
|
||||||
export default tabUS;
|
|
@ -1,14 +0,0 @@
|
|||||||
import { User } from "./user";
|
|
||||||
import { Skin } from "../Skin";
|
|
||||||
import { ManagerCoinsUser } from "./managerCoinsUser";
|
|
||||||
//import ManagerCoinsUser
|
|
||||||
|
|
||||||
|
|
||||||
export class SkinBuyer{
|
|
||||||
buy(u:User, s:Skin){
|
|
||||||
const manage=new ManagerCoinsUser();
|
|
||||||
u.getTabSkin().push(s);
|
|
||||||
manage.removeCoins(u, s.getSkinCost());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,12 @@
|
|||||||
|
import { User } from "./user";
|
||||||
|
import tabSkinApp from "../../constSkin";
|
||||||
|
import { Conversation } from "../conversation";
|
||||||
|
|
||||||
|
export class UserCreator{
|
||||||
|
createUser(username:string, password:string, nationality:string, sexe:string, date:Date){
|
||||||
|
//Récup l'ID d'après dans la bdd
|
||||||
|
const u = new User('0000', username, password, nationality, sexe, date, 0, 0, 0, tabSkinApp[0], [tabSkinApp[0]]);
|
||||||
|
//Ajout du joueur dans la bdd
|
||||||
|
return u;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
import { User } from "./user";
|
||||||
|
|
||||||
|
|
||||||
|
export default class UserModificationManager{
|
||||||
|
changePassword(user:User, password:string){
|
||||||
|
user.setPassword(password);
|
||||||
|
//modif dans la bdd
|
||||||
|
}
|
||||||
|
|
||||||
|
changeUsername(user:User, username:string){
|
||||||
|
user.setPassword(username);
|
||||||
|
//modif dans la bdd
|
||||||
|
}
|
||||||
|
|
||||||
|
changeNationality(user:User, nationality:string){
|
||||||
|
user.setNationality(nationality);
|
||||||
|
//modif dans la bdd
|
||||||
|
}
|
||||||
|
|
||||||
|
changeSexe(user:User, sexe:string){
|
||||||
|
user.setSexe(sexe);
|
||||||
|
//modif dans la bdd
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
import { Skin } from '../Skin'
|
||||||
|
import { User } from './user'
|
||||||
|
|
||||||
|
|
||||||
|
export default class UserSkinModifier{
|
||||||
|
addSkin(user:User, skin:Skin){
|
||||||
|
user.addSkin(skin);
|
||||||
|
}
|
||||||
|
|
||||||
|
changeCurrentSkin(user:User, skin:Skin){
|
||||||
|
user.setCurrentSkin(skin);
|
||||||
|
}
|
||||||
|
}
|
@ -1,56 +1,72 @@
|
|||||||
import { ImageSourcePropType } from 'react-native';
|
import { ImageSourcePropType } from 'react-native';
|
||||||
import { Game } from './game';
|
import { Game } from './game';
|
||||||
import { GameCasino } from './gameCasino';
|
|
||||||
import { GameMulti } from './gameMulti';
|
|
||||||
import { GameSolo } from './gameSolo';
|
|
||||||
import { User } from "./User/user";
|
import { User } from "./User/user";
|
||||||
|
|
||||||
|
|
||||||
export abstract class Match{
|
export abstract class Match{
|
||||||
readonly code:string;
|
readonly code:string;
|
||||||
|
private inGame:Boolean;
|
||||||
private tabUsers:User[];
|
private tabUsers:User[];
|
||||||
private theGame:Game;
|
private theGame:Game;
|
||||||
|
|
||||||
constructor(code:string, tabUser:User[], game:Game){
|
constructor(code:string, inGame:Boolean, tabUser:User[], game:Game){
|
||||||
this.code=code;
|
this.code=code;
|
||||||
|
this.inGame=false;
|
||||||
this.tabUsers=[...tabUser];
|
this.tabUsers=[...tabUser];
|
||||||
this.theGame=game;
|
this.theGame=game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Brief : Fuction getting if the match is currently in a game */
|
||||||
|
|
||||||
|
getInGame(){
|
||||||
|
return this.inGame;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Brief : Fuction setting the boolean inGame */
|
||||||
|
|
||||||
|
setInGame(inGame:Boolean){
|
||||||
|
this.inGame=inGame;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Brief : Fuction getting the array of User */
|
||||||
|
|
||||||
getTabUsers(){
|
getTabUsers(){
|
||||||
return this.tabUsers;
|
return this.tabUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Brief : Fuction setting the array of User */
|
||||||
|
|
||||||
setTabUser(tabUser:User[]){
|
setTabUser(tabUser:User[]){
|
||||||
this.tabUsers=[...tabUser];
|
this.tabUsers=[...tabUser];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Brief : Fuction getting code of a match */
|
||||||
|
|
||||||
getCode(){
|
getCode(){
|
||||||
return this.code;
|
return this.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Brief : Fuction getting the game of a match */
|
||||||
|
|
||||||
getGame(){
|
getGame(){
|
||||||
return this.theGame;
|
return this.theGame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Brief : Fuction setting the game of a match */
|
||||||
|
|
||||||
setGame(game:Game){
|
setGame(game:Game){
|
||||||
this.theGame=game;
|
this.theGame=game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
abstract updatePostMatch(user:User, points:number):void;
|
||||||
convertMechanismToCoins(){
|
|
||||||
if (this.TheGame instanceof GameSolo){
|
|
||||||
return this.TheGame.CoinsWithPoints(this.GainingMechanism);
|
|
||||||
}
|
|
||||||
else if (this.TheGame instanceof GameMulti){
|
|
||||||
return this.TheGame.CoinsWithRank(this.GainingMechanism);
|
|
||||||
}
|
|
||||||
else if (this.TheGame instanceof GameCasino){
|
|
||||||
return this.TheGame.betToCoins(this.GainingMechanism);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
import { Game } from '../game';
|
||||||
|
import { GameSolo } from '../GameSolo';
|
||||||
|
|
||||||
|
|
||||||
|
// Instances
|
||||||
|
|
||||||
|
let myMap = new Map<number, number>([
|
||||||
|
[50, 3],
|
||||||
|
[75, 4],
|
||||||
|
[100, 5],
|
||||||
|
[150, 6]
|
||||||
|
]);
|
||||||
|
let game:Game = new GameSolo("id", "bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, 1, myMap);
|
||||||
|
|
||||||
|
|
||||||
|
// Get tests
|
||||||
|
describe('GameSolo get tests', () => {
|
||||||
|
it('should return id', () => {
|
||||||
|
expect(game.getId()).toBe('id');
|
||||||
|
})
|
||||||
|
it('should return bo jeu', () => {
|
||||||
|
expect(game.getName()).toBe('bo jeu');
|
||||||
|
})
|
||||||
|
it('should return require(blackjack.jpg)', () => {
|
||||||
|
expect(game.getImageSource()).toBe(require('bob_party/assets/ImagesJeux/blackjack.jpg'));
|
||||||
|
})
|
||||||
|
it('should return super jeu', () => {
|
||||||
|
expect(game.getGameSource()).toBe('super jeu');
|
||||||
|
})
|
||||||
|
it('should return 1', () => {
|
||||||
|
expect(game.getNbPlayerMin()).toBe(1);
|
||||||
|
})
|
||||||
|
it('should return 1', () => {
|
||||||
|
expect(game.getNbPlayerMax()).toBe(1);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Setting new values
|
||||||
|
game.setGameSource('trop cool le jeu');
|
||||||
|
game.setImageSource(require('bob_party/assets/ImagesJeux/JeuDeDame.jpg'));
|
||||||
|
game.setName('beau jeu');
|
||||||
|
game.setNbPlayerMin(2);
|
||||||
|
game.setNbPlayerMax(3);
|
||||||
|
|
||||||
|
|
||||||
|
// Set tests
|
||||||
|
describe('GameSolo set tests', () => {
|
||||||
|
it('should return beau jeu', () => {
|
||||||
|
expect(game.getName()).toBe('beau jeu');
|
||||||
|
})
|
||||||
|
it('should return require(JeuDeDame.jpg)', () => {
|
||||||
|
expect(game.getImageSource).toBe(require('bob_party/assets/ImagesJeux/JeuDeDame.jpg'));
|
||||||
|
})
|
||||||
|
it('should return trop cool le jeu', () => {
|
||||||
|
expect(game.getGameSource()).toBe('trop cool le jeu');
|
||||||
|
})
|
||||||
|
it('should return 2', () => {
|
||||||
|
expect(game.getNbPlayerMin()).toBe(2);
|
||||||
|
})
|
||||||
|
it('should return 3', () => {
|
||||||
|
expect(game.getNbPlayerMax()).toBe(3);
|
||||||
|
})
|
||||||
|
})
|
@ -1,3 +0,0 @@
|
|||||||
import { Match } from '../Match';
|
|
||||||
|
|
||||||
|
|
@ -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[];
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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[];
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +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[];
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
import { User } from "../../core/User/user";
|
||||||
|
|
||||||
|
export default interface ISaverUser{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -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.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
import { GameSolo } from "./core/gameSolo";
|
|
||||||
|
|
||||||
let myMap = new Map<number, number>([
|
|
||||||
[50, 3],
|
|
||||||
[75, 4],
|
|
||||||
[100, 5],
|
|
||||||
[150, 6]
|
|
||||||
]);
|
|
||||||
|
|
||||||
let game=new GameSolo("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, myMap);
|
|
||||||
|
|
||||||
export default game;
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue