|
|
@ -1,26 +1,29 @@
|
|
|
|
import { Skin } from './Skin'
|
|
|
|
import { Skin } from './Skin'
|
|
|
|
import { Conversation } from './conversation';
|
|
|
|
import { Conversation } from './conversation';
|
|
|
|
|
|
|
|
import { sign } from 'crypto';
|
|
|
|
|
|
|
|
|
|
|
|
export class User{
|
|
|
|
export class User{
|
|
|
|
private Id: string;
|
|
|
|
readonly Id: string;
|
|
|
|
private Username: string;
|
|
|
|
private Username: string;
|
|
|
|
private Nationality: string;
|
|
|
|
private Nationality: string;
|
|
|
|
private Sexe: string;
|
|
|
|
private Sexe: string;
|
|
|
|
private DateOfBirth: Date;
|
|
|
|
private DateOfBirth: Date;
|
|
|
|
private CurrentCoins: number;
|
|
|
|
private CurrentCoins: number;
|
|
|
|
private TotalCoins: number;
|
|
|
|
private TotalCoins: number;
|
|
|
|
|
|
|
|
private NbGamePlayed: number;
|
|
|
|
private CurrentSkin: Skin;
|
|
|
|
private CurrentSkin: Skin;
|
|
|
|
private TabSkin: Skin[];
|
|
|
|
private TabSkin: Skin[];
|
|
|
|
private TabConv?: Conversation[];
|
|
|
|
private TabConv?: Conversation[];
|
|
|
|
|
|
|
|
|
|
|
|
/* Consturctor of the class */
|
|
|
|
/* Consturctor of the class */
|
|
|
|
constructor(id: string, username: string, nationality: string, sexe: string, dateOfBirth: Date, currentCoins: number, totalCoins: number,
|
|
|
|
constructor(id: string, username: string, nationality: string, sexe: string, dateOfBirth: Date, currentCoins: number, totalCoins: number,
|
|
|
|
currentSkin: Skin, tabSkin: Skin[], tabConv?: Conversation[] ){
|
|
|
|
nbGamePlayed:number, currentSkin: Skin, tabSkin: Skin[], tabConv?: Conversation[] ){
|
|
|
|
this.Id=id;
|
|
|
|
this.Id=id;
|
|
|
|
this.Username=username;
|
|
|
|
this.Username=username;
|
|
|
|
this.Nationality=nationality;
|
|
|
|
this.Nationality=nationality;
|
|
|
|
this.Sexe=sexe;
|
|
|
|
this.Sexe=sexe;
|
|
|
|
this.DateOfBirth=dateOfBirth;
|
|
|
|
this.DateOfBirth=dateOfBirth;
|
|
|
|
|
|
|
|
this.NbGamePlayed=nbGamePlayed;
|
|
|
|
this.CurrentCoins=currentCoins;
|
|
|
|
this.CurrentCoins=currentCoins;
|
|
|
|
this.TotalCoins=totalCoins;
|
|
|
|
this.TotalCoins=totalCoins;
|
|
|
|
this.CurrentSkin=currentSkin;
|
|
|
|
this.CurrentSkin=currentSkin;
|
|
|
@ -45,11 +48,6 @@ export class User{
|
|
|
|
return this.Id;
|
|
|
|
return this.Id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the id of an user */
|
|
|
|
|
|
|
|
setId(id: string){
|
|
|
|
|
|
|
|
this.Id=id;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current number of coins of an user */
|
|
|
|
/* Brief : Function getting the current number of coins of an user */
|
|
|
|
getCurrentCoins(){
|
|
|
|
getCurrentCoins(){
|
|
|
|
return this.CurrentCoins;
|
|
|
|
return this.CurrentCoins;
|
|
|
@ -100,7 +98,20 @@ export class User{
|
|
|
|
this.TotalCoins=totalCoins;
|
|
|
|
this.TotalCoins=totalCoins;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current number of game played by an user */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getGamePlayed(){
|
|
|
|
|
|
|
|
return this.NbGamePlayed;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Brief : Function setting the current number of game played by an user */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setGamePlayed(nb: number){
|
|
|
|
|
|
|
|
this.NbGamePlayed=nb;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Brief : Function getting the current skin of an user */
|
|
|
|
/* Brief : Function getting the current skin of an user */
|
|
|
|
|
|
|
|
|
|
|
|
getCurrentSkin(){
|
|
|
|
getCurrentSkin(){
|
|
|
|
return this.CurrentSkin;
|
|
|
|
return this.CurrentSkin;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -131,4 +142,20 @@ export class User{
|
|
|
|
this.TabConv?.push(conv);
|
|
|
|
this.TabConv?.push(conv);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changeUserCoins(coin:number){
|
|
|
|
|
|
|
|
this.CurrentCoins+=coin;
|
|
|
|
|
|
|
|
if (coin>0){
|
|
|
|
|
|
|
|
this.TotalCoins+=coin;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changerCurrentSkin(skin:Skin){
|
|
|
|
|
|
|
|
this.CurrentSkin=skin;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ajouterSkin(skin:Skin){
|
|
|
|
|
|
|
|
this.TabSkin.push(skin);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|