CHANGE:
continuous-integration/drone/push Build is failing Details

Changement des méthodes et des attributs des classes
ADD:
Ajout de classes qui dépendent
temp
Thomas Chazot 2 years ago
parent 7f087f9843
commit ce9c40f7b4

@ -2,6 +2,7 @@ import { randomBytes } from "crypto";
import { ImageSourcePropType } from "react-native";
export abstract class Game{
readonly id:string;
private name:string;
private imageSource:ImageSourcePropType;
private gameSource:string;
@ -9,7 +10,8 @@ export abstract class Game{
private nbPlayerMax:number;
/* Constructor of the class */
constructor (name:string, imageSource:ImageSourcePropType, gameSource:string, nbPlayerMin:number, nbPlayerMax:number){
constructor (id:string, name:string, imageSource:ImageSourcePropType, gameSource:string, nbPlayerMin:number, nbPlayerMax:number){
this.id=id;
this.name=name;
this.imageSource=imageSource;
this.gameSource=gameSource;
@ -17,6 +19,11 @@ export abstract class Game{
this.nbPlayerMax=nbPlayerMax;
}
/* Brief : Function getting the id of a game */
getId(){
return this.id;
}
/* Brief : Function getting the name of a game */
getName(){
return this.name;

@ -4,13 +4,16 @@ export class ManagerCoinsUser{
addCoins(u:User, coins:number){
u.setCurrentCoins(u.getCurrentCoins()+coins);
u.setTotalCoins(u.getTotalCoins()+coins);
//modif dans la bdd
}
removeCoins(u:User, coins:number){
u.setCurrentCoins(u.getCurrentCoins()-coins);
//modif dans la bdd
}
changeCurrentCoins(u:User, coins:number){
u.setCurrentCoins(coins);
//modif dans la bdd
}
}

@ -11,21 +11,21 @@ export class User{
private dateOfBirth: Date;
private currentCoins: number;
private totalCoins: number;
private nbGamePlayed: number;
private nbGamesPlayed: 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[] ){
nbGamesPlayed: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.nbGamesPlayed=nbGamesPlayed;
this.currentCoins=currentCoins;
this.totalCoins=totalCoins;
this.currentSkin=currentSkin;
@ -38,6 +38,7 @@ export class User{
}
}
/* Brief : Function getting the name of an user */
getUsername(){
return this.username;
@ -111,16 +112,16 @@ export class User{
this.totalCoins=totalCoins;
}
/* Brief : Function getting the current number of game played by an user */
/* Brief : Function getting the current number of games played by an user */
getGamePlayed(){
return this.nbGamePlayed;
getGamesPlayed(){
return this.nbGamesPlayed;
}
/* Brief : Function setting the current number of game played by an user */
/* Brief : Function setting the current number of games played by an user */
setGamePlayed(nb: number){
this.nbGamePlayed=nb;
setGamesPlayed(nb: number){
this.nbGamesPlayed=nb;
}
/* Brief : Function getting the current skin of an user */
@ -156,31 +157,8 @@ export class User{
});
}
/*
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);
addSkin(skin:Skin){
this.tabSkin.push(skin);
}
canConnect(username:string, mdp:string){
if (this.Username==username){
return this.Password==mdp;
}
return false;
}
usrPasswordEquals(username:string, password:string){
return this.Password==password && this.Username==username;
}
*/
}

@ -1,10 +0,0 @@
import { User } from "./user";
export class UserCreater{
create(username:string, password:string, passConf:string, nationality:string, sexe:string){
if (username=="" || username.includes(" ") || nationality=="" || password!=passConf || password=="" ||
sexe==""){
return null;
}
}
}

@ -0,0 +1,11 @@
import { User } from "./user";
import tabSkinApp from "../../constSkin";
export class UserCreator{
createUser(username:string, password:string, passConf: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]], undefined);
//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);
}
}

@ -8,31 +8,63 @@ import { User } from "./User/user";
export abstract class Match{
readonly code:string;
private inGame:Boolean;
private tabUsers:User[];
private theGame:Game;
constructor(code:string, tabUser:User[], game:Game){
this.code=code;
this.inGame=false;
this.tabUsers=[...tabUser];
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(){
return this.tabUsers;
}
/* Brief : Fuction setting the array of User */
setTabUser(tabUser:User[]){
this.tabUsers=[...tabUser];
}
/* Brief : Fuction getting code of a match */
getCode(){
return this.code;
}
/* Brief : Fuction getting the game of a match */
getGame(){
return this.theGame;
}
/* Brief : Fuction setting the game of a match */
setGame(game:Game){
this.theGame=game;
}

Loading…
Cancel
Save