|
|
|
@ -1,159 +1,159 @@
|
|
|
|
|
import { Skin } from './Skin'
|
|
|
|
|
import { Conversation } from './conversation';
|
|
|
|
|
import { Skin } from '../Skin'
|
|
|
|
|
import { Conversation } from '../conversation';
|
|
|
|
|
import { sign } from 'crypto';
|
|
|
|
|
|
|
|
|
|
export class User{
|
|
|
|
|
readonly Id: string;
|
|
|
|
|
private Username: string;
|
|
|
|
|
private Password: string;
|
|
|
|
|
private Nationality: string;
|
|
|
|
|
private Sexe: string;
|
|
|
|
|
private DateOfBirth: Date;
|
|
|
|
|
private CurrentCoins: number;
|
|
|
|
|
private TotalCoins: number;
|
|
|
|
|
private NbGamePlayed: number;
|
|
|
|
|
private CurrentSkin: Skin;
|
|
|
|
|
private TabSkin: Skin[];
|
|
|
|
|
private TabConv?: Conversation[];
|
|
|
|
|
readonly id: string;
|
|
|
|
|
private username: string;
|
|
|
|
|
private password: string;
|
|
|
|
|
private nationality: string;
|
|
|
|
|
private sexe: string;
|
|
|
|
|
private dateOfBirth: Date;
|
|
|
|
|
private currentCoins: number;
|
|
|
|
|
private totalCoins: number;
|
|
|
|
|
private nbGamePlayed: number;
|
|
|
|
|
private currentSkin: Skin;
|
|
|
|
|
private tabSkin: Skin[];
|
|
|
|
|
private tabConv?: Conversation[];
|
|
|
|
|
|
|
|
|
|
/* Consturctor of the class */
|
|
|
|
|
constructor(id: string, username: string, password:string, nationality: string, sexe: string, dateOfBirth: Date, currentCoins: number, totalCoins: number,
|
|
|
|
|
nbGamePlayed:number, currentSkin: Skin, tabSkin: Skin[], tabConv?: Conversation[] ){
|
|
|
|
|
this.Id=id;
|
|
|
|
|
this.Username=username;
|
|
|
|
|
this.Password=password;
|
|
|
|
|
this.Nationality=nationality;
|
|
|
|
|
this.Sexe=sexe;
|
|
|
|
|
this.DateOfBirth=dateOfBirth;
|
|
|
|
|
this.NbGamePlayed=nbGamePlayed;
|
|
|
|
|
this.CurrentCoins=currentCoins;
|
|
|
|
|
this.TotalCoins=totalCoins;
|
|
|
|
|
this.CurrentSkin=currentSkin;
|
|
|
|
|
this.TabSkin=[...tabSkin];
|
|
|
|
|
this.id=id;
|
|
|
|
|
this.username=username;
|
|
|
|
|
this.password=password;
|
|
|
|
|
this.nationality=nationality;
|
|
|
|
|
this.sexe=sexe;
|
|
|
|
|
this.dateOfBirth=dateOfBirth;
|
|
|
|
|
this.nbGamePlayed=nbGamePlayed;
|
|
|
|
|
this.currentCoins=currentCoins;
|
|
|
|
|
this.totalCoins=totalCoins;
|
|
|
|
|
this.currentSkin=currentSkin;
|
|
|
|
|
this.tabSkin=[...tabSkin];
|
|
|
|
|
tabConv?.forEach(conv => {
|
|
|
|
|
this.TabConv?.push(conv);
|
|
|
|
|
this.tabConv?.push(conv);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the name of an user */
|
|
|
|
|
getUsername(){
|
|
|
|
|
return this.Username;
|
|
|
|
|
return this.username;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the name of an user */
|
|
|
|
|
setUsername(username: string){
|
|
|
|
|
this.Username=username;
|
|
|
|
|
this.username=username;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the id of an user */
|
|
|
|
|
getId(){
|
|
|
|
|
return this.Id;
|
|
|
|
|
return this.id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPassword(){
|
|
|
|
|
return this.Password;
|
|
|
|
|
return this.password;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setPassword(password:string){
|
|
|
|
|
this.Password=password;
|
|
|
|
|
this.password=password;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current number of coins of an user */
|
|
|
|
|
getCurrentCoins(){
|
|
|
|
|
return this.CurrentCoins;
|
|
|
|
|
return this.currentCoins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the current number of coins of an user */
|
|
|
|
|
setCurrentCoins(currentCoins: number){
|
|
|
|
|
this.CurrentCoins=currentCoins;
|
|
|
|
|
this.currentCoins=currentCoins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the sex of an user */
|
|
|
|
|
getSexe(){
|
|
|
|
|
return this.Sexe;
|
|
|
|
|
return this.sexe;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the sex of an user */
|
|
|
|
|
setSexe(sexe: string){
|
|
|
|
|
this.Sexe=sexe;
|
|
|
|
|
this.sexe=sexe;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the date of birth of an user */
|
|
|
|
|
getDateOfBirth(){
|
|
|
|
|
return this.DateOfBirth;
|
|
|
|
|
return this.dateOfBirth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the date of birth of an user */
|
|
|
|
|
setDateOfBirth(dateOfBirth: Date){
|
|
|
|
|
this.DateOfBirth=dateOfBirth;
|
|
|
|
|
this.dateOfBirth=dateOfBirth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the nationality of an user */
|
|
|
|
|
getNationality(){
|
|
|
|
|
return this.Nationality;
|
|
|
|
|
return this.nationality;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the nationality of an user */
|
|
|
|
|
setNationality(nationality: string){
|
|
|
|
|
this.Nationality=nationality;
|
|
|
|
|
this.nationality=nationality;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the total number of coins of an user */
|
|
|
|
|
getTotalCoins(){
|
|
|
|
|
return this.TotalCoins;
|
|
|
|
|
return this.totalCoins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the total number of coins of an user */
|
|
|
|
|
setTotalCoins(totalCoins: number){
|
|
|
|
|
this.TotalCoins=totalCoins;
|
|
|
|
|
this.totalCoins=totalCoins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current number of game played by an user */
|
|
|
|
|
|
|
|
|
|
getGamePlayed(){
|
|
|
|
|
return this.NbGamePlayed;
|
|
|
|
|
return this.nbGamePlayed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the current number of game played by an user */
|
|
|
|
|
|
|
|
|
|
setGamePlayed(nb: number){
|
|
|
|
|
this.NbGamePlayed=nb;
|
|
|
|
|
this.nbGamePlayed=nb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current skin of an user */
|
|
|
|
|
|
|
|
|
|
getCurrentSkin(){
|
|
|
|
|
return this.CurrentSkin;
|
|
|
|
|
return this.currentSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the current skin of an user */
|
|
|
|
|
setCurrentSkin(newSkin: Skin){
|
|
|
|
|
this.CurrentSkin=newSkin;
|
|
|
|
|
this.currentSkin=newSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the skins of an user */
|
|
|
|
|
getTabSkin(){
|
|
|
|
|
return this.TabSkin;
|
|
|
|
|
return this.tabSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the skins of an user */
|
|
|
|
|
setTabSkin(tabSkin: Skin[]){
|
|
|
|
|
this.TabSkin=[...tabSkin];
|
|
|
|
|
this.tabSkin=[...tabSkin];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the conversations of an user */
|
|
|
|
|
getTabConv(){
|
|
|
|
|
return this.TabConv;
|
|
|
|
|
return this.tabConv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the conversations of an user */
|
|
|
|
|
setTabConv(tabConv?: Conversation[]){
|
|
|
|
|
tabConv?.forEach(conv => {
|
|
|
|
|
this.TabConv?.push(conv);
|
|
|
|
|
this.tabConv?.push(conv);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
changeUserCoins(coin:number){
|
|
|
|
|
this.CurrentCoins+=coin;
|
|
|
|
|
if (coin>0){
|
|
|
|
@ -175,4 +175,9 @@ export class User{
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
usrPasswordEquals(username:string, password:string){
|
|
|
|
|
return this.Password==password && this.Username==username;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|