|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import { Skin } from '../Skin'
|
|
|
|
|
import { Conversation } from '../conversation';
|
|
|
|
|
import { sign } from 'crypto';
|
|
|
|
|
import { TextBase } from 'react-native';
|
|
|
|
|
|
|
|
|
|
export class User{
|
|
|
|
|
readonly id: string;
|
|
|
|
@ -14,11 +15,11 @@ export class User{
|
|
|
|
|
private nbGamesPlayed: number;
|
|
|
|
|
private currentSkin: Skin;
|
|
|
|
|
private tabSkin: Skin[];
|
|
|
|
|
private tabConv?: Conversation[];
|
|
|
|
|
private tabConv: Conversation[];
|
|
|
|
|
|
|
|
|
|
/* Consturctor of the class */
|
|
|
|
|
constructor(id: string, username: string, password:string, nationality: string, sexe: string, dateOfBirth: Date, currentCoins: number, totalCoins: number,
|
|
|
|
|
nbGamesPlayed:number, currentSkin: Skin, tabSkin: Skin[], tabConv?: Conversation[] ){
|
|
|
|
|
nbGamesPlayed:number, currentSkin: Skin, tabSkin: Skin[], tabConv: Conversation[] ){
|
|
|
|
|
this.id=id;
|
|
|
|
|
this.username=username;
|
|
|
|
|
this.password=password;
|
|
|
|
@ -30,135 +31,136 @@ export class User{
|
|
|
|
|
this.totalCoins=totalCoins;
|
|
|
|
|
this.currentSkin=currentSkin;
|
|
|
|
|
this.tabSkin=[...tabSkin];
|
|
|
|
|
if(tabConv!==undefined){
|
|
|
|
|
this.tabConv=[...tabConv];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.tabConv=tabConv;
|
|
|
|
|
}
|
|
|
|
|
this.tabConv=[...tabConv];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the name of an user */
|
|
|
|
|
/* Brief : Function getting the name of a user */
|
|
|
|
|
getUsername(){
|
|
|
|
|
return this.username;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the name of an user */
|
|
|
|
|
/* Brief : Function setting the name of a user */
|
|
|
|
|
setUsername(username: string){
|
|
|
|
|
this.username=username;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the id of an user */
|
|
|
|
|
/* Brief : Function getting the id of a user */
|
|
|
|
|
getId(){
|
|
|
|
|
return this.id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the password of a user */
|
|
|
|
|
getPassword(){
|
|
|
|
|
return this.password;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the password of a user */
|
|
|
|
|
setPassword(password:string){
|
|
|
|
|
this.password=password;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current number of coins of an user */
|
|
|
|
|
/* Brief : Function getting the current number of coins of a user */
|
|
|
|
|
getCurrentCoins(){
|
|
|
|
|
return this.currentCoins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the current number of coins of an user */
|
|
|
|
|
/* Brief : Function setting the current number of coins of a user */
|
|
|
|
|
setCurrentCoins(currentCoins: number){
|
|
|
|
|
this.currentCoins=currentCoins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the sex of an user */
|
|
|
|
|
/* Brief : Function getting the sex of a user */
|
|
|
|
|
getSexe(){
|
|
|
|
|
return this.sexe;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the sex of an user */
|
|
|
|
|
/* Brief : Function getting the sex of a user */
|
|
|
|
|
setSexe(sexe: string){
|
|
|
|
|
this.sexe=sexe;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the date of birth of an user */
|
|
|
|
|
/* Brief : Function getting the date of birth of a user */
|
|
|
|
|
getDateOfBirth(){
|
|
|
|
|
return this.dateOfBirth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the date of birth of an user */
|
|
|
|
|
/* Brief : Function setting the date of birth of a user */
|
|
|
|
|
setDateOfBirth(dateOfBirth: Date){
|
|
|
|
|
this.dateOfBirth=dateOfBirth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the nationality of an user */
|
|
|
|
|
/* Brief : Function getting the nationality of a user */
|
|
|
|
|
getNationality(){
|
|
|
|
|
return this.nationality;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the nationality of an user */
|
|
|
|
|
/* Brief : Function setting the nationality of a user */
|
|
|
|
|
setNationality(nationality: string){
|
|
|
|
|
this.nationality=nationality;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the total number of coins of an user */
|
|
|
|
|
/* Brief : Function getting the total number of coins of a user */
|
|
|
|
|
getTotalCoins(){
|
|
|
|
|
return this.totalCoins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the total number of coins of an user */
|
|
|
|
|
/* Brief : Function setting the total number of coins of a user */
|
|
|
|
|
setTotalCoins(totalCoins: number){
|
|
|
|
|
this.totalCoins=totalCoins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current number of games played by an user */
|
|
|
|
|
/* Brief : Function getting the current number of games played by a user */
|
|
|
|
|
|
|
|
|
|
getGamesPlayed(){
|
|
|
|
|
return this.nbGamesPlayed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the current number of games played by an user */
|
|
|
|
|
/* Brief : Function setting the current number of games played by a user */
|
|
|
|
|
|
|
|
|
|
setGamesPlayed(nb: number){
|
|
|
|
|
this.nbGamesPlayed=nb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current skin of an user */
|
|
|
|
|
/* Brief : Function getting the current skin of a user */
|
|
|
|
|
|
|
|
|
|
getCurrentSkin(){
|
|
|
|
|
return this.currentSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the current skin of an user */
|
|
|
|
|
/* Brief : Function setting the current skin of a user */
|
|
|
|
|
setCurrentSkin(newSkin: Skin){
|
|
|
|
|
this.currentSkin=newSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the skins of an user */
|
|
|
|
|
/* Brief : Function getting the skins of a user */
|
|
|
|
|
getTabSkin(){
|
|
|
|
|
return this.tabSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the skins of an user */
|
|
|
|
|
/* Brief : Function setting the skins of a user */
|
|
|
|
|
setTabSkin(tabSkin: Skin[]){
|
|
|
|
|
this.tabSkin=[...tabSkin];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the conversations of an user */
|
|
|
|
|
/* Brief : Function getting the conversations of a user */
|
|
|
|
|
getTabConv(){
|
|
|
|
|
return this.tabConv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the conversations of an user */
|
|
|
|
|
setTabConv(tabConv?: Conversation[]){
|
|
|
|
|
tabConv?.forEach(conv => {
|
|
|
|
|
this.tabConv?.push(conv);
|
|
|
|
|
});
|
|
|
|
|
/* Brief : Function setting the conversations of a user */
|
|
|
|
|
setTabConv(tabConv: Conversation[]){
|
|
|
|
|
this.tabConv=[...tabConv]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Brief : Function adding a skin to a user */
|
|
|
|
|
addSkin(skin:Skin){
|
|
|
|
|
this.tabSkin.push(skin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function adding a conversation to a user */
|
|
|
|
|
addConversation(conv:Conversation){
|
|
|
|
|
this.tabConv.push(conv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|